mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 09:23:42 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears 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: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
158 lines
6.8 KiB
Diff
158 lines
6.8 KiB
Diff
From b141aec4c5d08b4a8cc141983d81356618ee6869 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sat, 29 Sep 2018 16:08:23 -0500
|
|
Subject: [PATCH] Turtle API
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
|
|
index 89792eec45..e4eecf5688 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
|
|
@@ -27,51 +27,63 @@ public class EntityTurtle extends EntityAnimal {
|
|
this.K = 1.0F;
|
|
}
|
|
|
|
+ public void setHome(BlockPosition pos) { g(pos); } // Paper - OBFHELPER
|
|
public void g(BlockPosition blockposition) {
|
|
this.datawatcher.set(EntityTurtle.bA, blockposition);
|
|
}
|
|
|
|
+ public BlockPosition getHome() { return dX(); } // Paper - OBFHELPER
|
|
private BlockPosition dX() {
|
|
return (BlockPosition) this.datawatcher.get(EntityTurtle.bA);
|
|
}
|
|
|
|
+ public void setTravelPos(BlockPosition pos) { h(pos); } // Paper - OBFHELPER
|
|
private void h(BlockPosition blockposition) {
|
|
this.datawatcher.set(EntityTurtle.bE, blockposition);
|
|
}
|
|
|
|
+ public BlockPosition getTravelPos() { return dY(); } // Paper - OBFHELPER
|
|
private BlockPosition dY() {
|
|
return (BlockPosition) this.datawatcher.get(EntityTurtle.bE);
|
|
}
|
|
|
|
+ public boolean hasEgg() { return dV(); } // Paper - OBFHELPER
|
|
public boolean dV() {
|
|
return (Boolean) this.datawatcher.get(EntityTurtle.bB);
|
|
}
|
|
|
|
+ public void setHasEgg(boolean hasEgg) { r(hasEgg); } // Paper - OBFHELPER
|
|
private void r(boolean flag) {
|
|
this.datawatcher.set(EntityTurtle.bB, flag);
|
|
}
|
|
|
|
+ public boolean isDigging() { return dW(); } // Paper - OBFHELPER
|
|
public boolean dW() {
|
|
return (Boolean) this.datawatcher.get(EntityTurtle.bD);
|
|
}
|
|
|
|
+ public void setDigging(boolean digging) { s(digging); } // Paper - OBFHELPER
|
|
private void s(boolean flag) {
|
|
this.bH = flag ? 1 : 0;
|
|
this.datawatcher.set(EntityTurtle.bD, flag);
|
|
}
|
|
|
|
+ public boolean isGoingHome() { return dZ(); } // Paper - OBFHELPER
|
|
private boolean dZ() {
|
|
return (Boolean) this.datawatcher.get(EntityTurtle.bF);
|
|
}
|
|
|
|
+ public void setGoingHome(boolean goingHome) { t(goingHome); } // Paper - OBFHELPER
|
|
private void t(boolean flag) {
|
|
this.datawatcher.set(EntityTurtle.bF, flag);
|
|
}
|
|
|
|
+ public boolean isTravelling() { return ee(); } // Paper - OBFHELPER
|
|
private boolean ee() {
|
|
return (Boolean) this.datawatcher.get(EntityTurtle.bG);
|
|
}
|
|
|
|
+ public void setTravelling(boolean travelling) { u(travelling); } // Paper - OBFHELPER
|
|
private void u(boolean flag) {
|
|
this.datawatcher.set(EntityTurtle.bG, flag);
|
|
}
|
|
@@ -445,14 +457,18 @@ public class EntityTurtle extends EntityAnimal {
|
|
|
|
if (!this.g.isInWater() && this.k()) {
|
|
if (this.g.bH < 1) {
|
|
- this.g.s(true);
|
|
+ this.g.setDigging(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.g.getBukkitEntity(), MCUtil.toLocation(this.g.world, this.e)).callEvent()); // Paper
|
|
} else if (this.g.bH > 200) {
|
|
World world = this.g.world;
|
|
|
|
// CraftBukkit start
|
|
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.g, this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, this.g.random.nextInt(4) + 1)).isCancelled()) {
|
|
+ // Paper start
|
|
+ int eggCount = this.g.random.nextInt(4) + 1;
|
|
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.g.getBukkitEntity(), MCUtil.toLocation(this.g.world, this.e.up()), eggCount);
|
|
+ if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.g, this.e.up(), Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, layEggEvent.getEggCount())).isCancelled()) {
|
|
world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
|
|
- world.setTypeAndData(this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, this.g.random.nextInt(4) + 1), 3);
|
|
+ world.setTypeAndData(this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, layEggEvent.getEggCount()), 3);
|
|
+ // Paper end
|
|
}
|
|
// CraftBukkit end
|
|
this.g.r(false);
|
|
@@ -587,7 +603,7 @@ public class EntityTurtle extends EntityAnimal {
|
|
|
|
@Override
|
|
public boolean a() {
|
|
- return this.a.isBaby() ? false : (this.a.dV() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.dX().a((IPosition) this.a.ch(), 64.0D)));
|
|
+ return this.a.isBaby() ? false : (this.a.dV() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.dX().a((IPosition) this.a.ch(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.a.getBukkitEntity()).callEvent(); // Paper;
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
|
|
index 123a2c75ca..8edcf7af65 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java
|
|
@@ -1,6 +1,8 @@
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
import net.minecraft.server.EntityTurtle;
|
|
+import net.minecraft.server.MCUtil;
|
|
+import org.bukkit.Location;
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.entity.EntityType;
|
|
import org.bukkit.entity.Turtle;
|
|
@@ -25,4 +27,36 @@ public class CraftTurtle extends CraftAnimals implements Turtle {
|
|
public EntityType getType() {
|
|
return EntityType.TURTLE;
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public Location getHome() {
|
|
+ return MCUtil.toLocation(getHandle().world, getHandle().getHome());
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setHome(Location location) {
|
|
+ getHandle().setHome(MCUtil.toBlockPosition(location));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isGoingHome() {
|
|
+ return getHandle().isGoingHome();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isDigging() {
|
|
+ return getHandle().isDigging();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasEgg() {
|
|
+ return getHandle().hasEgg();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setHasEgg(boolean hasEgg) {
|
|
+ getHandle().setHasEgg(hasEgg);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
--
|
|
2.21.0
|
|
|