mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
928bcc8d3a
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 09943450 Update SnakeYAML version 5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc 6f82b381 PR-788: Add getHand() to all relevant events CraftBukkit Changes: aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe 5329dd6fd PR-1107: Add getHand() to all relevant events 93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
95 lines
4.3 KiB
Diff
95 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Tue, 7 Jul 2020 10:52:34 -0700
|
|
Subject: [PATCH] More World API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index 73a475b7d268e84cc9eb608664c5d753da212bee..3e4b077f2c890b28c88c62b0491f9f2a355446c9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -2035,6 +2035,65 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), this.getHandle().registryAccess()), new Location(this, found.getFirst().getX(), found.getFirst().getY(), found.getFirst().getZ()));
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public Location locateNearestBiome(Location origin, Biome biome, int radius) {
|
|
+ return this.locateNearestBiome(origin, biome, radius, 8);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
|
|
+ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ());
|
|
+ BlockPos nearest = getHandle().findClosestBiome3d( holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step).getFirst();
|
|
+ return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isUltrawarm() {
|
|
+ return getHandle().dimensionType().ultraWarm();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public double getCoordinateScale() {
|
|
+ return getHandle().dimensionType().coordinateScale();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasSkylight() {
|
|
+ return getHandle().dimensionType().hasSkyLight();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasBedrockCeiling() {
|
|
+ return getHandle().dimensionType().hasSkyLight();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean doesBedWork() {
|
|
+ return getHandle().dimensionType().bedWorks();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean doesRespawnAnchorWork() {
|
|
+ return getHandle().dimensionType().respawnAnchorWorks();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isFixedTime() {
|
|
+ return getHandle().dimensionType().hasFixedTime();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Collection<org.bukkit.Material> getInfiniburn() {
|
|
+ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(net.minecraft.core.Registry.BLOCK.getTagOrEmpty(this.getHandle().dimensionType().infiniburn()).iterator(), blockHolder -> CraftMagicNumbers.getMaterial(blockHolder.value())));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
|
+ getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.Registry.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public Raid locateNearestRaid(Location location, int radius) {
|
|
Validate.notNull(location, "Location cannot be null");
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
|
index 3071ac1ac0e733d73dade49597a39f7d156bbc04..60c4afd5cad66ffb0cfb5c1fa9857def593813ae 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
|
@@ -12,4 +12,13 @@ public final class CraftVector {
|
|
public static net.minecraft.world.phys.Vec3 toNMS(org.bukkit.util.Vector bukkit) {
|
|
return new net.minecraft.world.phys.Vec3(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
|
}
|
|
+ // Paper start
|
|
+ public static org.bukkit.util.Vector toBukkit(net.minecraft.core.BlockPos blockPosition) {
|
|
+ return new org.bukkit.util.Vector(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
|
+ }
|
|
+
|
|
+ public static net.minecraft.core.BlockPos toBlockPos(org.bukkit.util.Vector bukkit) {
|
|
+ return new net.minecraft.core.BlockPos(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
|
+ }
|
|
+ // Paper end
|
|
}
|