3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00

Update to Minecraft 1.16.2

Dieser Commit ist enthalten in:
md_5 2020-08-12 07:00:00 +10:00
Ursprung 4b9bc9daa5
Commit 9c9fb593f5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: E8E901AC7C617C11
208 geänderte Dateien mit 2144 neuen und 2455 gelöschten Zeilen

Datei anzeigen

@ -18,10 +18,10 @@
entityvillager.getBehaviorController().removeMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
worldserver.broadcastEntityEffect(entityvillager, (byte) 14);
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
@@ -30,7 +35,14 @@
@@ -31,7 +36,14 @@
return villagerprofession.b() == villageplacetype;
}).findFirst();
}).ifPresent((villagerprofession) -> {
@ -34,6 +34,6 @@
+
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
+ // CraftBukkit end
entityvillager.b(worldserver);
entityvillager.c(worldserver);
});
}

Datei anzeigen

@ -1,22 +1,48 @@
--- a/net/minecraft/server/BehaviorInteractDoor.java
+++ b/net/minecraft/server/BehaviorInteractDoor.java
@@ -46,11 +46,18 @@
if (TagsBlock.WOODEN_DOORS.isTagged(block) && block instanceof BlockDoor) {
boolean flag = j >= i;
@@ -52,6 +52,13 @@
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
if (!blockdoor.h(iblockdata)) {
+ // CraftBukkit start - entities opening doors
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
+ entityliving.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ // CaftBukkit end
((BlockDoor) block).setDoor(worldserver, blockposition, flag);
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
+ // CraftBukkit end
blockdoor.setDoor(worldserver, iblockdata, blockposition, true);
}
if (!behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).isPresent() && flag) {
- behaviorcontroller.setMemory(MemoryModuleType.OPENED_DOORS, (Object) Sets.newHashSet(new GlobalPos[]{globalpos}));
+ behaviorcontroller.setMemory(MemoryModuleType.OPENED_DOORS, Sets.newHashSet(new GlobalPos[]{globalpos})); // CraftBukkit - decompile error
@@ -65,6 +72,13 @@
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
if (!blockdoor1.h(iblockdata1)) {
+ // CraftBukkit start - entities opening doors
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
+ entityliving.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
blockdoor1.setDoor(worldserver, iblockdata1, blockposition1, true);
this.c(worldserver, entityliving, blockposition1);
}
@@ -113,7 +127,7 @@
private static boolean a(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
- return !behaviorcontroller.hasMemory(MemoryModuleType.MOBS) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()).stream().filter((entityliving1) -> {
+ return !behaviorcontroller.hasMemory(MemoryModuleType.MOBS) ? false : (behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
return entityliving1.getEntityType() == entityliving.getEntityType();
}).filter((entityliving1) -> {
return blockposition.a((IPosition) entityliving1.getPositionVector(), 2.0D);
@@ -155,7 +169,7 @@
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
} else {
behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).ifPresent((set1) -> {
if (flag) {
- behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, (Object) Sets.newHashSet(new GlobalPos[]{globalpos}));
+ behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, Sets.newHashSet(new GlobalPos[]{globalpos})); // CraftBukkit - decompile error
}
}

Datei anzeigen

@ -2,8 +2,8 @@
+++ b/net/minecraft/server/BehaviorMakeLove.java
@@ -93,6 +93,11 @@
private Optional<EntityVillager> a(EntityVillager entityvillager, EntityVillager entityvillager1) {
EntityVillager entityvillager2 = entityvillager.createChild(entityvillager1);
private Optional<EntityVillager> b(WorldServer worldserver, EntityVillager entityvillager, EntityVillager entityvillager1) {
EntityVillager entityvillager2 = entityvillager.createChild(worldserver, entityvillager1);
+ // CraftBukkit start - call EntityBreedEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityvillager2, entityvillager, entityvillager1, null, null, 0).isCancelled()) {
+ return Optional.empty();
@ -16,9 +16,9 @@
entityvillager1.setAgeRaw(6000);
entityvillager2.setAgeRaw(-24000);
entityvillager2.setPositionRotation(entityvillager.locX(), entityvillager.locY(), entityvillager.locZ(), 0.0F, 0.0F);
- entityvillager.world.addEntity(entityvillager2);
+ entityvillager.world.addEntity(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
entityvillager.world.broadcastEntityEffect(entityvillager2, (byte) 12);
- worldserver.addAllEntities(entityvillager2);
+ worldserver.addAllEntities(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
worldserver.broadcastEntityEffect(entityvillager2, (byte) 12);
return Optional.of(entityvillager2);
}
@@ -110,6 +115,6 @@

Datei anzeigen

@ -25,6 +25,6 @@
+
+ entityvillager.setVillagerData(entityvillager.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
+ // CraftBukkit end
entityvillager.b(worldserver);
entityvillager.c(worldserver);
}
}

Datei anzeigen

@ -1,26 +0,0 @@
--- a/net/minecraft/server/BehaviorWork.java
+++ b/net/minecraft/server/BehaviorWork.java
@@ -27,19 +27,19 @@
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
BehaviorController<EntityVillager> behaviorcontroller = entityvillager.getBehaviorController();
- behaviorcontroller.setMemory(MemoryModuleType.LAST_WORKED_AT_POI, (Object) i);
+ behaviorcontroller.setMemory(MemoryModuleType.LAST_WORKED_AT_POI, i); // CraftBukkit - decompile error
behaviorcontroller.getMemory(MemoryModuleType.JOB_SITE).ifPresent((globalpos) -> {
- behaviorcontroller.setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(globalpos.getBlockPosition())));
+ behaviorcontroller.setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(globalpos.getBlockPosition()))); // CraftBukkit - decompile error
});
entityvillager.fd();
- this.a(worldserver, entityvillager);
+ this.doWork(worldserver, entityvillager); // PAIL
if (entityvillager.fc()) {
entityvillager.fb();
}
}
- protected void a(WorldServer worldserver, EntityVillager entityvillager) {}
+ protected void doWork(WorldServer worldserver, EntityVillager entityvillager) {} // PAIL
protected boolean b(WorldServer worldserver, EntityVillager entityvillager, long i) {
Optional<GlobalPos> optional = entityvillager.getBehaviorController().getMemory(MemoryModuleType.JOB_SITE);

Datei anzeigen

@ -9,21 +9,21 @@
Optional<GlobalPos> optional = entityvillager.getBehaviorController().getMemory(MemoryModuleType.JOB_SITE);
if (optional.isPresent()) {
@@ -28,7 +28,7 @@
@@ -30,7 +30,7 @@
BlockPosition blockposition = globalpos.getBlockPosition();
private void a(WorldServer worldserver, EntityVillager entityvillager, GlobalPos globalpos, IBlockData iblockdata) {
if ((Integer) iblockdata.get(BlockComposter.a) == 8) {
- iblockdata = BlockComposter.d(iblockdata, (World) worldserver, globalpos.getBlockPosition());
+ iblockdata = BlockComposter.d(iblockdata, (World) worldserver, globalpos.getBlockPosition(), entityvillager); // CraftBukkit
- iblockdata = BlockComposter.d(iblockdata, (World) worldserver, blockposition);
+ iblockdata = BlockComposter.d(iblockdata, (World) worldserver, blockposition, entityvillager); // CraftBukkit
}
int i = 20;
@@ -52,7 +52,7 @@
@@ -55,7 +55,7 @@
i -= k1;
for (int l1 = 0; l1 < k1; ++l1) {
- iblockdata = BlockComposter.a(iblockdata, worldserver, itemstack, globalpos.getBlockPosition());
+ iblockdata = BlockComposter.a(iblockdata, worldserver, itemstack, globalpos.getBlockPosition(), entityvillager); // CraftBukkit
if ((Integer) iblockdata.get(BlockComposter.a) == 7) {
- iblockdata1 = BlockComposter.a(iblockdata1, worldserver, itemstack, blockposition);
+ iblockdata1 = BlockComposter.a(iblockdata1, worldserver, itemstack, blockposition, entityvillager); // CraftBukkit
if ((Integer) iblockdata1.get(BlockComposter.a) == 7) {
this.a(worldserver, iblockdata, blockposition, iblockdata1);
return;
}

Datei anzeigen

@ -1,26 +1,8 @@
--- a/net/minecraft/server/BiomeStorage.java
+++ b/net/minecraft/server/BiomeStorage.java
@@ -88,7 +88,7 @@
int[] aint = new int[this.g.length];
@@ -87,4 +87,14 @@
for (int i = 0; i < this.g.length; ++i) {
- aint[i] = IRegistry.BIOME.a((Object) this.g[i]);
+ aint[i] = IRegistry.BIOME.a(this.g[i]); // CraftBukkit - decompile error
}
return aint;
@@ -101,7 +101,7 @@
for (int j = 0; j < i; ++j) {
BiomeBase biomebase = abiomebase[j];
- packetdataserializer.writeInt(IRegistry.BIOME.a((Object) biomebase));
+ packetdataserializer.writeInt(IRegistry.BIOME.a(biomebase)); // CraftBukkit - decompile error
}
}
@@ -118,4 +118,14 @@
return this.g[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l];
return this.h[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l];
}
+
+ // CraftBukkit start
@ -29,7 +11,7 @@
+ int i1 = MathHelper.clamp(j, 0, BiomeStorage.c);
+ int j1 = k & BiomeStorage.b;
+
+ this.g[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l] = biome;
+ this.h[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l] = biome;
+ }
+ // CraftBukkit end
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
@@ -217,7 +217,13 @@
@@ -209,7 +209,13 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
entityitem.defaultPickupDelay();
@ -15,12 +15,12 @@
}
}
@@ -344,6 +350,12 @@
@@ -336,6 +342,12 @@
return this;
}
+ // CraftBukkit start
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
+ return 0;
+ }
+ // CraftBukkit end

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockBamboo.java
+++ b/net/minecraft/server/BlockBamboo.java
@@ -168,14 +168,18 @@
@@ -170,14 +170,18 @@
BlockPosition blockposition1 = blockposition.down(2);
IBlockData iblockdata2 = world.getType(blockposition1);
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
@ -21,7 +21,7 @@
}
}
} else {
@@ -186,7 +190,14 @@
@@ -188,7 +192,14 @@
int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1;
int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;

Datei anzeigen

@ -56,12 +56,3 @@
}
private boolean a(World world, BlockPosition blockposition) {
@@ -225,7 +254,7 @@
AxisAlignedBB axisalignedbb = entitytypes.a(vec3d.x, vec3d.y, vec3d.z);
if (iworldreader.b(axisalignedbb)) {
- Stream stream = iworldreader.a(axisalignedbb.b(0.0D, -0.20000000298023224D, 0.0D));
+ Stream<IBlockData> stream = iworldreader.a(axisalignedbb.b(0.0D, -0.20000000298023224D, 0.0D)); // CraftBukkit - decompile error
entitytypes.getClass();
if (stream.noneMatch(entitytypes::a)) {

Datei anzeigen

@ -14,11 +14,11 @@
if (flag && b((IWorldReader) worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmpty(blockposition.up(2))) {
- worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
- this.b(worldserver, blockposition1, i);
- this.a(worldserver, blockposition1, i);
+ // CraftBukkit start - add event
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
+ worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
+ this.b(worldserver, blockposition1, i);
+ this.a(worldserver, blockposition1, i);
+ }
+ // CraftBukkit end
} else if (i < 4) {
@ -28,11 +28,11 @@
BlockPosition blockposition2 = blockposition.shift(enumdirection);
if (worldserver.isEmpty(blockposition2) && worldserver.isEmpty(blockposition2.down()) && b((IWorldReader) worldserver, blockposition2, enumdirection.opposite())) {
- this.b(worldserver, blockposition2, i + 1);
- this.a(worldserver, blockposition2, i + 1);
- flag2 = true;
+ // CraftBukkit start - add event
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) {
+ this.b(worldserver, blockposition2, i + 1);
+ this.a(worldserver, blockposition2, i + 1);
+ flag2 = true;
+ }
+ // CraftBukkit end

Datei anzeigen

@ -47,8 +47,8 @@
+ // CraftBukkit end
itemstack.subtract(1);
worldserver.triggerEffect(1500, blockposition, iblockdata != iblockdata1 ? 1 : 0);
@@ -177,7 +188,15 @@
return iblockdata1;
@@ -176,7 +187,15 @@
}
}
@ -65,7 +65,7 @@
if (!world.isClientSide) {
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * 0.7F) + 0.15000000596046448D;
@@ -203,10 +222,16 @@
@@ -202,10 +221,16 @@
}
private static IBlockData b(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
@ -83,7 +83,7 @@
return iblockdata;
} else {
int j = i + 1;
@@ -254,7 +279,8 @@
@@ -253,7 +278,8 @@
public IWorldInventory a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
int i = (Integer) iblockdata.get(BlockComposter.a);
@ -93,7 +93,7 @@
}
static class ContainerInput extends InventorySubcontainer implements IWorldInventory {
@@ -266,6 +292,7 @@
@@ -265,6 +291,7 @@
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
super(1);
@ -101,7 +101,7 @@
this.a = iblockdata;
this.b = generatoraccess;
this.c = blockposition;
@@ -318,6 +345,7 @@
@@ -317,6 +344,7 @@
this.blockData = iblockdata;
this.generatorAccess = generatoraccess;
this.blockPosition = blockposition;
@ -109,7 +109,7 @@
}
@Override
@@ -342,15 +370,23 @@
@@ -341,15 +369,23 @@
@Override
public void update() {

Datei anzeigen

@ -46,18 +46,22 @@
}
private static boolean canHarden(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
@@ -59,6 +81,20 @@
@@ -59,6 +81,24 @@
@Override
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
- return a((IBlockAccess) generatoraccess, blockposition) ? this.a : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
+ // CraftBukkit start
+ if (a((IBlockAccess) generatoraccess, blockposition)) {
+ // Suppress during worldgen
+ if (!(generatoraccess instanceof World)) {
+ return this.a;
+ }
+ CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition);
+ blockState.setData(this.a);
+
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ generatoraccess.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event);
+ ((World) generatoraccess).getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ return blockState.getHandle();

Datei anzeigen

@ -9,7 +9,7 @@
public class BlockDoor extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -155,9 +157,24 @@
@@ -157,9 +159,24 @@
@Override
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
@ -34,5 +34,5 @@
+ boolean flag1 = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
if (flag1 != (Boolean) iblockdata.get(BlockDoor.OPEN)) {
this.b(world, blockposition, flag1);
this.a(world, blockposition, flag1);
}

Datei anzeigen

@ -29,7 +29,7 @@
+ }
+
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
+ world.getServer().getPluginManager().callEvent(event);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }

Datei anzeigen

@ -24,10 +24,10 @@
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (entity instanceof EntityPlayer) {
+ ((EntityPlayer) entity).a(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ ((EntityPlayer) entity).b(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ return;
+ }
+ // CraftBukkit end
entity.a(worldserver);
entity.b(worldserver);
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockFire.java
+++ b/net/minecraft/server/BlockFire.java
@@ -5,6 +5,13 @@
import java.util.Map;
import java.util.Random;
@@ -8,6 +8,13 @@
import java.util.function.Function;
import java.util.stream.Collectors;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlockState;
@ -14,7 +14,7 @@
public class BlockFire extends BlockFireAbstract {
public static final BlockStateInteger AGE = BlockProperties.aj;
@@ -26,7 +33,24 @@
@@ -64,7 +71,24 @@
@Override
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
@ -29,7 +29,7 @@
+ blockState.setData(Blocks.AIR.getBlockData());
+
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
+ generatoraccess.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event);
+ ((World) generatoraccess).getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
@ -40,7 +40,7 @@
}
@Override
@@ -97,7 +121,7 @@
@@ -113,7 +137,7 @@
worldserver.getBlockTickList().a(blockposition, this, a(worldserver.random));
if (worldserver.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) {
if (!iblockdata.canPlace(worldserver, blockposition)) {
@ -49,7 +49,7 @@
}
IBlockData iblockdata1 = worldserver.getType(blockposition.down());
@@ -105,7 +129,7 @@
@@ -121,7 +145,7 @@
int i = (Integer) iblockdata.get(BlockFire.AGE);
if (!flag && worldserver.isRaining() && this.a((World) worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
@ -58,7 +58,7 @@
} else {
int j = Math.min(15, i + random.nextInt(3) / 2);
@@ -119,14 +143,14 @@
@@ -135,14 +159,14 @@
BlockPosition blockposition1 = blockposition.down();
if (!worldserver.getType(blockposition1).d(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
@ -75,7 +75,7 @@
return;
}
}
@@ -134,12 +158,14 @@
@@ -150,12 +174,14 @@
boolean flag1 = worldserver.u(blockposition);
int k = flag1 ? -50 : 0;
@ -96,7 +96,7 @@
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
for (int l = -1; l <= 1; ++l) {
@@ -165,7 +191,15 @@
@@ -181,7 +207,15 @@
if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.a((World) worldserver, (BlockPosition) blockposition_mutableblockposition))) {
int j2 = Math.min(15, i + random.nextInt(5) / 4);
@ -113,7 +113,7 @@
}
}
}
@@ -189,12 +223,24 @@
@@ -205,12 +239,24 @@
return iblockdata.b(BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C) ? 0 : this.flameChances.getInt(iblockdata.getBlock());
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockFireAbstract.java
+++ b/net/minecraft/server/BlockFireAbstract.java
@@ -41,7 +41,14 @@
@@ -36,7 +36,14 @@
if (!entity.isFireProof()) {
entity.setFireTicks(entity.getFireTicks() + 1);
if (entity.getFireTicks() == 0) {
@ -15,23 +15,27 @@
+ // CraftBukkit end
}
entity.damageEntity(DamageSource.FIRE, this.g);
@@ -53,9 +60,10 @@
@Override
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (!iblockdata1.a(iblockdata.getBlock())) {
- if (world.getDimensionKey() != World.OVERWORLD && world.getDimensionKey() != World.THE_NETHER || !BlockPortal.a((GeneratorAccess) world, blockposition)) {
+ // CraftBukkit - getTypeKey()
+ if (world.getTypeKey() != DimensionManager.OVERWORLD && world.getTypeKey() != DimensionManager.THE_NETHER || !BlockPortal.a((GeneratorAccess) world, blockposition)) {
entity.damageEntity(DamageSource.FIRE, this.b);
@@ -58,14 +65,14 @@
}
if (!iblockdata.canPlace(world, blockposition)) {
- world.a(blockposition, false);
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
}
}
@@ -92,4 +100,12 @@
}
return true;
private static boolean a(World world) {
- return world.getDimensionKey() == World.OVERWORLD || world.getDimensionKey() == World.THE_NETHER;
+ return world.getTypeKey() != DimensionManager.OVERWORLD && world.getTypeKey() != DimensionManager.THE_NETHER; // CraftBukkit - getTypeKey()
}
@Override
@@ -103,4 +110,12 @@
return flag && BlockPortalShape.a((GeneratorAccess) world, blockposition, enumdirection.h().n()).isPresent();
}
}
+
+ // CraftBukkit start

Datei anzeigen

@ -11,6 +11,6 @@
+ BlockSapling.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS;
+ }
+ // CraftBukkit end
((WorldGenFeatureConfigured) this.b.get()).a(worldserver, worldserver.getStructureManager(), worldserver.getChunkProvider().getChunkGenerator(), random, blockposition);
((WorldGenFeatureConfigured) this.b.get()).a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition);
}
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockGrass.java
+++ b/net/minecraft/server/BlockGrass.java
@@ -63,7 +63,7 @@
@@ -64,7 +64,7 @@
}
if (iblockdata3.canPlace(worldserver, blockposition2)) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockGrowingTop.java
+++ b/net/minecraft/server/BlockGrowingTop.java
@@ -36,7 +36,7 @@
@@ -29,7 +29,7 @@
BlockPosition blockposition1 = blockposition.shift(this.a);
if (this.h(worldserver.getType(blockposition1))) {

Datei anzeigen

@ -9,7 +9,7 @@
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.ad;
@@ -57,6 +59,16 @@
@@ -58,6 +60,16 @@
}
IBlockData iblockdata1;

Datei anzeigen

@ -2,18 +2,18 @@
+++ b/net/minecraft/server/BlockMobSpawner.java
@@ -14,9 +14,19 @@
@Override
public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
super.dropNaturally(iblockdata, world, blockposition, itemstack);
public void dropNaturally(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
super.dropNaturally(iblockdata, worldserver, blockposition, itemstack);
+ /* CraftBukkit start - Delegate to getExpDrop
int i = 15 + world.random.nextInt(15) + world.random.nextInt(15);
int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
this.dropExperience(world, blockposition, i);
this.dropExperience(worldserver, blockposition, i);
+ */
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
+ int i = 15 + world.random.nextInt(15) + world.random.nextInt(15);
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
+ int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
+
+ return i;
+ // CraftBukkit end

Datei anzeigen

@ -10,11 +10,11 @@
private final Block a;
@@ -26,7 +28,7 @@
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.a(world);
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.a((World) worldserver);
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
- world.addEntity(entitysilverfish);
+ world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
- worldserver.addEntity(entitysilverfish);
+ worldserver.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
entitysilverfish.doSpawnEffect();
}

Datei anzeigen

@ -20,22 +20,19 @@
}
}
@@ -69,14 +73,16 @@
@@ -69,6 +73,7 @@
WorldGenFeatureConfigured worldgenfeatureconfigured;
if (this == Blocks.BROWN_MUSHROOM) {
- worldgenfeatureconfigured = WorldGenerator.HUGE_BROWN_MUSHROOM.b((WorldGenFeatureConfiguration) BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM);
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
+ worldgenfeatureconfigured = WorldGenerator.HUGE_BROWN_MUSHROOM.b(BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM); // CraftBukkit - decompile error
worldgenfeatureconfigured = BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM;
} else {
if (this != Blocks.RED_MUSHROOM) {
worldserver.setTypeAndData(blockposition, iblockdata, 3);
@@ -76,6 +81,7 @@
return false;
}
- worldgenfeatureconfigured = WorldGenerator.HUGE_RED_MUSHROOM.b((WorldGenFeatureConfiguration) BiomeDecoratorGroups.HUGE_RED_MUSHROOM);
+ BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
+ worldgenfeatureconfigured = WorldGenerator.HUGE_RED_MUSHROOM.b(BiomeDecoratorGroups.HUGE_RED_MUSHROOM); // CraftBukkit - decompile error
worldgenfeatureconfigured = BiomeDecoratorGroups.HUGE_RED_MUSHROOM;
}
if (worldgenfeatureconfigured.a(worldserver, worldserver.getStructureManager(), worldserver.getChunkProvider().getChunkGenerator(), random, blockposition)) {

Datei anzeigen

@ -2,14 +2,14 @@
+++ b/net/minecraft/server/BlockOre.java
@@ -15,6 +15,7 @@
@Override
public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
super.dropNaturally(iblockdata, world, blockposition, itemstack);
public void dropNaturally(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
super.dropNaturally(iblockdata, worldserver, blockposition, itemstack);
+ /* CraftBukkit start - Delegated to getExpDrop
if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
int i = this.a(world.random);
int i = this.a(worldserver.random);
@@ -22,6 +23,21 @@
this.dropExperience(world, blockposition, i);
this.dropExperience(worldserver, blockposition, i);
}
}
+ // */
@ -17,9 +17,9 @@
}
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
+ if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
+ int i = this.a(world.random);
+ int i = this.a(worldserver.random);
+
+ if (i > 0) {
+ return i;

Datei anzeigen

@ -34,7 +34,7 @@
world.playBlockAction(blockposition, this, b0, enumdirection.c());
}
@@ -277,6 +297,48 @@
@@ -279,6 +299,48 @@
IBlockData[] aiblockdata = new IBlockData[list.size() + list2.size()];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
int j = 0;

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockPortal.java
+++ b/net/minecraft/server/BlockPortal.java
@@ -4,6 +4,13 @@
@@ -2,6 +2,13 @@
import java.util.Random;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
@ -14,7 +14,7 @@
public class BlockPortal extends Block {
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.E;
@@ -34,7 +41,8 @@
@@ -32,7 +39,8 @@
}
if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
@ -23,21 +23,8 @@
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
if (entity != null) {
entity.portalCooldown = entity.getDefaultPortalCooldown();
@@ -48,8 +56,10 @@
BlockPortal.Shape blockportal_shape = b(generatoraccess, blockposition);
if (blockportal_shape != null) {
- blockportal_shape.createPortal();
- return true;
+ // CraftBukkit start - return portalcreator
+ return blockportal_shape.createPortal();
+ // return true;
+ // CraftBukkit end
} else {
return false;
}
@@ -80,6 +90,10 @@
entity.resetPortalCooldown();
@@ -54,6 +62,10 @@
@Override
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) {
@ -48,92 +35,3 @@
entity.d(blockposition);
}
@@ -172,6 +186,7 @@
private BlockPosition position;
private int height;
private int width;
+ java.util.List<org.bukkit.block.BlockState> blocks = new java.util.ArrayList<org.bukkit.block.BlockState>(); // CraftBukkit - add field
public Shape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
this.a = generatoraccess;
@@ -228,6 +243,9 @@
}
protected int c() {
+ // CraftBukkit start
+ this.blocks.clear();
+ // CraftBukkit end
int i;
label56:
@@ -247,9 +265,19 @@
if (i == 0) {
if (!this.a.getType(blockposition.shift(this.d)).a(Blocks.OBSIDIAN)) {
break label56;
+ // CraftBukkit start - add the block to our list
+ } else {
+ BlockPosition pos = blockposition.shift(this.d);
+ blocks.add(CraftBlock.at(this.a, pos).getState());
+ // CraftBukkit end
}
} else if (i == this.width - 1 && !this.a.getType(blockposition.shift(this.c)).a(Blocks.OBSIDIAN)) {
break label56;
+ // CraftBukkit start - add the block to our list
+ } else {
+ BlockPosition pos = blockposition.shift(this.c);
+ blocks.add(CraftBlock.at(this.a, pos).getState());
+ // CraftBukkit end
}
}
}
@@ -258,6 +286,11 @@
if (!this.a.getType(this.position.shift(this.c, i).up(this.height)).a(Blocks.OBSIDIAN)) {
this.height = 0;
break;
+ // CraftBukkit start - add the block to our list
+ } else {
+ BlockPosition pos = this.position.shift(this.c, i).up(this.height);
+ blocks.add(CraftBlock.at(this.a, pos).getState());
+ // CraftBukkit end
}
}
@@ -279,7 +312,29 @@
return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
}
- public void createPortal() {
+ // CraftBukkit start - return boolean
+ public boolean createPortal() {
+ org.bukkit.World bworld = this.a.getMinecraftWorld().getWorld();
+
+ // Copy below for loop
+ for (int i = 0; i < this.width; ++i) {
+ BlockPosition blockposition = this.position.shift(this.c, i);
+
+ for (int j = 0; j < this.height; ++j) {
+ BlockPosition pos = blockposition.up(j);
+ CraftBlockState state = CraftBlockState.getBlockState(this.a.getMinecraftWorld(), pos, 18);
+ state.setData((IBlockData) Blocks.NETHER_PORTAL.getBlockData().set(BlockPortal.AXIS, this.b));
+ blocks.add(state);
+ }
+ }
+
+ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, null, PortalCreateEvent.CreateReason.FIRE);
+ this.a.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ // CraftBukkit end
for (int i = 0; i < this.width; ++i) {
BlockPosition blockposition = this.position.shift(this.c, i);
@@ -288,6 +343,7 @@
}
}
+ return true; // CraftBukkit
}
private boolean g() {

Datei anzeigen

@ -0,0 +1,72 @@
--- a/net/minecraft/server/BlockPortalShape.java
+++ b/net/minecraft/server/BlockPortalShape.java
@@ -4,6 +4,13 @@
import java.util.function.Predicate;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.block.CraftBlockState;
+import org.bukkit.event.entity.EntityPortalEnterEvent;
+import org.bukkit.event.world.PortalCreateEvent;
+// CraftBukkit end
+
public class BlockPortalShape {
private static final BlockBase.e a = (iblockdata, iblockaccess, blockposition) -> {
@@ -17,6 +24,7 @@
private BlockPosition position;
private int height;
private int width;
+ java.util.List<org.bukkit.block.BlockState> blocks = new java.util.ArrayList<org.bukkit.block.BlockState>(); // CraftBukkit - add field
public static Optional<BlockPortalShape> a(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
return a(generatoraccess, blockposition, (blockportalshape) -> {
@@ -81,6 +89,7 @@
if (!a(iblockdata)) {
if (BlockPortalShape.a.test(iblockdata, this.b, blockposition_mutableblockposition)) {
+ blocks.add(CraftBlock.at(this.b, blockposition_mutableblockposition).getState()); // CraftBukkit
return i;
}
break;
@@ -152,12 +161,30 @@
return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
}
- public void createPortal() {
+ // CraftBukkit start - return boolean
+ public boolean createPortal() {
+ org.bukkit.World bworld = this.b.getMinecraftWorld().getWorld();
+
+ // Copy below for loop
IBlockData iblockdata = (IBlockData) Blocks.NETHER_PORTAL.getBlockData().set(BlockPortal.AXIS, this.c);
BlockPosition.a(this.position, this.position.shift(EnumDirection.UP, this.height - 1).shift(this.d, this.width - 1)).forEach((blockposition) -> {
+ CraftBlockState state = CraftBlockState.getBlockState(this.b.getMinecraftWorld(), blockposition, 18);
+ state.setData(iblockdata);
+ blocks.add(state);
+ });
+
+ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, null, PortalCreateEvent.CreateReason.FIRE);
+ this.b.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ // CraftBukkit end
+ BlockPosition.a(this.position, this.position.shift(EnumDirection.UP, this.height - 1).shift(this.d, this.width - 1)).forEach((blockposition) -> {
this.b.setTypeAndData(blockposition, iblockdata, 18);
});
+ return true; // CraftBukkit
}
public boolean c() {
@@ -208,6 +235,6 @@
boolean flag = enumdirection_enumaxis1 == EnumDirection.EnumAxis.X;
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
- return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1);
+ return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1, worldserver); // CraftBukkit
}
}

Datei anzeigen

@ -85,22 +85,22 @@
@@ -60,12 +91,25 @@
@Override
public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
super.dropNaturally(iblockdata, world, blockposition, itemstack);
public void dropNaturally(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
super.dropNaturally(iblockdata, worldserver, blockposition, itemstack);
+ /* CraftBukkit start - Delegated to getExpDrop
if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
int i = 1 + world.random.nextInt(5);
int i = 1 + worldserver.random.nextInt(5);
this.dropExperience(world, blockposition, i);
this.dropExperience(worldserver, blockposition, i);
}
+ // */
+
+ }
+ @Override
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
+ if (EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
+ int i = 1 + world.random.nextInt(5);
+ int i = 1 + worldserver.random.nextInt(5);
+
+ return i;
+ }

Datei anzeigen

@ -52,9 +52,9 @@
+ // CraftBukkit start
+ // TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? world.getTileEntity(blockposition2) : null;
- a(iblockdata, world, blockposition2, tileentity);
- a(iblockdata, (GeneratorAccess) world, blockposition2, tileentity);
- world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
+ // a(iblockdata, world, blockposition2, tileentity);
+ // a(iblockdata, (GeneratorAccess) world, blockposition2, tileentity);
+ blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3);
+ // CraftBukkit end
++i;

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/server/BlockVine.java
+++ b/net/minecraft/server/BlockVine.java
@@ -5,6 +5,8 @@
import java.util.Random;
@@ -8,6 +8,8 @@
import java.util.stream.Collectors;
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
@ -9,7 +9,7 @@
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockSprawling.e;
@@ -166,20 +168,24 @@
@@ -175,20 +177,24 @@
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
@ -39,7 +39,7 @@
}
} else if (a((IBlockAccess) worldserver, blockposition2, enumdirection)) {
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
@@ -209,7 +215,7 @@
@@ -218,7 +224,7 @@
}
if (this.canSpread(iblockdata2)) {
@ -48,7 +48,7 @@
}
return;
@@ -224,7 +230,7 @@
@@ -233,7 +239,7 @@
IBlockData iblockdata4 = this.a(iblockdata, iblockdata3, random);
if (iblockdata3 != iblockdata4 && this.canSpread(iblockdata4)) {

Datei anzeigen

@ -39,7 +39,7 @@
@@ -50,6 +58,15 @@
entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.aH = shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.aA = shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.beginSpawnSequence();
+ // CraftBukkit start
+ if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {

Datei anzeigen

@ -88,7 +88,7 @@
if (tileentity == null) {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition);
@@ -424,6 +449,13 @@
tileentity1.an_();
tileentity1.al_();
}
+ // CraftBukkit start

Datei anzeigen

@ -1,30 +1,34 @@
--- a/net/minecraft/server/ChunkGenerator.java
+++ b/net/minecraft/server/ChunkGenerator.java
@@ -214,6 +214,13 @@
@@ -210,7 +210,16 @@
while (iterator.hasNext()) {
StructureFeature<?, ?> structurefeature = (StructureFeature) iterator.next();
Supplier<StructureFeature<?, ?>> supplier = (Supplier) iterator.next();
- this.a((StructureFeature) supplier.get(), iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
+ // CraftBukkit start
+ if (structurefeature.b == StructureGenerator.STRONGHOLD) {
+ StructureFeature<?, ?> structurefeature = (StructureFeature) supplier.get();
+ if (structurefeature.c == StructureGenerator.STRONGHOLD) {
+ synchronized (structurefeature) {
+ this.a(structurefeature, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
+ this.a(structurefeature, iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
+ }
+ } else {
+ this.a(structurefeature, iregistrycustom, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
+ }
+ } else
+ // CraftBukkit end
this.a(structurefeature, structuremanager, ichunkaccess, definedstructuremanager, i, chunkcoordintpair, biomebase);
}
@@ -293,9 +300,11 @@
}
@@ -294,9 +303,11 @@
}
static {
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "noise", (Object) ChunkGeneratorAbstract.d);
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", (Object) ChunkProviderFlat.d);
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", (Object) ChunkProviderDebug.e);
- IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", (Object) ChunkProviderDebug.d);
+ // CraftBukkit start - decompile errors
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "noise", ChunkGeneratorAbstract.d);
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "flat", ChunkProviderFlat.d);
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", ChunkProviderDebug.e);
+ IRegistry.a(IRegistry.CHUNK_GENERATOR, "debug", ChunkProviderDebug.d);
+ // CraftBukkit end
a = IRegistry.CHUNK_GENERATOR.dispatchStable(ChunkGenerator::a, Function.identity());
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkGeneratorAbstract.java
+++ b/net/minecraft/server/ChunkGeneratorAbstract.java
@@ -23,7 +23,7 @@
@@ -24,7 +24,7 @@
return chunkgeneratorabstract.h;
})).apply(instance, instance.stable(ChunkGeneratorAbstract::new));
});
@ -9,7 +9,7 @@
for (int i = 0; i < 24; ++i) {
for (int j = 0; j < 24; ++j) {
for (int k = 0; k < 24; ++k) {
@@ -33,7 +33,7 @@
@@ -34,7 +34,7 @@
}
});
@ -18,7 +18,7 @@
for (int i = -2; i <= 2; ++i) {
for (int j = -2; j <= 2; ++j) {
float f = 10.0F / MathHelper.c((float) (i * i + j * j) + 0.2F);
@@ -190,6 +190,11 @@
@@ -193,6 +193,11 @@
f6 = f4;
f7 = f5;
}

Datei anzeigen

@ -6,7 +6,7 @@
if (!ichunkaccess.getChunkStatus().b(chunkstatus)) {
- if (worldserver.getMinecraftServer().getSaveData().getGeneratorSettings().shouldGenerateMapFeatures()) {
+ if (worldserver.worldDataServer.getGeneratorSettings().shouldGenerateMapFeatures()) { // CraftBukkit
chunkgenerator.createStructures(worldserver.getStructureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
chunkgenerator.createStructures(worldserver.r(), worldserver.getStructureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
}
@@ -90,7 +90,7 @@

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandDispatcher.java
+++ b/net/minecraft/server/CommandDispatcher.java
@@ -17,12 +17,21 @@
@@ -19,12 +19,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -22,7 +22,7 @@
CommandAdvancement.a(this.b);
CommandAttribute.a(this.b);
CommandExecute.a(this.b);
@@ -103,14 +112,57 @@
@@ -105,14 +114,57 @@
}
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
@ -83,7 +83,7 @@
StringReader stringreader = new StringReader(s);
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -137,7 +189,7 @@
@@ -139,7 +191,7 @@
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).format((chatmodifier) -> {
@ -92,7 +92,7 @@
});
if (j > 10) {
@@ -187,11 +239,36 @@
@@ -189,11 +241,36 @@
}
public void a(EntityPlayer entityplayer) {
@ -130,7 +130,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
}
@@ -202,7 +279,7 @@
@@ -204,7 +281,7 @@
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
if (commandnode2.canUse(commandlistenerwrapper)) {
@ -139,7 +139,7 @@
argumentbuilder.requires((icompletionprovider) -> {
return true;
@@ -225,7 +302,7 @@
@@ -227,7 +304,7 @@
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
}

Datei anzeigen

@ -16,7 +16,7 @@
public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) {
this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> {
@@ -121,9 +123,22 @@
@@ -128,9 +130,22 @@
@Override
public boolean hasPermission(int i) {
@ -39,7 +39,7 @@
public Vec3D getPosition() {
return this.d;
}
@@ -185,7 +200,7 @@
@@ -192,7 +207,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -48,9 +48,9 @@
entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.b);
}
}
@@ -240,4 +255,10 @@
public Set<ResourceKey<World>> p() {
return this.i.E();
@@ -252,4 +267,10 @@
public IRegistryCustom q() {
return this.i.aX();
}
+
+ // CraftBukkit start

Datei anzeigen

@ -6,7 +6,7 @@
+ // CraftBukkit start
+ public static void reload(MinecraftServer minecraftserver) {
+ ResourcePackRepository<?> resourcepackrepository = minecraftserver.getResourcePackRepository();
+ ResourcePackRepository resourcepackrepository = minecraftserver.getResourcePackRepository();
+ SaveData savedata = minecraftserver.getSaveData();
+ Collection<String> collection = resourcepackrepository.d();
+ Collection<String> collection1 = a(resourcepackrepository, savedata, collection);

Datei anzeigen

@ -6,5 +6,5 @@
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return (Boolean) this.containerAccess.a((world, blockposition) -> {
return !this.a(world.getType(blockposition)) ? false : entityhuman.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
return !this.a(world.getType(blockposition)) ? false : entityhuman.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
}, true);

Datei anzeigen

@ -28,9 +28,9 @@
+ }
+ // CraftBukkit end
private final ContainerAccess containerAccess;
private boolean e;
private long f;
@@ -27,6 +49,13 @@
private long e;
public final IInventory inventory;
@@ -26,6 +48,13 @@
ContainerCartography.this.a((IInventory) this);
super.update();
}
@ -44,7 +44,7 @@
};
this.containerAccess = containeraccess;
this.a(new Slot(this.inventory, 0, 15, 15) {
@@ -104,10 +133,12 @@
@@ -78,10 +107,12 @@
this.a(new Slot(playerinventory, j, 8 + j * 18, 142));
}

Datei anzeigen

@ -11,9 +11,9 @@
public abstract class ContainerFurnace extends ContainerRecipeBook<IInventory> {
private final IInventory furnace;
@@ -7,6 +12,22 @@
protected final World c;
@@ -8,6 +13,22 @@
private final Recipes<? extends RecipeCooking> f;
private final RecipeBookType g;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
@ -31,10 +31,10 @@
+ }
+ // CraftBukkit end
+
protected ContainerFurnace(Containers<?> containers, Recipes<? extends RecipeCooking> recipes, int i, PlayerInventory playerinventory) {
this(containers, recipes, i, playerinventory, new InventorySubcontainer(3), new ContainerProperties(4));
protected ContainerFurnace(Containers<?> containers, Recipes<? extends RecipeCooking> recipes, RecipeBookType recipebooktype, int i, PlayerInventory playerinventory) {
this(containers, recipes, recipebooktype, i, playerinventory, new InventorySubcontainer(3), new ContainerProperties(4));
}
@@ -22,6 +43,7 @@
@@ -24,6 +45,7 @@
this.a(new Slot(iinventory, 0, 56, 17));
this.a((Slot) (new SlotFurnaceFuel(this, iinventory, 1, 56, 53)));
this.a((Slot) (new SlotFurnaceResult(playerinventory.player, iinventory, 2, 116, 35)));
@ -42,7 +42,7 @@
int j;
@@ -53,7 +75,7 @@
@@ -55,7 +77,7 @@
@Override
public void a(boolean flag, IRecipe<?> irecipe, EntityPlayer entityplayer) {
@ -51,7 +51,7 @@
}
@Override
@@ -78,6 +100,7 @@
@@ -80,6 +102,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
@ -59,7 +59,7 @@
return this.furnace.a(entityhuman);
}
@@ -133,7 +156,7 @@
@@ -135,7 +158,7 @@
}
protected boolean a(ItemStack itemstack) {

Datei anzeigen

@ -18,7 +18,7 @@
public ContainerSmithing(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -52,12 +57,12 @@
@@ -54,13 +59,13 @@
List<RecipeSmithing> list = this.g.getCraftingManager().b(Recipes.SMITHING, this.repairInventory, this.g);
if (list.isEmpty()) {
@ -28,14 +28,15 @@
this.h = (RecipeSmithing) list.get(0);
ItemStack itemstack = this.h.a(this.repairInventory);
this.resultInventory.a((IRecipe) this.h);
- this.resultInventory.setItem(0, itemstack);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); // CraftBukkit
}
}
@@ -68,4 +73,18 @@
return recipesmithing.a(itemstack);
});
@@ -76,4 +81,18 @@
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}
+
+ // CraftBukkit start

Datei anzeigen

@ -34,7 +34,7 @@
public ContainerStonecutter(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -81,10 +101,12 @@
@@ -82,10 +102,12 @@
}
this.a(this.containerProperty);

Datei anzeigen

@ -1,6 +1,31 @@
--- a/net/minecraft/server/Convertable.java
+++ b/net/minecraft/server/Convertable.java
@@ -175,8 +175,10 @@
@@ -73,21 +73,21 @@
Logger logger1 = Convertable.LOGGER;
logger1.getClass();
- IRegistry<DimensionManager> iregistry = (IRegistry) dataresult1.resultOrPartial(SystemUtils.a("Dimension type registry: ", logger1::error)).orElseThrow(() -> {
+ IRegistry<DimensionManager> iregistry = (IRegistry) ((DataResult<IRegistry<DimensionManager>>) dataresult1).resultOrPartial(SystemUtils.a("Dimension type registry: ", logger1::error)).orElseThrow(() -> { // CraftBukkit - decompile error
return new IllegalStateException("Failed to get dimension registry");
});
dataresult1 = RegistryLookupCodec.a(IRegistry.ay).codec().parse(dynamic2);
logger1 = Convertable.LOGGER;
logger1.getClass();
- IRegistry<BiomeBase> iregistry1 = (IRegistry) dataresult1.resultOrPartial(SystemUtils.a("Biome registry: ", logger1::error)).orElseThrow(() -> {
+ IRegistry<BiomeBase> iregistry1 = (IRegistry) ((DataResult<IRegistry<BiomeBase>>) dataresult1).resultOrPartial(SystemUtils.a("Biome registry: ", logger1::error)).orElseThrow(() -> { // CraftBukkit - decompile error
return new IllegalStateException("Failed to get biome registry");
});
dataresult1 = RegistryLookupCodec.a(IRegistry.ar).codec().parse(dynamic2);
logger1 = Convertable.LOGGER;
logger1.getClass();
- IRegistry<GeneratorSettingBase> iregistry2 = (IRegistry) dataresult1.resultOrPartial(SystemUtils.a("Noise settings registry: ", logger1::error)).orElseThrow(() -> {
+ IRegistry<GeneratorSettingBase> iregistry2 = (IRegistry) ((DataResult<IRegistry<GeneratorSettingBase>>) dataresult1).resultOrPartial(SystemUtils.a("Noise settings registry: ", logger1::error)).orElseThrow(() -> { // CraftBukkit - decompile error
return new IllegalStateException("Failed to get noise settings registry");
});
@@ -195,8 +195,10 @@
};
}
@ -13,7 +38,7 @@
}
public class ConversionSession implements AutoCloseable {
@@ -185,8 +187,12 @@
@@ -205,8 +207,12 @@
public final java.nio.file.Path folder;
private final String levelName;
private final Map<SavedFile, java.nio.file.Path> e = Maps.newHashMap();
@ -27,7 +52,7 @@
this.levelName = s;
this.folder = Convertable.this.universe.resolve(s);
this.lock = SessionLock.a(this.folder);
@@ -203,9 +209,23 @@
@@ -223,9 +229,23 @@
}
public File a(ResourceKey<World> resourcekey) {

Datei anzeigen

@ -88,7 +88,7 @@
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> c(Recipes<T> recipes, C c0, World world) {
@@ -102,7 +127,7 @@
public Optional<? extends IRecipe<?>> a(MinecraftKey minecraftkey) {
public Optional<? extends IRecipe<?>> getRecipe(MinecraftKey minecraftkey) {
return this.recipes.values().stream().map((map) -> {
- return (IRecipe) map.get(minecraftkey);
+ return map.get(minecraftkey); // CraftBukkit - decompile error

Datei anzeigen

@ -22,10 +22,10 @@
@Nullable
private ServerGUI q;
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository<ResourcePackLoader> resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ // CraftBukkit start - Signature changed
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository<ResourcePackLoader> resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ super(options, datapackconfiguration, thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ // CraftBukkit end
this.propertyManager = dedicatedserversettings;
@ -147,15 +147,15 @@
long j = SystemUtils.getMonotonicNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@@ -151,6 +222,7 @@
@@ -149,6 +220,7 @@
if (dedicatedserverproperties.enableRcon) {
DedicatedServer.LOGGER.info("Starting remote control listener");
this.remoteControlListener = new RemoteControlListener(this);
this.remoteControlListener.a();
this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this);
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.remoteControlCommandListener); // CraftBukkit
}
if (this.getMaxTickTime() > 0L) {
@@ -261,6 +333,7 @@
@@ -259,6 +331,7 @@
this.remoteStatusListener.b();
}
@ -163,7 +163,7 @@
}
@Override
@@ -289,7 +362,15 @@
@@ -287,7 +360,15 @@
while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
@ -180,7 +180,7 @@
}
}
@@ -494,14 +575,45 @@
@@ -497,14 +578,45 @@
@Override
public String getPlugins() {
@ -228,7 +228,7 @@
});
return this.remoteControlCommandListener.getMessages();
}
@@ -537,4 +649,15 @@
@@ -540,4 +652,15 @@
public boolean isSyncChunkWrites() {
return this.propertyManager.getProperties().syncChunkWrites;
}

Datei anzeigen

@ -12,35 +12,35 @@
public final boolean onlineMode = this.getBoolean("online-mode", true);
public final boolean preventProxyConnections = this.getBoolean("prevent-proxy-connections", false);
public final String serverIp = this.getString("server-ip", "");
@@ -53,8 +55,10 @@
@@ -54,8 +56,10 @@
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
public final GeneratorSettings generatorSettings;
- public DedicatedServerProperties(Properties properties) {
- public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom) {
- super(properties);
+ // CraftBukkit start
+ public DedicatedServerProperties(Properties properties, OptionSet optionset) {
+ public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom, OptionSet optionset) {
+ super(properties, optionset);
+ // CraftBukkit end
this.difficulty = (EnumDifficulty) this.a("difficulty", a(EnumDifficulty::getById, EnumDifficulty::a), EnumDifficulty::c, EnumDifficulty.EASY);
this.gamemode = (EnumGamemode) this.a("gamemode", a(EnumGamemode::getById, EnumGamemode::a), EnumGamemode::b, EnumGamemode.SURVIVAL);
this.levelName = this.getString("level-name", "world");
@@ -103,12 +107,14 @@
this.generatorSettings = GeneratorSettings.a(properties);
@@ -105,12 +109,14 @@
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
}
- public static DedicatedServerProperties load(java.nio.file.Path java_nio_file_path) {
- return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path));
- public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path) {
- return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path), iregistrycustom);
+ // CraftBukkit start
+ public static DedicatedServerProperties load(java.nio.file.Path java_nio_file_path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path), optionset);
+ public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path), iregistrycustom, optionset);
}
@Override
- protected DedicatedServerProperties reload(Properties properties) {
- return new DedicatedServerProperties(properties);
+ protected DedicatedServerProperties reload(Properties properties, OptionSet optionset) {
+ return new DedicatedServerProperties(properties, optionset);
- protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties) {
- return new DedicatedServerProperties(properties, iregistrycustom);
+ protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties, OptionSet optionset) {
+ return new DedicatedServerProperties(properties, iregistrycustom, optionset);
+ // CraftBukkit end
}
}

Datei anzeigen

@ -14,13 +14,13 @@
private final java.nio.file.Path path;
private DedicatedServerProperties properties;
- public DedicatedServerSettings(java.nio.file.Path java_nio_file_path) {
- public DedicatedServerSettings(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path) {
- this.path = java_nio_file_path;
- this.properties = DedicatedServerProperties.load(java_nio_file_path);
- this.properties = DedicatedServerProperties.load(iregistrycustom, java_nio_file_path);
+ // CraftBukkit start
+ public DedicatedServerSettings(OptionSet optionset) {
+ public DedicatedServerSettings(IRegistryCustom iregistrycustom, OptionSet optionset) {
+ this.path = ((File) optionset.valueOf("config")).toPath();
+ this.properties = DedicatedServerProperties.load(path, optionset);
+ this.properties = DedicatedServerProperties.load(iregistrycustom, path, optionset);
+ // CraftBukkit end
}

Datei anzeigen

@ -21,11 +21,11 @@
@@ -430,11 +430,13 @@
}
private static Optional<Entity> a(GeneratorAccess generatoraccess, NBTTagCompound nbttagcompound) {
private static Optional<Entity> a(WorldAccess worldaccess, NBTTagCompound nbttagcompound) {
- try {
+ // CraftBukkit start
+ // try {
return EntityTypes.a(nbttagcompound, generatoraccess.getMinecraftWorld());
return EntityTypes.a(nbttagcompound, (World) worldaccess.getMinecraftWorld());
- } catch (Exception exception) {
- return Optional.empty();
- }

Datei anzeigen

@ -15,16 +15,16 @@
d3 = 0.0D;
}
- EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
+ // EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
- EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
+ // EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
+ // CraftBukkit start
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
+ if (!BlockDispenser.eventFired) {
+ world.getServer().getPluginManager().callEvent(event);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -43,14 +43,14 @@
+ }
+ }
+
+ EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+ EntityBoat entityboat = new EntityBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+ // CraftBukkit end
entityboat.setType(this.c);
entityboat.yaw = enumdirection.o();
- world.addEntity(entityboat);
- worldserver.addEntity(entityboat);
- itemstack.subtract(1);
+ if (!world.addEntity(entityboat)) itemstack.add(1); // CraftBukkit
+ if (!worldserver.addEntity(entityboat)) itemstack.add(1); // CraftBukkit
+ // itemstack.subtract(1); // CraftBukkit - handled during event processing
return itemstack;
}

Datei anzeigen

@ -13,18 +13,18 @@
public DispenseBehaviorProjectile() {}
@@ -11,9 +16,38 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
IProjectile iprojectile = this.a(world, iposition, itemstack);
IProjectile iprojectile = this.a((World) worldserver, iposition, itemstack);
- iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a());
+ // iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a());
+ // CraftBukkit start
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ()));
+ if (!BlockDispenser.eventFired) {
+ world.getServer().getPluginManager().callEvent(event);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -46,7 +46,7 @@
+ iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.getPower(), this.a());
+ ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
+ // CraftBukkit end
world.addEntity(iprojectile);
worldserver.addEntity(iprojectile);
- itemstack.subtract(1);
+ // itemstack.subtract(1); // CraftBukkit - Handled during event processing
return itemstack;

Datei anzeigen

@ -15,14 +15,14 @@
@@ -10,11 +15,34 @@
@Override
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.getWorld();
WorldServer worldserver = isourceblock.getWorld();
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
+
+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
+ if (!BlockDispenser.eventFired) {
+ world.getServer().getPluginManager().callEvent(event);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ }
+
+ if (event.isCancelled()) {
@ -40,12 +40,12 @@
+ }
+ // CraftBukkit end
if (!world.s_()) {
if (!worldserver.s_()) {
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
- this.a(a((WorldServer) world, blockposition) || b((WorldServer) world, blockposition));
+ this.a(a((WorldServer) world, blockposition) || b((WorldServer) world, blockposition, bukkitBlock, craftItem)); // CraftBukkit
if (this.a() && itemstack.isDamaged(1, world.getRandom(), (EntityPlayer) null)) {
- this.a(a((WorldServer) worldserver, blockposition) || b((WorldServer) worldserver, blockposition));
+ this.a(a((WorldServer) worldserver, blockposition) || b((WorldServer) worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
if (this.a() && itemstack.isDamaged(1, worldserver.getRandom(), (EntityPlayer) null)) {
itemstack.setCount(0);
}
@@ -40,7 +68,7 @@

Datei anzeigen

@ -17,8 +17,8 @@
public class DispenserRegistry {
public static final PrintStream a = System.out;
@@ -30,6 +40,69 @@
ArgumentRegistry.a();
@@ -31,6 +41,69 @@
TagStatic.b();
d();
}
+ // CraftBukkit start - easier than fixing the decompile

Datei anzeigen

@ -1,33 +0,0 @@
--- a/net/minecraft/server/EnderDragonBattle.java
+++ b/net/minecraft/server/EnderDragonBattle.java
@@ -245,7 +245,7 @@
}
@Nullable
- private ShapeDetector.ShapeDetectorCollection j() {
+ public ShapeDetector.ShapeDetectorCollection j() { // PAIL private -> public, rename getExitPortalShape()
int i;
int j;
@@ -376,10 +376,10 @@
private void a(BlockPosition blockposition) {
this.world.triggerEffect(3000, blockposition, 0);
- WorldGenerator.END_GATEWAY.b((WorldGenFeatureConfiguration) WorldGenEndGatewayConfiguration.a()).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), blockposition);
+ WorldGenerator.END_GATEWAY.b(WorldGenEndGatewayConfiguration.a()).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), blockposition); // CraftBukkit - decompile error
}
- private void a(boolean flag) {
+ public void a(boolean flag) { // PAIL private -> public, rename generateExitPortal()
WorldGenEndTrophy worldgenendtrophy = new WorldGenEndTrophy(flag);
if (this.exitPortalLocation == null) {
@@ -388,7 +388,7 @@
}
}
- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.k).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation);
+ worldgenendtrophy.b(WorldGenFeatureConfiguration.k).a(this.world, this.world.getStructureManager(), this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); // CraftBukkit - decompile error
}
private EntityEnderDragon o() {

Datei anzeigen

@ -57,8 +57,8 @@
protected static final Logger LOGGER = LogManager.getLogger();
private static final AtomicInteger entityCount = new AtomicInteger();
private static final List<ItemStack> c = Collections.emptyList();
@@ -111,6 +159,20 @@
private long aG;
@@ -106,6 +154,20 @@
private long aB;
private EntitySize size;
private float headHeight;
+ // CraftBukkit start
@ -78,7 +78,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.entityCount.incrementAndGet();
@@ -214,6 +276,12 @@
@@ -212,6 +274,12 @@
}
public void setPose(EntityPose entitypose) {
@ -91,7 +91,7 @@
this.datawatcher.set(Entity.POSE, entitypose);
}
@@ -230,6 +298,33 @@
@@ -228,6 +296,33 @@
}
protected void setYawPitch(float f, float f1) {
@ -125,15 +125,15 @@
this.yaw = f % 360.0F;
this.pitch = f1 % 360.0F;
}
@@ -240,6 +335,7 @@
float f1 = this.size.height;
this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f));
@@ -235,6 +330,7 @@
public void setPosition(double d0, double d1, double d2) {
this.setPositionRaw(d0, d1, d2);
this.a(this.size.a(d0, d1, d2));
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
}
protected void ac() {
@@ -254,6 +350,15 @@
protected void ae() {
@@ -249,6 +345,15 @@
this.entityBaseTick();
}
@ -149,16 +149,16 @@
public void entityBaseTick() {
this.world.getMethodProfiler().enter("entityBaseTick");
if (this.isPassenger() && this.getVehicle().dead) {
@@ -267,7 +372,7 @@
@@ -262,7 +367,7 @@
this.z = this.A;
this.lastPitch = this.pitch;
this.lastYaw = this.yaw;
- this.doPortalTick();
+ if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick
if (this.aK()) {
this.aL();
if (this.aN()) {
this.aO();
}
@@ -322,12 +427,44 @@
@@ -325,12 +430,44 @@
protected void burnFromLava() {
if (!this.isFireProof()) {
@ -204,7 +204,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -424,6 +561,28 @@
@@ -427,6 +564,28 @@
block.a((IBlockAccess) this.world, this);
}
@ -230,10 +230,10 @@
+ }
+ // CraftBukkit end
+
if (this.onGround && !this.br()) {
if (this.onGround && !this.bu()) {
block.stepOn(this.world, blockposition, this);
}
@@ -698,6 +857,7 @@
@@ -700,6 +859,7 @@
AxisAlignedBB axisalignedbb = this.getBoundingBox();
this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D);
@ -241,7 +241,7 @@
}
protected SoundEffect getSoundSwim() {
@@ -1036,6 +1196,13 @@
@@ -1025,6 +1185,13 @@
}
public void spawnIn(World world) {
@ -255,15 +255,15 @@
this.world = world;
}
@@ -1051,6 +1218,7 @@
this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
@@ -1044,6 +1211,7 @@
this.lastY = d1;
this.lastZ = d4;
this.setPosition(d3, d1, d4);
+ world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit
}
public void c(Vec3D vec3d) {
@@ -1225,6 +1393,12 @@
public void d(Vec3D vec3d) {
@@ -1218,6 +1386,12 @@
return false;
}
@ -276,7 +276,7 @@
public void a(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
@@ -1235,7 +1409,7 @@
@@ -1228,7 +1402,7 @@
public boolean a_(NBTTagCompound nbttagcompound) {
String s = this.getSaveID();
@ -285,7 +285,7 @@
nbttagcompound.setString("id", s);
this.save(nbttagcompound);
return true;
@@ -1259,6 +1433,18 @@
@@ -1252,6 +1426,18 @@
Vec3D vec3d = this.getMot();
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
@ -304,7 +304,7 @@
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1267,6 +1453,12 @@
@@ -1260,6 +1446,12 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@ -317,7 +317,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1324,6 +1516,11 @@
@@ -1317,6 +1509,11 @@
}
}
@ -329,7 +329,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
@@ -1401,6 +1598,43 @@
@@ -1394,6 +1591,43 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@ -373,7 +373,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1476,9 +1710,22 @@
@@ -1469,9 +1703,22 @@
} else if (this.world.isClientSide) {
return null;
} else {
@ -396,7 +396,7 @@
this.world.addEntity(entityitem);
return entityitem;
}
@@ -1559,7 +1806,7 @@
@@ -1555,7 +1802,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@ -405,7 +405,7 @@
return true;
}
}
@@ -1584,7 +1831,7 @@
@@ -1580,7 +1827,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@ -414,8 +414,8 @@
}
}
@@ -1593,10 +1840,31 @@
this.bb();
@@ -1589,10 +1836,31 @@
this.be();
}
- protected void addPassenger(Entity entity) {
@ -447,7 +447,7 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1604,15 +1872,36 @@
@@ -1600,15 +1868,36 @@
}
}
@ -485,7 +485,7 @@
}
protected boolean q(Entity entity) {
@@ -1661,11 +1950,17 @@
@@ -1649,11 +1938,17 @@
ResourceKey<World> resourcekey = this.world.getDimensionKey() == World.THE_NETHER ? World.OVERWORLD : World.THE_NETHER;
WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey);
@ -493,19 +493,19 @@
+ if (true && !this.isPassenger() && this.portalTicks++ >= i) { // CraftBukkit
this.world.getMethodProfiler().enter("portal");
this.portalTicks = i;
this.portalCooldown = this.getDefaultPortalCooldown();
- this.a(worldserver1);
this.resetPortalCooldown();
- this.b(worldserver1);
+ // CraftBukkit start
+ if (this instanceof EntityPlayer) {
+ ((EntityPlayer) this).a(worldserver1, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
+ ((EntityPlayer) this).b(worldserver1, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
+ } else {
+ this.a(worldserver1);
+ this.b(worldserver1);
+ }
+ // CraftBukkit end
this.world.getMethodProfiler().exit();
}
@@ -1765,6 +2060,13 @@
@@ -1753,6 +2048,13 @@
}
public void setSwimming(boolean flag) {
@ -519,7 +519,7 @@
this.setFlag(4, flag);
}
@@ -1825,16 +2127,56 @@
@@ -1813,16 +2115,56 @@
}
public void setAirTicks(int i) {
@ -537,7 +537,7 @@
+ // CraftBukkit end
}
public void onLightningStrike(EntityLightning entitylightning) {
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
this.setFireTicks(this.fireTicks + 1);
+ // CraftBukkit start
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
@ -579,10 +579,10 @@
}
public void k(boolean flag) {
@@ -1986,18 +2328,45 @@
@@ -1972,15 +2314,32 @@
@Nullable
public Entity a(WorldServer worldserver) {
public Entity b(WorldServer worldserver) {
+ // CraftBukkit start
+ return teleportTo(worldserver, null);
+ }
@ -595,93 +595,129 @@
- this.decouple();
+ // CraftBukkit start
+ // this.decouple();
+ if (worldserver == null){
+ if (worldserver == null) {
+ return null;
+ }
+ // CraftBukkit end
this.world.getMethodProfiler().enter("reposition");
Vec3D vec3d = this.getMot();
float f = 0.0F;
- BlockPosition blockposition;
+ BlockPosition blockposition = location; // CraftBukkit
- ShapeDetectorShape shapedetectorshape = this.a(worldserver);
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.a(worldserver) : new ShapeDetectorShape(new Vec3D(location.getX(), location.getY(), location.getZ()), Vec3D.a, this.yaw, this.pitch, worldserver); // CraftBukkit
- if (this.world.getDimensionKey() == World.THE_END && worldserver.getDimensionKey() == World.OVERWORLD) {
- blockposition = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
- } else if (worldserver.getDimensionKey() == World.THE_END) {
- blockposition = WorldServer.a;
+ if (blockposition == null) { // CraftBukkit
+ if (this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD) { // CraftBukkit
+ // CraftBukkit start
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn()), 0);
+ if (event == null) {
+ return null;
+ }
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
+ blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
+ // CraftBukkit end
+ } else if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
+ // CraftBukkit start
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, WorldServer.a, 0);
+ if (event == null) {
+ return null;
+ }
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
+ blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
+ // CraftBukkit end
} else {
double d0 = this.locX();
double d1 = this.locZ();
@@ -2023,7 +2392,16 @@
Vec3D vec3d1 = this.getPortalOffset();
blockposition = new BlockPosition(d0, this.locY(), d1);
- ShapeDetector.Shape shapedetector_shape = worldserver.getTravelAgent().a(blockposition, vec3d, this.getPortalDirection(), vec3d1.x, vec3d1.y, this instanceof EntityHuman);
+ // CraftBukkit start
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128);
+ if (event == null) {
+ return null;
+ }
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
+ blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
+ int searchRadius = event.getSearchRadius();
+ // CraftBukkit end
+ ShapeDetector.Shape shapedetector_shape = worldserver.getTravelAgent().findPortal(blockposition, vec3d, this.getPortalDirection(), vec3d1.x, vec3d1.y, this instanceof EntityHuman, searchRadius); // CraftBukkit - search radius
if (shapedetector_shape == null) {
if (shapedetectorshape == null) {
return null;
@@ -2033,6 +2411,11 @@
vec3d = shapedetector_shape.velocity;
f = (float) shapedetector_shape.yaw;
}
+ } // CraftBukkit
+
} else {
+ // CraftBukkit start
+ worldserver = shapedetectorshape.world;
+ this.decouple();
+ // CraftBukkit end
+
this.world.getMethodProfiler().exitEnter("reloading");
Entity entity = this.getEntityType().a((World) worldserver);
@@ -2042,9 +2425,17 @@
entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch);
entity.setMot(vec3d);
@@ -1989,9 +2348,17 @@
entity.setPositionRotation(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, entity.pitch);
entity.setMot(shapedetectorshape.velocity);
worldserver.addEntityTeleport(entity);
- if (worldserver.getDimensionKey() == World.THE_END) {
- WorldServer.a(worldserver);
+ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
+ WorldServer.a(worldserver, this); // CraftBukkit
+ }
}
+ // CraftBukkit start - Forward the CraftEntity to the new entity
+ this.getBukkitEntity().setHandle(entity);
+ entity.bukkitEntity = this.getBukkitEntity();
+
+ if (this instanceof EntityInsentient) {
+ ((EntityInsentient)this).unleash(true, false); // Unleash to prevent duping of leads.
}
+ ((EntityInsentient) this).unleash(true, false); // Unleash to prevent duping of leads.
+ }
+ // CraftBukkit end
}
this.bJ();
@@ -2253,7 +2644,26 @@
this.bM();
@@ -2012,13 +2379,18 @@
@Nullable
protected ShapeDetectorShape a(WorldServer worldserver) {
- boolean flag = this.world.getDimensionKey() == World.THE_END && worldserver.getDimensionKey() == World.OVERWORLD;
- boolean flag1 = worldserver.getDimensionKey() == World.THE_END;
+ // CraftBukkit start
+ if (worldserver == null) {
+ return null;
+ }
+ boolean flag = this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD;
+ boolean flag1 = worldserver.getTypeKey() == DimensionManager.THE_END;
+ // CraftBukkit end
if (!flag && !flag1) {
- boolean flag2 = worldserver.getDimensionKey() == World.THE_NETHER;
+ boolean flag2 = worldserver.getTypeKey() == DimensionManager.THE_NETHER; // CraftBukkit
- if (this.world.getDimensionKey() != World.THE_NETHER && !flag2) {
+ if (this.world.getTypeKey() != DimensionManager.THE_NETHER && !flag2) {
return null;
} else {
WorldBorder worldborder = worldserver.getWorldBorder();
@@ -2028,8 +2400,17 @@
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
+ // CraftBukkit start
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128);
+ if (event == null) {
+ return null;
+ }
+ final WorldServer worldserverFinal = worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
+ blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
+ int searchRadius = event.getSearchRadius();
+ // CraftBukkit end
- return (ShapeDetectorShape) this.a(worldserver, blockposition, flag2).map((blockutil_rectangle) -> {
+ return (ShapeDetectorShape) this.a(worldserver, blockposition, flag2, searchRadius).map((blockutil_rectangle) -> {
IBlockData iblockdata = this.world.getType(this.ac);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2046,8 +2427,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
- return BlockPortalShape.a(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch);
- }).orElse((Object) null);
+ return BlockPortalShape.a(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch); // CraftBukkit
+ }).orElse(null); // CraftBuukkit - decompile error
}
} else {
BlockPosition blockposition1;
@@ -2057,8 +2438,15 @@
} else {
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
}
+ // CraftBukkit start
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition1, 0);
+ if (event == null) {
+ return null;
+ }
+ blockposition1 = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch);
+ return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch, ((CraftWorld) event.getTo().getWorld()).getHandle());
+ // CraftBukkit end
}
}
@@ -2066,8 +2454,10 @@
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
}
- protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag) {
- return worldserver.getTravelAgent().findPortal(blockposition, flag);
+ // CraftBukkit start
+ protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag, int radius) {
+ return worldserver.getTravelAgent().findPortal(blockposition, radius);
+ // CraftBukkit end
}
public boolean canPortal() {
@@ -2253,7 +2643,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {

Datei anzeigen

@ -55,7 +55,7 @@
this.world.broadcastEntityEffect(this, (byte) 18);
}
@@ -186,11 +202,24 @@
EntityAgeable entityageable = this.createChild(entityanimal);
EntityAgeable entityageable = this.createChild(worldserver, entityanimal);
if (entityageable != null) {
+ // CraftBukkit start - set persistence for tame animals
@ -81,16 +81,16 @@
entityplayer.a(StatisticList.ANIMALS_BRED);
@@ -203,10 +232,14 @@
entityanimal.resetLove();
entityageable.a(true);
entityageable.setBaby(true);
entityageable.setPositionRotation(this.locX(), this.locY(), this.locZ(), 0.0F, 0.0F);
- world.addEntity(entityageable);
+ world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
world.broadcastEntityEffect(this, (byte) 18);
if (world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
- world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), this.getRandom().nextInt(7) + 1));
- worldserver.addAllEntities(entityageable);
+ worldserver.addAllEntities(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
worldserver.broadcastEntityEffect(this, (byte) 18);
if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), this.getRandom().nextInt(7) + 1));
+ // CraftBukkit start - use event experience
+ if (experience > 0) {
+ world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience));
+ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience));
+ }
+ // CraftBukkit end
}

Datei anzeigen

@ -15,8 +15,8 @@
+
public class EntityArmorStand extends EntityLiving {
private static final Vector3f bq = new Vector3f(0.0F, 0.0F, 0.0F);
@@ -53,6 +62,13 @@
private static final Vector3f bj = new Vector3f(0.0F, 0.0F, 0.0F);
@@ -55,6 +64,13 @@
this.setPosition(d0, d1, d2);
}
@ -30,7 +30,7 @@
@Override
public void updateSize() {
double d0 = this.locX();
@@ -381,6 +397,21 @@
@@ -383,6 +399,21 @@
return false;
} else {
ItemStack itemstack2;
@ -52,7 +52,7 @@
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.cloneItemStack();
@@ -409,12 +440,22 @@
@@ -411,12 +442,22 @@
public boolean damageEntity(DamageSource damagesource, float f) {
if (!this.world.isClientSide && !this.dead) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
@ -78,7 +78,7 @@
return false;
} else if (DamageSource.FIRE.equals(damagesource)) {
if (this.isBurning()) {
@@ -439,7 +480,7 @@
@@ -441,7 +482,7 @@
} else if (damagesource.v()) {
this.F();
this.D();
@ -87,7 +87,7 @@
return flag1;
} else {
long i = this.world.getTime();
@@ -450,7 +491,7 @@
@@ -452,7 +493,7 @@
} else {
this.f(damagesource);
this.D();
@ -96,7 +96,7 @@
}
return true;
@@ -477,7 +518,7 @@
@@ -479,7 +520,7 @@
f1 -= f;
if (f1 <= 0.5F) {
this.g(damagesource);
@ -105,7 +105,7 @@
} else {
this.setHealth(f1);
}
@@ -485,13 +526,13 @@
@@ -487,13 +528,13 @@
}
private void f(DamageSource damagesource) {
@ -121,7 +121,7 @@
ItemStack itemstack;
int i;
@@ -499,7 +540,7 @@
@@ -501,7 +542,7 @@
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@ -130,7 +130,7 @@
this.handItems.set(i, ItemStack.b);
}
}
@@ -507,10 +548,11 @@
@@ -509,10 +550,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@ -143,7 +143,7 @@
}
@@ -611,8 +653,16 @@
@@ -613,8 +655,16 @@
return this.isSmall();
}

Datei anzeigen

@ -39,7 +39,7 @@
} else {
if (this.d != null && (!this.world.isEmpty(this.d) || this.d.getY() < 1)) {
@@ -138,7 +147,11 @@
this.ba = 0.5F;
this.aT = 0.5F;
this.yaw += f1;
if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).isOccluding(this.world, blockposition1)) {
- this.setAsleep(true);

Datei anzeigen

@ -18,7 +18,7 @@
+ boolean result = super.damageEntity(damagesource, f);
+
+ if (result && !this.world.isClientSide) {
this.bJ.l();
this.bC.l();
}
- return super.damageEntity(damagesource, f);
@ -53,7 +53,7 @@
+ if (flag && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1)).isCancelled()) { // Spigot
EntityBee.this.world.triggerEffect(2005, blockposition, 0);
EntityBee.this.world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1));
EntityBee.this.fj();
EntityBee.this.fi();
@@ -661,7 +665,7 @@
class i extends EntityBee.a {

Datei anzeigen

@ -17,8 +17,8 @@
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityBoat.class, DataWatcherRegistry.b);
@@ -38,6 +47,14 @@
private float aK;
private float aL;
private float aD;
private float aE;
+ // CraftBukkit start
+ // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable.
@ -30,8 +30,8 @@
+
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.ao = new float[2];
@@ -101,6 +118,19 @@
this.ah = new float[2];
@@ -108,6 +125,19 @@
if (this.isInvulnerable(damagesource)) {
return false;
} else if (!this.world.isClientSide && !this.dead) {
@ -51,7 +51,7 @@
this.c(-this.o());
this.b(10);
this.setDamage(this.getDamage() + f * 10.0F);
@@ -108,6 +138,15 @@
@@ -115,6 +145,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40.0F) {
@ -67,7 +67,7 @@
if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
this.a((IMaterial) this.g());
}
@@ -142,9 +181,29 @@
@@ -149,9 +188,29 @@
public void collide(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@ -97,15 +97,15 @@
super.collide(entity);
}
@@ -178,6 +237,7 @@
@@ -185,6 +244,7 @@
return this.getDirection().g();
}
+ private Location lastLocation; // CraftBukkit
@Override
public void tick() {
this.aF = this.aE;
@@ -218,6 +278,22 @@
this.ay = this.ax;
@@ -225,6 +285,22 @@
this.setMot(Vec3D.a);
}

Datei anzeigen

@ -1,11 +1,11 @@
--- a/net/minecraft/server/EntityCat.java
+++ b/net/minecraft/server/EntityCat.java
@@ -15,7 +15,7 @@
private static final DataWatcherObject<Boolean> bA = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> bB = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Integer> bC = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
- public static final Map<Integer, MinecraftKey> bx = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ public static final Map<Integer, MinecraftKey> bx = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
private static final DataWatcherObject<Boolean> bt = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> bu = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Integer> bv = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
- public static final Map<Integer, MinecraftKey> bq = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ public static final Map<Integer, MinecraftKey> bq = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
hashmap.put(0, new MinecraftKey("textures/entity/cat/tabby.png"));
hashmap.put(1, new MinecraftKey("textures/entity/cat/black.png"));
hashmap.put(2, new MinecraftKey("textures/entity/cat/red.png"));

Datei anzeigen

@ -10,10 +10,10 @@
+ }
+ // CraftBukkit end
super.movementTick();
this.by = this.bv;
this.bx = this.bw;
this.br = this.bo;
this.bq = this.bp;
@@ -59,7 +64,9 @@
this.bv += this.bz * 2.0F;
this.bo += this.bs * 2.0F;
if (!this.world.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggLayTime <= 0) {
this.playSound(SoundEffects.ENTITY_CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.forceDrops = true; // CraftBukkit

Datei anzeigen

@ -20,7 +20,7 @@
@@ -42,6 +47,7 @@
this.t(f);
this.x(f);
if (f > 10.0F) {
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);

Datei anzeigen

@ -14,8 +14,8 @@
@@ -165,9 +170,19 @@
@Override
public void onLightningStrike(EntityLightning entitylightning) {
super.onLightningStrike(entitylightning);
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
super.onLightningStrike(worldserver, entitylightning);
- this.datawatcher.set(EntityCreeper.POWERED, true);
+ // CraftBukkit start
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityDolphin.java
+++ b/net/minecraft/server/EntityDolphin.java
@@ -107,7 +107,7 @@
@@ -109,7 +109,7 @@
this.goalSelector.a(8, new EntityDolphin.d());
this.goalSelector.a(8, new PathfinderGoalFollowBoat(this));
this.goalSelector.a(9, new PathfinderGoalAvoidTarget<>(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D));
@ -8,8 +8,8 @@
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a(new Class[0])); // CraftBukkit - decompile error
}
public static AttributeProvider.Builder eN() {
@@ -174,6 +174,11 @@
public static AttributeProvider.Builder eM() {
@@ -176,6 +176,11 @@
ItemStack itemstack = entityitem.getItemStack();
if (this.canPickup(itemstack)) {
@ -21,7 +21,7 @@
this.a(entityitem);
this.setSlot(EnumItemSlot.MAINHAND, itemstack);
this.dropChanceHand[EnumItemSlot.MAINHAND.b()] = 2.0F;
@@ -315,7 +320,7 @@
@@ -323,7 +328,7 @@
@Override
public boolean a() {
@ -30,7 +30,7 @@
}
@Override
@@ -424,7 +429,7 @@
@@ -432,7 +437,7 @@
@Override
public void c() {
@ -39,7 +39,7 @@
}
@Override
@@ -443,7 +448,7 @@
@@ -451,7 +456,7 @@
}
if (this.c.isSwimming() && this.c.world.random.nextInt(6) == 0) {

Datei anzeigen

@ -15,9 +15,9 @@
private static final Logger LOGGER = LogManager.getLogger();
@@ -38,6 +44,7 @@
private final PathPoint[] bQ = new PathPoint[24];
private final int[] bR = new int[24];
private final Path bS = new Path();
private final PathPoint[] bJ = new PathPoint[24];
private final int[] bK = new int[24];
private final Path bL = new Path();
+ private Explosion explosionSource = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
@ -105,12 +105,12 @@
+ Block nmsBlock = craftBlock.getNMS().getBlock();
+ if (nmsBlock.a(explosionSource)) {
+ TileEntity tileentity = nmsBlock.isTileEntity() ? this.world.getTileEntity(blockposition) : null;
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, ItemStack.b).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.ORIGIN, Vec3D.a(blockposition)).set(LootContextParameters.TOOL, ItemStack.b).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
+
+ craftBlock.getNMS().a(loottableinfo_builder).forEach((itemstack) -> {
+ Block.a(world, blockposition, itemstack);
+ });
+ craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.b);
+ craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b);
+ }
+ nmsBlock.wasExploded(world, blockposition, explosionSource);
+

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityEnderman.java
+++ b/net/minecraft/server/EntityEnderman.java
@@ -52,7 +52,17 @@
@@ -51,7 +51,17 @@
@Override
public void setGoalTarget(@Nullable EntityLiving entityliving) {
@ -19,7 +19,7 @@
AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -67,6 +77,7 @@
@@ -66,6 +76,7 @@
attributemodifiable.b(EntityEnderman.c);
}
}
@ -27,25 +27,25 @@
}
@@ -360,8 +371,12 @@
@@ -359,8 +370,12 @@
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
if (block.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- this.enderman.setCarried(iblockdata);
- world.a(blockposition, false);
- this.enderman.setCarried(iblockdata.getBlock().getBlockData());
+ // CraftBukkit start - Pickup event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
+ this.enderman.setCarried(iblockdata);
+ world.a(blockposition, false);
+ this.enderman.setCarried(iblockdata.getBlock().getBlockData());
+ }
+ // CraftBukkit end
}
}
@@ -394,8 +409,12 @@
IBlockData iblockdata2 = this.a.getCarried();
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
@@ -395,8 +410,12 @@
if (iblockdata2 != null) {
iblockdata2 = Block.b(iblockdata2, (GeneratorAccess) this.a.world, blockposition);
if (this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
+ // CraftBukkit start - Place event
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, iblockdata2).isCancelled()) {
world.setTypeAndData(blockposition, iblockdata2, 3);

Datei anzeigen

@ -18,7 +18,7 @@
@@ -14,6 +18,12 @@
this(entitytypes, world);
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
this.ac();
this.ae();
+ // CraftBukkit start - Added setDirection method
+ this.setDirection(d3, d4, d5);
+ }
@ -40,8 +40,8 @@
+ // CraftBukkit end
}
Vec3D vec3d = this.getMot();
@@ -132,6 +148,11 @@
this.checkBlockCollisions();
@@ -133,6 +149,11 @@
Entity entity = damagesource.getEntity();
if (entity != null) {

Datei anzeigen

@ -59,7 +59,7 @@
double d0 = 5.0D;
@@ -197,7 +212,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D);
+ CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.damageEntity(DamageSource.a(this, this.getShooter()), f1);

Datei anzeigen

@ -13,8 +13,8 @@
public class EntityFishingHook extends IProjectile {
@@ -253,6 +258,10 @@
this.ao = 0;
this.ap = 0;
this.ah = 0;
this.ai = 0;
this.getDataWatcher().set(EntityFishingHook.f, false);
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.getOwner().getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/server/EntityFox.java
+++ b/net/minecraft/server/EntityFox.java
@@ -264,8 +264,8 @@
private List<UUID> fb() {
private List<UUID> fa() {
List<UUID> list = Lists.newArrayList();
- list.add(((Optional) this.datawatcher.get(EntityFox.FIRST_TRUSTED_PLAYER)).orElse((Object) null));
@ -59,7 +59,7 @@
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
}
@@ -1204,6 +1209,14 @@
@@ -1205,6 +1210,14 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.b(entityplayer1.getUniqueID());
}
@ -74,12 +74,12 @@
if (entityplayer2 != null) {
entityplayer2.a(StatisticList.ANIMALS_BRED);
@@ -1216,10 +1229,14 @@
@@ -1217,10 +1230,14 @@
this.partner.resetLove();
entityfox.setAgeRaw(-24000);
entityfox.setPositionRotation(this.animal.locX(), this.animal.locY(), this.animal.locZ(), 0.0F, 0.0F);
- this.b.addEntity(entityfox);
+ this.b.addEntity(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
- worldserver.addAllEntities(entityfox);
+ worldserver.addAllEntities(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
this.b.broadcastEntityEffect(this.animal, (byte) 18);
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), this.animal.getRandom().nextInt(7) + 1));

Datei anzeigen

@ -149,7 +149,7 @@
@@ -166,7 +230,7 @@
@Override
public void h(double d0, double d1, double d2) {
public void i(double d0, double d1, double d2) {
- if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
+ if (false && !this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed
this.die();

Datei anzeigen

@ -1,51 +0,0 @@
--- a/net/minecraft/server/EntityHoglin.java
+++ b/net/minecraft/server/EntityHoglin.java
@@ -10,10 +10,11 @@
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityHoglin.class, DataWatcherRegistry.i);
private int by;
- private int bz = 0;
- private boolean bA = false;
+ public int bz = 0; // PAIL
+ public boolean bA = false; // PAIL
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super EntityHoglin>>> bv = ImmutableList.of(SensorType.c, SensorType.d, SensorType.n, SensorType.m);
- protected static final ImmutableList<? extends MemoryModuleType<?>> bw = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, new MemoryModuleType[]{MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULY, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED});
+ // CraftBukkit - decompile error
+ protected static final ImmutableList<? extends MemoryModuleType<?>> bw = ImmutableList.<MemoryModuleType<?>>of(MemoryModuleType.BREED_TARGET, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, new MemoryModuleType[]{MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULY, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED});
public EntityHoglin(EntityTypes<? extends EntityHoglin> entitytypes, World world) {
super(entitytypes, world);
@@ -77,13 +78,13 @@
@Override
public BehaviorController<EntityHoglin> getBehaviorController() {
- return super.getBehaviorController();
+ return (BehaviorController<EntityHoglin>) super.getBehaviorController(); // CraftBukkit - decompile error
}
@Override
protected void mobTick() {
this.world.getMethodProfiler().enter("hoglinBrain");
- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this);
+ this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error
this.world.getMethodProfiler().exit();
HoglinAI.a(this);
if (this.eO()) {
@@ -216,7 +217,7 @@
this.getDataWatcher().set(EntityHoglin.bx, flag);
}
- private boolean eW() {
+ public boolean eW() { // PAIL
return (Boolean) this.getDataWatcher().get(EntityHoglin.bx);
}
@@ -256,7 +257,7 @@
@Override
protected SoundEffect getSoundAmbient() {
- return this.world.isClientSide ? null : (SoundEffect) HoglinAI.b(this).orElse((Object) null);
+ return this.world.isClientSide ? null : (SoundEffect) HoglinAI.b(this).orElse(null); // CraftBukkit - decompile error
}
@Override

Datei anzeigen

@ -9,9 +9,9 @@
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable, ISaddleable {
@@ -34,6 +35,7 @@
private float bR;
protected boolean bB = true;
protected int bC;
private float bK;
protected boolean bu = true;
protected int bv;
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
@ -51,7 +51,7 @@
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
}
if (this.fm()) {
if (this.fl()) {
@@ -718,6 +720,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.a("Owner", this.getOwnerUUID());
@ -89,5 +89,5 @@
+ }
+ // CraftBukkit end
this.canSlide = true;
this.eV();
this.fo();
this.eU();
this.fn();

Datei anzeigen

@ -19,15 +19,15 @@
+
public abstract class EntityHuman extends EntityLiving {
public static final EntitySize bo = EntitySize.b(0.6F, 1.8F);
- private static final Map<EntityPose, EntitySize> b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bo).put(EntityPose.SLEEPING, EntityHuman.ao).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
public static final EntitySize bh = EntitySize.b(0.6F, 1.8F);
- private static final Map<EntityPose, EntitySize> b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bh).put(EntityPose.SLEEPING, EntityHuman.ah).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
+ // CraftBukkit - decompile error
+ private static final Map<EntityPose, EntitySize> b = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.bo).put(EntityPose.SLEEPING, EntityHuman.ao).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
+ private static final Map<EntityPose, EntitySize> b = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.bh).put(EntityPose.SLEEPING, EntityHuman.ah).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
private static final DataWatcherObject<Float> c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c);
private static final DataWatcherObject<Integer> d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b);
protected static final DataWatcherObject<Byte> bp = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a);
protected static final DataWatcherObject<Byte> bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a);
@@ -28,10 +42,10 @@
protected static final DataWatcherObject<NBTTagCompound> bs = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p);
protected static final DataWatcherObject<NBTTagCompound> bl = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p);
private long e;
public final PlayerInventory inventory = new PlayerInventory(this);
- protected InventoryEnderChest enderChest = new InventoryEnderChest();
@ -36,9 +36,9 @@
public Container activeContainer;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
protected int by;
public float bz;
public float bA;
protected int br;
public float bs;
public float bt;
@@ -57,6 +71,16 @@
@Nullable
public EntityFishingHook hookedFish;
@ -53,9 +53,9 @@
+ }
+ // CraftBukkit end
+
public EntityHuman(World world, BlockPosition blockposition, GameProfile gameprofile) {
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.bS = ItemStack.b;
this.bL = ItemStack.b;
@@ -194,7 +218,7 @@
ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
@ -197,7 +197,7 @@
}
@Override
@@ -928,7 +1009,7 @@
@@ -932,7 +1013,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@ -206,7 +206,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -967,8 +1048,15 @@
@@ -971,8 +1052,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) {
@ -224,7 +224,7 @@
}
}
@@ -996,8 +1084,11 @@
@@ -1000,8 +1088,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) {
@ -237,7 +237,7 @@
}
}
@@ -1006,9 +1097,26 @@
@@ -1010,9 +1101,26 @@
}
if (entity instanceof EntityPlayer && entity.velocityChanged) {
@ -264,7 +264,7 @@
}
if (flag2) {
@@ -1053,7 +1161,14 @@
@@ -1057,7 +1165,14 @@
this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@ -280,7 +280,7 @@
}
if (this.world instanceof WorldServer && f5 > 2.0F) {
@@ -1069,6 +1184,11 @@
@@ -1073,6 +1188,11 @@
if (flag4) {
entity.extinguish();
}
@ -292,7 +292,7 @@
}
}
@@ -1129,17 +1249,40 @@
@@ -1133,17 +1253,40 @@
}
public Either<EntityHuman.EnumBedResult, Unit> sleep(BlockPosition blockposition) {
@ -333,9 +333,9 @@
this.sleepTicks = flag ? 0 : 100;
}
@@ -1249,7 +1392,11 @@
@@ -1253,7 +1396,11 @@
this.setMot(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.aL = f;
this.aE = f;
this.fallDistance = 0.0F;
- this.setFlag(7, false);
+ // CraftBukkit start
@ -344,9 +344,9 @@
+ }
+ // CraftBukkit end
} else {
super.f(vec3d);
super.g(vec3d);
}
@@ -1379,12 +1526,24 @@
@@ -1383,12 +1530,24 @@
}
public void startGliding() {
@ -372,7 +372,7 @@
}
@Override
@@ -1599,26 +1758,31 @@
@@ -1603,26 +1762,31 @@
protected void releaseShoulderEntities() {
if (this.e + 20L < this.world.getTime()) {

Datei anzeigen

@ -21,22 +21,22 @@
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
@@ -28,7 +40,7 @@
public final float[] dropChanceHand;
private final NonNullList<ItemStack> bx;
private final NonNullList<ItemStack> bq;
public final float[] dropChanceArmor;
- private boolean canPickUpLoot;
+ // private boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving
public boolean persistent;
private final Map<PathType, Float> bA;
private final Map<PathType, Float> bt;
public MinecraftKey lootTableKey;
@@ -41,6 +53,8 @@
private BlockPosition bG;
private float bH;
private BlockPosition bz;
private float bA;
+ public boolean aware = true; // CraftBukkit
+
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
super(entitytypes, world);
this.bw = NonNullList.a(2, ItemStack.b);
this.bp = NonNullList.a(2, ItemStack.b);
@@ -64,6 +78,9 @@
this.initPathfinder();
}
@ -207,9 +207,9 @@
++this.ticksFarFromPlayer;
+ if (!this.aware) return; // CraftBukkit
this.world.getMethodProfiler().enter("sensing");
this.bv.a();
this.bo.a();
this.world.getMethodProfiler().exit();
@@ -1014,6 +1097,12 @@
@@ -1023,6 +1106,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@ -222,7 +222,7 @@
this.unleash(true, !entityhuman.abilities.canInstantlyBuild);
return EnumInteractionResult.a(this.world.isClientSide);
} else {
@@ -1032,6 +1121,12 @@
@@ -1041,6 +1130,12 @@
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.LEAD && this.a(entityhuman)) {
@ -235,16 +235,28 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return EnumInteractionResult.a(this.world.isClientSide);
@@ -1047,7 +1142,7 @@
@@ -1056,7 +1151,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (!this.world.isClientSide) {
if (this.world instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
- Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, this.getEntityType(), this.world, this.getPositionVector(), itemstack);
+ Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getEntityType(), this.world, this.getPositionVector(), itemstack); // CraftBukkit - decompile error
- Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, this.getEntityType(), (WorldServer) this.world, this.getPositionVector(), itemstack);
+ Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getEntityType(), (WorldServer) this.world, this.getPositionVector(), itemstack); // CraftBukkit - decompile error
optional.ifPresent((entityinsentient) -> {
this.a(entityhuman, entityinsentient);
@@ -1098,7 +1193,7 @@
@@ -1102,12 +1197,19 @@
return this.bA != -1.0F;
}
+ // CraftBukkit start
@Nullable
public <T extends EntityInsentient> T a(EntityTypes<T> entitytypes, boolean flag) {
+ return this.a(entitytypes, flag, EntityTransformEvent.TransformReason.UNKNOWN, CreatureSpawnEvent.SpawnReason.DEFAULT);
+ }
+
+ @Nullable
+ public <T extends EntityInsentient> T a(EntityTypes<T> entitytypes, boolean flag, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
+ // CraftBukkit end
if (this.dead) {
return null;
} else {
@ -252,22 +264,22 @@
+ T t0 = entitytypes.a(this.world); // CraftBukkit - decompile error
t0.u(this);
t0.setCanPickupLoot(this.canPickupLoot());
@@ -1128,7 +1223,12 @@
t0.setBaby(this.isBaby());
@@ -1139,7 +1241,12 @@
}
}
- this.world.addEntity(t0);
+ // CraftBukkit start
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) {
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
+ return null;
+ }
+ this.world.addEntity(t0, CreatureSpawnEvent.SpawnReason.DROWNED);
+ this.world.addEntity(t0, spawnReason);
+ // CraftBukkit end
this.die();
return t0;
}
@@ -1141,6 +1241,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1159,6 +1266,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -275,9 +287,9 @@
this.unleash(true, true);
}
@@ -1157,7 +1258,9 @@
@@ -1175,7 +1283,9 @@
this.leashHolder = null;
this.bF = null;
this.by = null;
if (!this.world.isClientSide && flag1) {
+ this.forceDrops = true; // CraftBukkit
this.a((IMaterial) Items.LEAD);
@ -285,7 +297,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
@@ -1207,6 +1310,7 @@
@@ -1225,6 +1335,7 @@
boolean flag1 = super.a(entity, flag);
if (flag1 && this.isLeashed()) {
@ -293,7 +305,7 @@
this.unleash(true, true);
}
@@ -1339,7 +1443,14 @@
@@ -1357,7 +1468,14 @@
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (i > 0) {
@ -309,10 +321,10 @@
}
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
@@ -1401,6 +1512,7 @@
@@ -1419,6 +1537,7 @@
@Override
protected void bJ() {
super.bJ();
protected void bM() {
super.bM();
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(true, false);
}

Datei anzeigen

@ -35,7 +35,7 @@
this.lastX = this.locX();
this.lastY = this.locY();
@@ -103,9 +111,11 @@
@@ -108,9 +116,11 @@
}
}
@ -45,9 +45,9 @@
}
+ // CraftBukkit end */
this.impulse |= this.aG();
this.impulse |= this.aJ();
if (!this.world.isClientSide) {
@@ -117,6 +127,12 @@
@@ -122,6 +132,12 @@
}
if (!this.world.isClientSide && this.age >= 6000) {
@ -60,7 +60,7 @@
this.die();
}
@@ -192,10 +208,11 @@
@@ -197,10 +213,11 @@
private static void a(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
ItemStack itemstack2 = a(itemstack, itemstack1, 64);
@ -73,7 +73,7 @@
a(entityitem, itemstack, itemstack1);
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
entityitem.age = Math.min(entityitem.age, entityitem1.age);
@@ -219,6 +236,11 @@
@@ -224,6 +241,11 @@
} else if (!this.getItemStack().getItem().a(damagesource)) {
return false;
} else {
@ -85,7 +85,7 @@
this.velocityChanged();
this.f = (int) ((float) this.f - f);
if (this.f <= 0) {
@@ -280,6 +302,40 @@
@@ -285,6 +307,40 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();
@ -126,7 +126,7 @@
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
entityhuman.receive(this, i);
if (itemstack.isEmpty()) {
@@ -323,7 +379,9 @@
@@ -328,7 +384,9 @@
}
public void setItemStack(ItemStack itemstack) {

Datei anzeigen

@ -1,14 +1,5 @@
--- a/net/minecraft/server/EntityItemFrame.java
+++ b/net/minecraft/server/EntityItemFrame.java
@@ -11,7 +11,7 @@
private static final DataWatcherObject<ItemStack> ITEM = DataWatcher.a(EntityItemFrame.class, DataWatcherRegistry.g);
private static final DataWatcherObject<Integer> g = DataWatcher.a(EntityItemFrame.class, DataWatcherRegistry.b);
private float an = 1.0F;
- private boolean ao;
+ public boolean ao; // PAIL private -> public // PAIL rename isFixed
public EntityItemFrame(EntityTypes<? extends EntityItemFrame> entitytypes, World world) {
super(entitytypes, world);
@@ -53,16 +53,27 @@
@Override
protected void updateBoundingBox() {

Datei anzeigen

@ -41,7 +41,7 @@
- if (this.lifeTicks >= 0) {
+ if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit - add !this.isEffect
if (this.world.isClientSide) {
if (!(this.world instanceof WorldServer)) {
this.world.c(2);
} else if (!this.isEffect) {
@@ -89,7 +108,11 @@

Datei anzeigen

@ -28,9 +28,9 @@
private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -106,6 +126,21 @@
private float bI;
private float bJ;
protected BehaviorController<?> bn;
private float bB;
private float bC;
protected BehaviorController<?> bg;
+ // CraftBukkit start
+ public int expToDrop;
+ public int maxAirTicks = 300;
@ -51,15 +51,15 @@
super(entitytypes, world);
@@ -117,7 +152,9 @@
this.activeItem = ItemStack.b;
this.bF = Optional.empty();
this.by = Optional.empty();
this.attributeMap = new AttributeMapBase(AttributeDefaults.a(entitytypes));
- this.setHealth(this.getMaxHealth());
+ this.craftAttributes = new CraftAttributeMap(attributeMap); // CraftBukkit
+ // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
+ this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue());
this.i = true;
this.aG = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.ac();
this.az = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.ae();
@@ -184,7 +221,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@ -411,7 +411,7 @@
+ }
+ // CraftBukkit end
+
this.aw = 0.0F;
this.ap = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -1050,19 +1265,29 @@
@ -448,17 +448,19 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
@@ -1070,13 +1295,15 @@
@@ -1070,14 +1295,16 @@
}
this.setHealth(1.0F);
- this.removeAllEffects();
- this.addEffect(new MobEffect(MobEffects.REGENERATION, 900, 1));
- this.addEffect(new MobEffect(MobEffects.ABSORBTION, 100, 1));
- this.addEffect(new MobEffect(MobEffects.FIRE_RESISTANCE, 800, 0));
+ // CraftBukkit start
+ this.removeAllEffects(org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
+ this.addEffect(new MobEffect(MobEffects.REGENERATION, 900, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
+ this.addEffect(new MobEffect(MobEffects.ABSORBTION, 100, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
+ this.addEffect(new MobEffect(MobEffects.FIRE_RESISTANCE, 800, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
+ // CraftBukkit end
this.world.broadcastEntityEffect(this, (byte) 35);
}
@ -468,7 +470,7 @@
}
}
@@ -1193,28 +1420,46 @@
@@ -1194,28 +1421,46 @@
boolean flag = this.lastDamageByPlayerTime > 0;
@ -517,7 +519,7 @@
}
@@ -1335,9 +1580,14 @@
@@ -1336,9 +1581,14 @@
int i = this.e(f, f1);
if (i > 0) {
@ -533,7 +535,7 @@
return true;
} else {
return flag;
@@ -1377,7 +1627,7 @@
@@ -1378,7 +1628,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@ -542,7 +544,7 @@
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1390,7 +1640,8 @@
@@ -1391,7 +1641,8 @@
} else {
int i;
@ -552,7 +554,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1421,28 +1672,173 @@
@@ -1422,28 +1673,173 @@
}
}
@ -636,12 +638,9 @@
+ if (event.isCancelled()) {
+ return false;
+ }
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
- float f2 = f1 - f;
+
+ f = (float) event.getFinalDamage();
+
+ // Resistance
+ if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
+ float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
@ -666,13 +665,16 @@
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
+ this.damageArmor(damagesource, armorDamage);
+ }
+
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
- float f2 = f1 - f;
+ // Apply blocking code // PAIL: steal from above
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
+ this.world.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound
+ this.damageShield((float) -event.getDamage(DamageModifier.BLOCKING));
+ Entity entity = damagesource.j();
+
+ if (entity instanceof EntityLiving) {
+ this.shieldBlock((EntityLiving) entity);
+ }
@ -736,7 +738,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1814,6 +2210,7 @@
@@ -1815,6 +2211,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@ -744,7 +746,7 @@
this.setFlag(7, false);
}
} else {
@@ -2319,6 +2716,7 @@
@@ -2320,6 +2717,7 @@
}
if (!this.world.isClientSide) {
@ -752,7 +754,7 @@
this.setFlag(7, flag);
}
@@ -2439,6 +2837,7 @@
@@ -2440,6 +2838,7 @@
}
public boolean hasLineOfSight(Entity entity) {
@ -760,7 +762,7 @@
Vec3D vec3d = new Vec3D(this.locX(), this.getHeadY(), this.locZ());
Vec3D vec3d1 = new Vec3D(entity.locX(), entity.getHeadY(), entity.locZ());
@@ -2456,13 +2855,20 @@
@@ -2457,13 +2856,20 @@
@Override
public boolean isInteractable() {
@ -770,8 +772,8 @@
@Override
public boolean isCollidable() {
- return this.isAlive() && !this.isClimbing();
+ return this.isAlive() && !this.isClimbing() && this.collides; // CraftBukkit
- return this.isAlive() && !this.isSpectator() && !this.isClimbing();
+ return this.isAlive() && !this.isSpectator() && !this.isClimbing() && this.collides; // CraftBukkit
+ }
+
+ // CraftBukkit start - collidable API
@ -783,11 +785,11 @@
@Override
protected void velocityChanged() {
@@ -2645,7 +3051,27 @@
@@ -2657,7 +3063,25 @@
} else {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.b(this.activeItem, 16);
- this.a(this.getRaisedHand(), this.activeItem.a(this.world, this));
- ItemStack itemstack = this.activeItem.a(this.world, this);
+ // CraftBukkit start - fire PlayerItemConsumeEvent
+ ItemStack itemstack;
+ if (this instanceof EntityPlayer) {
@ -806,13 +808,11 @@
+ } else {
+ itemstack = this.activeItem.a(this.world, this);
+ }
+
+ this.a(this.getRaisedHand(), itemstack);
+ // CraftBukkit end
this.clearActiveItem();
}
@@ -2732,10 +3158,18 @@
if (itemstack != this.activeItem) {
this.a(enumhand, itemstack);
@@ -2749,10 +3173,18 @@
}
if (flag2) {
@ -834,7 +834,7 @@
}
}
@@ -2832,7 +3266,7 @@
@@ -2849,7 +3281,7 @@
}
public void entityWakeup() {
@ -843,7 +843,7 @@
World world = this.world;
this.world.getClass();
@@ -2899,7 +3333,7 @@
@@ -2920,7 +3352,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityLlamaTrader.java
+++ b/net/minecraft/server/EntityLlamaTrader.java
@@ -128,7 +128,7 @@
@@ -127,7 +127,7 @@
@Override
public void c() {

Datei anzeigen

@ -18,16 +18,16 @@
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.b);
@@ -20,7 +29,7 @@
private static final DataWatcherObject<Boolean> g = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.i);
private static final ImmutableMap<EntityPose, ImmutableList<Integer>> an = ImmutableMap.of(EntityPose.STANDING, ImmutableList.of(0, 1, -1), EntityPose.CROUCHING, ImmutableList.of(0, 1, -1), EntityPose.SWIMMING, ImmutableList.of(0, 1));
private boolean ao;
- private static final Map<BlockPropertyTrackPosition, Pair<BaseBlockPosition, BaseBlockPosition>> ap = (Map) SystemUtils.a((Object) Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> {
+ private static final Map<BlockPropertyTrackPosition, Pair<BaseBlockPosition, BaseBlockPosition>> ap = (Map) SystemUtils.a(Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> { // CraftBukkit - decompile error
private static final ImmutableMap<EntityPose, ImmutableList<Integer>> ag = ImmutableMap.of(EntityPose.STANDING, ImmutableList.of(0, 1, -1), EntityPose.CROUCHING, ImmutableList.of(0, 1, -1), EntityPose.SWIMMING, ImmutableList.of(0, 1));
private boolean ah;
- private static final Map<BlockPropertyTrackPosition, Pair<BaseBlockPosition, BaseBlockPosition>> ai = (Map) SystemUtils.a((Object) Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> {
+ private static final Map<BlockPropertyTrackPosition, Pair<BaseBlockPosition, BaseBlockPosition>> ai = (Map) SystemUtils.a(Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> { // CraftBukkit - decompile error
BaseBlockPosition baseblockposition = EnumDirection.WEST.p();
BaseBlockPosition baseblockposition1 = EnumDirection.EAST.p();
BaseBlockPosition baseblockposition2 = EnumDirection.NORTH.p();
@@ -48,6 +57,17 @@
private double au;
private double av;
private double an;
private double ao;
+ // CraftBukkit start
+ public boolean slowWhenEmpty = true;
@ -43,7 +43,7 @@
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
this.i = true;
@@ -168,6 +188,19 @@
@@ -175,6 +195,19 @@
if (this.isInvulnerable(damagesource)) {
return false;
} else {
@ -63,7 +63,7 @@
this.d(-this.n());
this.c(10);
this.velocityChanged();
@@ -175,6 +208,15 @@
@@ -182,6 +215,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40.0F) {
@ -79,7 +79,7 @@
this.ejectPassengers();
if (flag && !this.hasCustomName()) {
this.die();
@@ -227,6 +269,14 @@
@@ -234,6 +276,14 @@
@Override
public void tick() {
@ -94,16 +94,16 @@
if (this.getType() > 0) {
this.c(this.getType() - 1);
}
@@ -239,7 +289,7 @@
this.ai();
@@ -246,7 +296,7 @@
this.am();
}
- this.doPortalTick();
+ // this.doPortalTick(); // CraftBukkit - handled in postTick
if (this.world.isClientSide) {
if (this.aq > 0) {
double d0 = this.locX() + (this.ar - this.locX()) / (double) this.aq;
@@ -302,6 +352,18 @@
if (this.aj > 0) {
double d0 = this.locX() + (this.ak - this.locX()) / (double) this.aj;
@@ -309,6 +359,18 @@
}
this.setYawPitch(this.yaw, this.pitch);
@ -119,10 +119,10 @@
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
+ }
+ // CraftBukkit end
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && b(this.getMot()) > 0.01D) {
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && c(this.getMot()) > 0.01D) {
List<Entity> list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this));
@@ -310,8 +372,26 @@
@@ -317,8 +379,26 @@
Entity entity = (Entity) list.get(l);
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
@ -149,7 +149,7 @@
entity.collide(this);
}
}
@@ -323,6 +403,14 @@
@@ -330,6 +410,14 @@
Entity entity1 = (Entity) iterator.next();
if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) {
@ -164,7 +164,7 @@
entity1.collide(this);
}
}
@@ -333,7 +421,7 @@
@@ -346,7 +434,7 @@
}
protected double getMaxSpeed() {
@ -173,7 +173,7 @@
}
public void a(int i, int j, int k, boolean flag) {}
@@ -344,12 +432,16 @@
@@ -357,12 +445,16 @@
this.setMot(MathHelper.a(vec3d.x, -d0, d0), vec3d.y, MathHelper.a(vec3d.z, -d0, d0));
if (this.onGround) {
@ -192,7 +192,7 @@
}
}
@@ -536,7 +628,7 @@
@@ -549,7 +641,7 @@
}
protected void decelerate() {
@ -201,7 +201,7 @@
this.setMot(this.getMot().d(d0, 0.0D, d0));
}
@@ -619,6 +711,14 @@
@@ -632,6 +724,14 @@
if (!this.world.isClientSide) {
if (!entity.noclip && !this.noclip) {
if (!this.w(entity)) {
@ -216,7 +216,7 @@
double d0 = entity.locX() - this.locX();
double d1 = entity.locZ() - this.locZ();
double d2 = d0 * d0 + d1 * d1;
@@ -754,4 +854,26 @@
@@ -767,4 +867,26 @@
private EnumMinecartType() {}
}

Datei anzeigen

@ -2,7 +2,7 @@
+++ b/net/minecraft/server/EntityMinecartCommandBlock.java
@@ -103,5 +103,12 @@
public CommandListenerWrapper getWrapper() {
return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.getPositionVector(), EntityMinecartCommandBlock.this.be(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this);
return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.getPositionVector(), EntityMinecartCommandBlock.this.bh(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this);
}
+
+ // CraftBukkit start

Datei anzeigen

@ -8,9 +8,9 @@
+ return !this.isTrusting() /*&& this.ticksLived > 2400*/; // CraftBukkit
}
public static AttributeProvider.Builder eL() {
public static AttributeProvider.Builder eK() {
@@ -135,7 +135,8 @@
if ((this.by == null || this.by.h()) && !this.isTrusting() && this.k(itemstack) && entityhuman.h((Entity) this) < 9.0D) {
if ((this.br == null || this.br.h()) && !this.isTrusting() && this.k(itemstack) && entityhuman.h((Entity) this) < 9.0D) {
this.a(entityhuman, itemstack);
if (!this.world.isClientSide) {
- if (this.random.nextInt(3) == 0) {
@ -19,7 +19,7 @@
this.setTrusting(true);
this.u(true);
this.world.broadcastEntityEffect(this, (byte) 41);
@@ -244,9 +245,9 @@
@@ -243,9 +244,9 @@
private final EntityOcelot i;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

Datei anzeigen

@ -8,7 +8,7 @@
+
public class EntityPanda extends EntityAnimal {
private static final DataWatcherObject<Integer> bw = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.b);
private static final DataWatcherObject<Integer> bp = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.b);
@@ -445,7 +447,7 @@
@Override
@ -18,7 +18,7 @@
this.a(entityitem);
ItemStack itemstack = entityitem.getItemStack();
@@ -667,7 +669,7 @@
@@ -666,7 +668,7 @@
@Override
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {
@ -27,7 +27,7 @@
}
}
@@ -771,9 +773,9 @@
@@ -770,9 +772,9 @@
private final EntityPanda i;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {

Datei anzeigen

@ -2,10 +2,10 @@
+++ b/net/minecraft/server/EntityParrot.java
@@ -20,7 +20,7 @@
};
private static final Item bD = Items.COOKIE;
private static final Set<Item> bE = Sets.newHashSet(new Item[]{Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS});
- private static final Map<EntityTypes<?>, SoundEffect> bF = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ private static final Map<EntityTypes<?>, SoundEffect> bF = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
private static final Item bw = Items.COOKIE;
private static final Set<Item> bx = Sets.newHashSet(new Item[]{Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS});
- private static final Map<EntityTypes<?>, SoundEffect> by = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ private static final Map<EntityTypes<?>, SoundEffect> by = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
hashmap.put(EntityTypes.BLAZE, SoundEffects.ENTITY_PARROT_IMITATE_BLAZE);
hashmap.put(EntityTypes.CAVE_SPIDER, SoundEffects.ENTITY_PARROT_IMITATE_SPIDER);
hashmap.put(EntityTypes.CREEPER, SoundEffects.ENTITY_PARROT_IMITATE_CREEPER);

Datei anzeigen

@ -10,19 +10,19 @@
+
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
private static final DataWatcherObject<Boolean> bv = DataWatcher.a(EntityPig.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> bo = DataWatcher.a(EntityPig.class, DataWatcherRegistry.i);
@@ -204,7 +208,13 @@
}
entitypigzombie.setPersistent();
- this.world.addEntity(entitypigzombie);
- worldserver.addEntity(entitypigzombie);
+ // CraftBukkit start
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
+ // CraftBukkit - added a reason for spawning this creature
+ this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
+ worldserver.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
+ // CraftBukkit end
this.die();
} else {
super.onLightningStrike(entitylightning);
super.onLightningStrike(worldserver, entitylightning);

Datei anzeigen

@ -6,7 +6,7 @@
this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D));
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(new Class[0])); // CraftBukkit - decompile error
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::b));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::a_));
this.targetSelector.a(3, new PathfinderGoalUniversalAngerReset<>(this, true));
}
@@ -108,7 +108,7 @@
@ -25,8 +25,8 @@
- public void setGoalTarget(@Nullable EntityLiving entityliving) {
+ public boolean setGoalTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature
if (this.getGoalTarget() == null && entityliving != null) {
this.bv = EntityPigZombie.d.a(this.random);
this.bA = EntityPigZombie.bz.a(this.random);
this.bo = EntityPigZombie.d.a(this.random);
this.bt = EntityPigZombie.bs.a(this.random);
@@ -127,12 +127,21 @@
this.e((EntityHuman) entityliving);
}
@ -37,10 +37,10 @@
@Override
public void anger() {
- this.setAnger(EntityPigZombie.bw.a(this.random));
- this.setAnger(EntityPigZombie.bp.a(this.random));
+ // CraftBukkit start
+ Entity entity = ((WorldServer) this.world).getEntity(getAngerTarget());
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.bw.a(this.random));
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.bp.a(this.random));
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ this.setAngerTarget(null);

Datei anzeigen

@ -1,59 +0,0 @@
--- a/net/minecraft/server/EntityPiglin.java
+++ b/net/minecraft/server/EntityPiglin.java
@@ -16,9 +16,9 @@
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityPiglin.class, DataWatcherRegistry.i);
private static final UUID by = UUID.fromString("766bfa64-11f3-11ea-8d71-362b9e155667");
private static final AttributeModifier bz = new AttributeModifier(EntityPiglin.by, "Baby speed boost", 0.20000000298023224D, AttributeModifier.Operation.MULTIPLY_BASE);
- private int bA = 0;
+ public int bA = 0; // PAIL private -> public, rename conversionTicks
private final InventorySubcontainer bB = new InventorySubcontainer(8);
- private boolean bC = false;
+ public boolean bC = false; // PAIL private -> public, rename cannotHunt
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> b = ImmutableList.of(SensorType.c, SensorType.d, SensorType.b, SensorType.g, SensorType.e, SensorType.l);
protected static final ImmutableList<MemoryModuleType<?>> c = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTABLE_DOORS, MemoryModuleType.OPENED_DOORS, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEAREST_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_BABY_PIGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMSIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
@@ -157,7 +157,7 @@
@Override
public BehaviorController<EntityPiglin> getBehaviorController() {
- return super.getBehaviorController();
+ return (BehaviorController<EntityPiglin>) super.getBehaviorController(); // CraftBukkit - decompile error
}
@Override
@@ -217,7 +217,7 @@
this.getDataWatcher().set(EntityPiglin.bv, flag);
}
- private boolean eT() {
+ public boolean eT() { // PAIL private -> public, rename isImmuneToZombification
return (Boolean) this.getDataWatcher().get(EntityPiglin.bv);
}
@@ -236,7 +236,7 @@
@Override
protected void mobTick() {
this.world.getMethodProfiler().enter("piglinBrain");
- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this);
+ this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error
this.world.getMethodProfiler().exit();
PiglinAI.b(this);
if (this.eO()) {
@@ -268,7 +268,7 @@
@Nullable
@Override
public EntityLiving getGoalTarget() {
- return (EntityLiving) this.bn.getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
+ return (EntityLiving) this.bn.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
}
private ItemStack eU() {
@@ -396,7 +396,7 @@
@Override
protected SoundEffect getSoundAmbient() {
- return this.world.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse((Object) null);
+ return this.world.isClientSide ? null : (SoundEffect) PiglinAI.d(this).orElse(null); // CraftBukkit - decompile error
}
@Override

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityPlayer.java
+++ b/net/minecraft/server/EntityPlayer.java
@@ -14,6 +14,27 @@
@@ -15,6 +15,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -28,7 +28,7 @@
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger LOGGER = LogManager.getLogger();
@@ -56,6 +77,20 @@
@@ -58,6 +79,20 @@
public int ping;
public boolean viewingCredits;
@ -47,19 +47,19 @@
+ // CraftBukkit end
+
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, worldserver.getSpawn(), gameprofile);
super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile);
this.spawnDimension = World.OVERWORLD;
@@ -66,12 +101,56 @@
@@ -68,12 +103,56 @@
this.advancementDataPlayer = minecraftserver.getPlayerList().f(this);
this.G = 1.0F;
this.b(worldserver);
this.c(worldserver);
+
+ // CraftBukkit start
+ this.displayName = this.getName();
+ this.canPickUpLoot = true;
+ this.maxHealthCache = this.getMaxHealth();
+ }
+
}
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
+ // If this is an issue, PRs are welcome
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
@ -96,10 +96,10 @@
+ }
+
+ return blockposition;
}
+ }
+ // CraftBukkit end
private void b(WorldServer worldserver) {
+
private void c(WorldServer worldserver) {
BlockPosition blockposition = worldserver.getSpawn();
- if (worldserver.getDimensionManager().hasSkyLight() && worldserver.getMinecraftServer().getSaveData().getGameType() != EnumGamemode.ADVENTURE) {
@ -107,7 +107,7 @@
int i = Math.max(0, this.server.a(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -137,11 +216,20 @@
@@ -139,11 +218,20 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager());
}
@ -128,7 +128,7 @@
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.spawn = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.spawnForced = nbttagcompound.getBoolean("SpawnForced");
@@ -174,7 +262,20 @@
@@ -177,7 +265,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@ -150,22 +150,22 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -191,7 +292,7 @@
nbttagcompound.setInt("SpawnY", this.spawn.getY());
@@ -195,7 +296,7 @@
nbttagcompound.setInt("SpawnZ", this.spawn.getZ());
nbttagcompound.setBoolean("SpawnForced", this.spawnForced);
nbttagcompound.setFloat("SpawnAngle", this.spawnAngle);
- DataResult dataresult = MinecraftKey.a.encodeStart(DynamicOpsNBT.a, this.spawnDimension.a());
+ DataResult<NBTBase> dataresult = MinecraftKey.a.encodeStart(DynamicOpsNBT.a, this.spawnDimension.a()); // CraftBukkit - decompile error
Logger logger = EntityPlayer.LOGGER;
logger.getClass();
@@ -199,8 +300,32 @@
@@ -203,9 +304,33 @@
nbttagcompound.set("SpawnDimension", nbtbase);
});
}
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
+
+ }
}
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
+ public void spawnIn(World world) {
@ -176,7 +176,7 @@
+ if (this.spawnDimension != null) {
+ world = this.getWorldServer().getServer().getHandle().getServer().getWorldServer(this.spawnDimension);
+ if (world != null && this.getSpawn() != null) {
+ position = EntityHuman.getBed((WorldServer) world, this.getSpawn(), false, false).orElse(null);
+ position = EntityHuman.getBed((WorldServer) world, this.getSpawn(), this.getSpawnAngle(), false, false).orElse(null);
+ }
+ }
+ if (world == null || position == null) {
@ -187,12 +187,13 @@
+ this.setPosition(position.getX(), position.getY(), position.getZ());
+ }
+ this.playerInteractManager.a((WorldServer) world);
}
+ }
+ // CraftBukkit end
+
public void a(int i) {
float f = (float) this.getExpToLevel();
@@ -255,6 +380,11 @@
float f1 = (f - 1.0F) / f;
@@ -259,6 +384,11 @@
@Override
public void tick() {
@ -204,7 +205,7 @@
this.playerInteractManager.a();
--this.invulnerableTicks;
if (this.noDamageTicks > 0) {
@@ -322,7 +452,7 @@
@@ -326,7 +456,7 @@
}
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) {
@ -213,7 +214,7 @@
this.lastHealthSent = this.getHealth();
this.lastFoodSent = this.foodData.getFoodLevel();
this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -353,6 +483,12 @@
@@ -357,6 +487,12 @@
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored));
}
@ -226,7 +227,7 @@
if (this.expLevel != this.lastExpLevelScored) {
this.lastExpLevelScored = this.expLevel;
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored));
@@ -367,6 +503,16 @@
@@ -371,6 +507,16 @@
CriterionTriggers.p.a(this);
}
@ -243,7 +244,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
@@ -377,7 +523,8 @@
@@ -381,7 +527,8 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@ -253,7 +254,7 @@
scoreboardscore.setScore(i);
});
}
@@ -385,9 +532,46 @@
@@ -389,9 +536,46 @@
@Override
public void die(DamageSource damagesource) {
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
@ -302,9 +303,9 @@
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
if (!future.isSuccess()) {
@@ -421,12 +605,18 @@
@@ -425,12 +609,18 @@
if (this.world.getGameRules().getBoolean(GameRules.FORGIVE_DEAD_PLAYERS)) {
this.eW();
this.eV();
}
-
- if (!this.isSpectator()) {
@ -325,7 +326,7 @@
EntityLiving entityliving = this.getKillingEntity();
if (entityliving != null) {
@@ -462,10 +652,12 @@
@@ -466,10 +656,12 @@
String s = this.getName();
String s1 = entity.getName();
@ -340,7 +341,7 @@
} else {
this.a(StatisticList.MOB_KILLS);
}
@@ -483,7 +675,8 @@
@@ -487,7 +679,8 @@
int i = scoreboardteam.getColor().b();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@ -350,7 +351,7 @@
}
}
@@ -527,17 +720,27 @@
@@ -531,7 +724,8 @@
}
private boolean canPvP() {
@ -360,15 +361,30 @@
}
@Nullable
@@ -539,10 +733,10 @@
protected ShapeDetectorShape a(WorldServer worldserver) {
ShapeDetectorShape shapedetectorshape = super.a(worldserver);
- if (shapedetectorshape != null && this.world.getDimensionKey() == World.OVERWORLD && worldserver.getDimensionKey() == World.THE_END) {
+ if (shapedetectorshape != null && this.world.getTypeKey() == DimensionManager.OVERWORLD && worldserver != null && worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
Vec3D vec3d = shapedetectorshape.position.add(0.0D, -1.0D, 0.0D);
- return new ShapeDetectorShape(vec3d, Vec3D.a, 90.0F, 0.0F);
+ return new ShapeDetectorShape(vec3d, Vec3D.a, 90.0F, 0.0F, worldserver); // CraftBukkit
} else {
return shapedetectorshape;
}
@@ -551,11 +745,20 @@
@Nullable
@Override
public Entity a(WorldServer worldserver) {
public Entity b(WorldServer worldserver) {
- this.worldChangeInvuln = true;
+ // CraftBukkit start
+ return a(worldserver, TeleportCause.UNKNOWN);
+ return b(worldserver, TeleportCause.UNKNOWN);
+ }
+
+ @Nullable
+ public Entity a(WorldServer worldserver, PlayerTeleportEvent.TeleportCause cause) {
+ public Entity b(WorldServer worldserver, PlayerTeleportEvent.TeleportCause cause) {
+ // CraftBukkit end
+ if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
+ // this.worldChangeInvuln = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
@ -382,7 +398,7 @@
this.decouple();
this.getWorldServer().removePlayer(this);
if (!this.viewingCredits) {
@@ -548,6 +751,8 @@
@@ -566,6 +769,8 @@
return this;
} else {
@ -390,119 +406,43 @@
+ /*
WorldData worlddata = worldserver.getWorldData();
this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getTypeKey(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
@@ -557,6 +762,8 @@
this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
@@ -575,22 +780,65 @@
playerlist.d(this);
worldserver1.removePlayer(this);
this.dead = false;
+ */
+ // CraftBukkit end
double d0 = this.locX();
double d1 = this.locY();
double d2 = this.locZ();
@@ -567,7 +774,8 @@
ShapeDetectorShape shapedetectorshape = this.a(worldserver);
if (shapedetectorshape != null) {
worldserver1.getMethodProfiler().enter("moving");
double d3;
- if (worldserver.getDimensionKey() == World.THE_END) {
+ if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
+ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
BlockPosition blockposition = WorldServer.a;
d0 = (double) blockposition.getX();
@@ -576,7 +784,7 @@
f1 = 90.0F;
f = 0.0F;
} else {
- if (resourcekey == World.OVERWORLD && worldserver.getDimensionKey() == World.THE_NETHER) {
+ worldserver = shapedetectorshape.world; // CraftBukkit
+ if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
+ if (resourcekey == DimensionManager.OVERWORLD && worldserver.getTypeKey() == DimensionManager.THE_NETHER) { // CraftBukkit
this.cp = this.getPositionVector();
this.ci = this.getPositionVector();
- } else if (worldserver.getDimensionKey() == World.THE_END) {
+ } else if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
this.a(worldserver, new BlockPosition(shapedetectorshape.position));
}
@@ -593,7 +801,26 @@
}
}
- this.setPositionRotation(d0, d1, d2, f1, f);
+ // CraftBukkit start
+ }
+ Location enter = this.getBukkitEntity().getLocation();
+ Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f);
+ Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, shapedetectorshape.pitch);
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled() || event.getTo() == null) {
+ return null;
+ }
+
- worldserver1.getMethodProfiler().exit();
- worldserver1.getMethodProfiler().enter("placing");
+ exit = event.getTo();
+ if (exit == null) {
+ return null;
+ }
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
+ d0 = exit.getX();
+ d1 = exit.getY();
+ d2 = exit.getZ();
+ // CraftBukkit end
+
+ // this.setPositionRotation(d0, d1, d2, f1, f); // CraftBukkit - PlayerTeleportEvent handles position changes
worldserver1.getMethodProfiler().exit();
worldserver1.getMethodProfiler().enter("placing");
double d4 = Math.min(-2.9999872E7D, worldserver.getWorldBorder().e() + 16.0D);
@@ -604,25 +831,74 @@
d0 = MathHelper.a(d0, d4, d5);
d2 = MathHelper.a(d2, d3, d6);
- this.setPositionRotation(d0, d1, d2, f1, f);
- if (worldserver.getDimensionKey() == World.THE_END) {
- int i = MathHelper.floor(this.locX());
- int j = MathHelper.floor(this.locY()) - 1;
- int k = MathHelper.floor(this.locZ());
-
- WorldServer.a(worldserver);
- this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F);
- this.setMot(Vec3D.a);
- } else if (!worldserver.getTravelAgent().findAndTeleport(this, f2)) {
- worldserver.getTravelAgent().createPortal(this);
- worldserver.getTravelAgent().findAndTeleport(this, f2);
+ // this.setPositionRotation(d0, d1, d2, f1, f); // CraftBukkit - PlayerTeleportEvent handles position changes
+ // CraftBukkit start - PlayerPortalEvent implementation
+ Vec3D exitVelocity = Vec3D.a;
+ BlockPosition exitPosition = new BlockPosition(d0, d1, d2);
+ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
+ int i = exitPosition.getX();
+ int j = exitPosition.getY() - 1;
+ int k = exitPosition.getZ();
+ if (event.getCanCreatePortal()) {
+ WorldServer.a(worldserver, this);
+ }
+ // handled below for PlayerTeleportEvent
+ // this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F);
+ exit.setX(i);
+ exit.setY(j);
+ exit.setZ(k);
+ // this.setMot(Vec3D.a);
+ exitVelocity = Vec3D.a;
+ } else if (worldserver.getTypeKey() == DimensionManager.THE_NETHER || worldserver1.getTypeKey() == DimensionManager.THE_NETHER) {
+ ShapeDetector.Shape portalShape = worldserver.getTravelAgent().findAndTeleport(this, exitPosition, f2, event.getSearchRadius(), true);
+ if (portalShape == null && event.getCanCreatePortal()) {
+ if (worldserver.getTravelAgent().createPortal(this, exitPosition, event.getCreationRadius())) { // Only check for new portal if creation succeeded
+ portalShape = worldserver.getTravelAgent().findAndTeleport(this, exitPosition, f2, event.getSearchRadius(), true);
+ }
+ }
+ // Check if portal was found
+ if (portalShape == null) {
+ return null;
+ }
+ // Teleport handling - logic from PortalTravelAgent#findAndTeleport
+ exitVelocity = portalShape.velocity;
+ exit.setX(portalShape.position.getX());
+ exit.setY(portalShape.position.getY());
+ exit.setZ(portalShape.position.getZ());
+ exit.setYaw(f2 + (float) portalShape.yaw);
+ // CraftBukkit end
}
worldserver1.getMethodProfiler().exit();
+ // CraftBukkit start - PlayerTeleportEvent
+ PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, cause);
+ Bukkit.getServer().getPluginManager().callEvent(tpEvent);
+ if (tpEvent.isCancelled() || tpEvent.getTo() == null) {
@ -514,9 +454,14 @@
+ return null;
+ }
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
+ // CraftBukkit end
+
+ worldserver1.getMethodProfiler().exit();
+ worldserver1.getMethodProfiler().enter("placing");
+ if (true) { // CraftBukkit
+ this.worldChangeInvuln = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
+
+ this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getTypeKey(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
+ this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
+ this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(this.world.getDifficulty(), this.world.getWorldData().isDifficultyLocked()));
+ PlayerList playerlist = this.server.getPlayerList();
+
@ -524,18 +469,17 @@
+ worldserver1.removePlayer(this);
+ this.dead = false;
+
+ this.setMot(exitVelocity);
+ // CraftBukkit end
this.spawnIn(worldserver);
worldserver.addPlayerPortal(this);
this.triggerDimensionAdvancements(worldserver1);
- this.playerConnection.a(this.locX(), this.locY(), this.locZ(), f1, f);
- this.setYawPitch(shapedetectorshape.yaw, shapedetectorshape.pitch);
- this.teleportAndSync(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z);
+ this.playerConnection.teleport(exit); // CraftBukkit - use internal teleport without event
+ this.playerConnection.syncPosition(); // CraftBukkit - sync position after changing it (from PortalTravelAgent#findAndteleport)
worldserver1.getMethodProfiler().exit();
this.triggerDimensionAdvancements(worldserver1);
this.playerInteractManager.a(worldserver);
this.playerConnection.sendPacket(new PacketPlayOutAbilities(this.abilities));
playerlist.a(this, worldserver);
@@ -639,6 +915,11 @@
@@ -609,6 +857,11 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@ -544,10 +488,21 @@
+ PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
+ this.world.getServer().getPluginManager().callEvent(changeEvent);
+ // CraftBukkit end
}
return this;
@@ -631,8 +884,8 @@
}
}
@@ -680,10 +961,8 @@
@Override
- protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag) {
- Optional<BlockUtil.Rectangle> optional = super.a(worldserver, blockposition, flag);
+ protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag, int radius) { // CraftBukkit
+ Optional<BlockUtil.Rectangle> optional = super.a(worldserver, blockposition, flag, radius); // CraftBukkit
if (optional.isPresent()) {
return optional;
@@ -685,10 +938,8 @@
this.activeContainer.c();
}
@ -560,7 +515,7 @@
if (!this.isSleeping() && this.isAlive()) {
if (!this.world.getDimensionManager().isNatural()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
@@ -709,7 +988,36 @@
@@ -714,7 +965,36 @@
}
}
@ -598,7 +553,7 @@
this.a(StatisticList.SLEEP_IN_BED);
CriterionTriggers.q.a(this);
});
@@ -718,9 +1026,8 @@
@@ -723,9 +1003,8 @@
return either;
}
}
@ -609,7 +564,7 @@
}
@Override
@@ -747,6 +1054,7 @@
@@ -752,6 +1031,7 @@
@Override
public void wakeup(boolean flag, boolean flag1) {
@ -617,7 +572,7 @@
if (this.isSleeping()) {
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
}
@@ -818,8 +1126,9 @@
@@ -823,8 +1103,9 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@ -628,7 +583,7 @@
}
@Override
@@ -834,6 +1143,24 @@
@@ -839,6 +1120,24 @@
this.nextContainerCounter();
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
@ -653,7 +608,7 @@
if (container == null) {
if (this.isSpectator()) {
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
@@ -841,9 +1168,11 @@
@@ -846,9 +1145,11 @@
return OptionalInt.empty();
} else {
@ -667,7 +622,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -856,13 +1185,24 @@
@@ -861,13 +1162,24 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -694,7 +649,7 @@
this.activeContainer.addSlotListener(this);
}
@@ -907,6 +1247,11 @@
@@ -912,6 +1224,11 @@
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@ -706,7 +661,7 @@
}
@Override
@@ -916,6 +1261,7 @@
@@ -921,6 +1238,7 @@
@Override
public void closeInventory() {
@ -714,7 +669,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.o();
}
@@ -950,7 +1296,7 @@
@@ -955,7 +1273,7 @@
@Override
public void a(Statistic<?> statistic, int i) {
this.serverStatisticManager.b(this, statistic, i);
@ -723,7 +678,7 @@
scoreboardscore.addScore(i);
});
}
@@ -958,7 +1304,7 @@
@@ -963,7 +1281,7 @@
@Override
public void a(Statistic<?> statistic) {
this.serverStatisticManager.setStatistic(this, statistic, 0);
@ -732,7 +687,7 @@
}
@Override
@@ -1007,7 +1353,16 @@
@@ -1012,7 +1330,16 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@ -749,23 +704,22 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
@@ -1062,12 +1417,14 @@
@@ -1065,12 +1392,13 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
- this.recipeBook.a((RecipeBook) entityplayer.recipeBook);
+ // this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit
this.removeQueue.addAll(entityplayer.removeQueue);
this.ck = entityplayer.ck;
this.cp = entityplayer.cp;
this.cd = entityplayer.cd;
this.ci = entityplayer.ci;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
this.setShoulderEntityRight(entityplayer.getShoulderEntityRight());
+
+ this.inLava = false; // SPIGOT-4767
}
@Override
@@ -1135,6 +1492,18 @@
@@ -1138,6 +1466,18 @@
@Override
public void a(EnumGamemode enumgamemode) {
@ -784,7 +738,7 @@
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -1184,7 +1553,20 @@
@@ -1187,7 +1527,20 @@
return s;
}
@ -802,10 +756,10 @@
+ this.locale = packetplayinsettings.locale;
+ this.clientViewDistance = packetplayinsettings.viewDistance;
+ // CraftBukkit end
this.cf = packetplayinsettings.d();
this.cg = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f());
@@ -1220,13 +1602,13 @@
this.bY = packetplayinsettings.d();
this.bZ = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f());
@@ -1223,13 +1576,13 @@
if (entity instanceof EntityHuman) {
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
} else {
@ -821,7 +775,7 @@
}
@Override
@@ -1250,7 +1632,7 @@
@@ -1253,7 +1606,7 @@
this.spectatedEntity = (Entity) (entity == null ? this : entity);
if (entity1 != this.spectatedEntity) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
@ -830,7 +784,7 @@
}
}
@@ -1279,7 +1661,7 @@
@@ -1282,7 +1635,7 @@
@Nullable
public IChatBaseComponent getPlayerListName() {
@ -839,7 +793,7 @@
}
@Override
@@ -1300,9 +1682,16 @@
@@ -1303,9 +1656,16 @@
return this.advancementDataPlayer;
}
@ -856,7 +810,7 @@
if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1);
} else {
@@ -1323,6 +1712,9 @@
@@ -1326,6 +1686,9 @@
this.server.getPlayerList().a(this, worldserver);
this.server.getPlayerList().updateClient(this);
}
@ -866,7 +820,7 @@
}
@@ -1409,4 +1801,144 @@
@@ -1418,4 +1781,144 @@
return entityitem;
}
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityRabbit.java
+++ b/net/minecraft/server/EntityRabbit.java
@@ -17,11 +17,17 @@
@@ -17,8 +17,14 @@
super(entitytypes, world);
this.bp = new EntityRabbit.ControllerJumpRabbit(this);
this.bi = new EntityRabbit.ControllerJumpRabbit(this);
this.moveController = new EntityRabbit.ControllerMoveRabbit(this);
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
+ }
@ -14,11 +14,7 @@
+ // CraftBukkit end
@Override
- protected void initPathfinder() {
+ public void initPathfinder() {
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new EntityRabbit.PathfinderGoalRabbitPanic(this, 2.2D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 0.8D));
public void initPathfinder() {
@@ -285,7 +291,7 @@
if (i == 99) {
this.getAttributeInstance(GenericAttributes.ARMOR).setValue(8.0D);

Datei anzeigen

@ -12,9 +12,9 @@
+
public class EntitySheep extends EntityAnimal implements IShearable {
private static final DataWatcherObject<Byte> bv = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a);
- private static final Map<EnumColor, IMaterial> bw = (Map) SystemUtils.a((Object) Maps.newEnumMap(EnumColor.class), (enummap) -> {
+ private static final Map<EnumColor, IMaterial> bw = (Map) SystemUtils.a(Maps.newEnumMap(EnumColor.class), (enummap) -> { // CraftBukkit - decompile error
private static final DataWatcherObject<Byte> bo = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.a);
- private static final Map<EnumColor, IMaterial> bp = (Map) SystemUtils.a((Object) Maps.newEnumMap(EnumColor.class), (enummap) -> {
+ private static final Map<EnumColor, IMaterial> bp = (Map) SystemUtils.a(Maps.newEnumMap(EnumColor.class), (enummap) -> { // CraftBukkit - decompile error
enummap.put(EnumColor.WHITE, Blocks.WHITE_WOOL);
enummap.put(EnumColor.ORANGE, Blocks.ORANGE_WOOL);
enummap.put(EnumColor.MAGENTA, Blocks.MAGENTA_WOOL);
@ -35,7 +35,7 @@
for (int j = 0; j < i; ++j) {
+ this.forceDrops = true; // CraftBukkit
EntityItem entityitem = this.a((IMaterial) EntitySheep.bw.get(this.getColor()), 1);
EntityItem entityitem = this.a((IMaterial) EntitySheep.bp.get(this.getColor()), 1);
+ this.forceDrops = false; // CraftBukkit
if (entityitem != null) {

Datei anzeigen

@ -40,7 +40,7 @@
@@ -319,6 +333,7 @@
}
this.f((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
this.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
}
}

Datei anzeigen

@ -22,7 +22,7 @@
@Override
public SoundCategory getSoundCategory() {
return SoundCategory.HOSTILE;
@@ -255,7 +268,7 @@
@@ -256,7 +269,7 @@
if (flag) {
this.a(entityliving, entity);
if (entity instanceof EntityLiving) {

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/server/EntitySlime.java
+++ b/net/minecraft/server/EntitySlime.java
@@ -3,6 +3,13 @@
import java.util.EnumSet;
@@ -5,6 +5,13 @@
import java.util.Optional;
import java.util.Random;
import javax.annotation.Nullable;
+// CraftBukkit start
@ -14,7 +14,7 @@
public class EntitySlime extends EntityInsentient implements IMonster {
@@ -147,7 +154,7 @@
@@ -149,7 +156,7 @@
@Override
public EntityTypes<? extends EntitySlime> getEntityType() {
@ -23,7 +23,7 @@
}
@Override
@@ -161,6 +168,19 @@
@@ -163,6 +170,19 @@
int j = i / 2;
int k = 2 + this.random.nextInt(3);
@ -43,7 +43,7 @@
for (int l = 0; l < k; ++l) {
float f1 = ((float) (l % 2) - 0.5F) * f;
float f2 = ((float) (l / 2) - 0.5F) * f;
@@ -175,8 +195,17 @@
@@ -177,8 +197,17 @@
entityslime.setInvulnerable(this.isInvulnerable());
entityslime.setSize(j, true);
entityslime.setPositionRotation(this.locX() + (double) f1, this.locY() + 0.5D, this.locZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);

Datei anzeigen

@ -1,15 +1,6 @@
--- a/net/minecraft/server/EntitySpider.java
+++ b/net/minecraft/server/EntitySpider.java
@@ -123,7 +123,7 @@
entityskeleton.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F);
entityskeleton.prepare(generatoraccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) null, (NBTTagCompound) null);
entityskeleton.startRiding(this);
- generatoraccess.addEntity(entityskeleton);
+ generatoraccess.addEntity(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit - add SpawnReason
}
if (object == null) {
@@ -137,7 +137,7 @@
@@ -136,7 +136,7 @@
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).a;
if (mobeffectlist != null) {

Datei anzeigen

@ -1,97 +0,0 @@
--- a/net/minecraft/server/EntityStrider.java
+++ b/net/minecraft/server/EntityStrider.java
@@ -14,7 +14,7 @@
private static final DataWatcherObject<Integer> bx = DataWatcher.a(EntityStrider.class, DataWatcherRegistry.b);
private static final DataWatcherObject<Boolean> by = DataWatcher.a(EntityStrider.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> bz = DataWatcher.a(EntityStrider.class, DataWatcherRegistry.i);
- private final SaddleStorage bA;
+ public final SaddleStorage bA; // CraftBukkit PAIL private -> public, rename saddleStorage
private PathfinderGoalTempt bB;
private PathfinderGoalPanic bC;
@@ -264,7 +264,12 @@
IBlockData iblockdata1 = this.aJ();
boolean flag = iblockdata.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || this.b((Tag) TagsFluid.LAVA) > 0.0D;
- this.t(!flag);
+ // CraftBukkit start
+ if (!flag ^ this.eL()) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag);
+ this.t(!flag);
+ }
+ // CraftBukkit end
super.tick();
this.eV();
this.checkBlockCollisions();
@@ -390,36 +395,36 @@
@Override
public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
EntityZombie.GroupDataZombie entityzombie_groupdatazombie = null;
- EntityStrider$GroupData$Rider entitystrider$groupdata$rider;
+ EntityStrider.GroupData.Rider entitystrider_groupdata_rider;
- if (groupdataentity instanceof EntityStrider.a) {
- entitystrider$groupdata$rider = ((EntityStrider.a) groupdataentity).a;
+ if (groupdataentity instanceof EntityStrider.GroupData) {
+ entitystrider_groupdata_rider = ((EntityStrider.GroupData) groupdataentity).a;
} else if (!this.isBaby()) {
if (this.random.nextInt(30) == 0) {
- entitystrider$groupdata$rider = EntityStrider$GroupData$Rider.PIGLIN_RIDER;
+ entitystrider_groupdata_rider = EntityStrider.GroupData.Rider.PIGLIN_RIDER;
entityzombie_groupdatazombie = new EntityZombie.GroupDataZombie(EntityZombie.a(this.random), false);
} else if (this.random.nextInt(10) == 0) {
- entitystrider$groupdata$rider = EntityStrider$GroupData$Rider.BABY_RIDER;
+ entitystrider_groupdata_rider = EntityStrider.GroupData.Rider.BABY_RIDER;
} else {
- entitystrider$groupdata$rider = EntityStrider$GroupData$Rider.NO_RIDER;
+ entitystrider_groupdata_rider = EntityStrider.GroupData.Rider.NO_RIDER;
}
- groupdataentity = new EntityStrider.a(entitystrider$groupdata$rider);
- ((EntityAgeable.a) groupdataentity).a(entitystrider$groupdata$rider == EntityStrider$GroupData$Rider.NO_RIDER ? 0.5F : 0.0F);
+ groupdataentity = new EntityStrider.GroupData(entitystrider_groupdata_rider);
+ ((EntityAgeable.a) groupdataentity).a(entitystrider_groupdata_rider == EntityStrider.GroupData.Rider.NO_RIDER ? 0.5F : 0.0F);
} else {
- entitystrider$groupdata$rider = EntityStrider$GroupData$Rider.NO_RIDER;
+ entitystrider_groupdata_rider = EntityStrider.GroupData.Rider.NO_RIDER;
}
Object object = null;
- if (entitystrider$groupdata$rider == EntityStrider$GroupData$Rider.BABY_RIDER) {
+ if (entitystrider_groupdata_rider == EntityStrider.GroupData.Rider.BABY_RIDER) {
EntityStrider entitystrider = (EntityStrider) EntityTypes.STRIDER.a(generatoraccess.getMinecraftWorld());
if (entitystrider != null) {
object = entitystrider;
entitystrider.setAgeRaw(-24000);
}
- } else if (entitystrider$groupdata$rider == EntityStrider$GroupData$Rider.PIGLIN_RIDER) {
+ } else if (entitystrider_groupdata_rider == EntityStrider.GroupData.Rider.PIGLIN_RIDER) {
EntityPigZombie entitypigzombie = (EntityPigZombie) EntityTypes.ZOMBIFIED_PIGLIN.a(generatoraccess.getMinecraftWorld());
if (entitypigzombie != null) {
@@ -461,12 +466,19 @@
}
}
- public static class a extends EntityAgeable.a {
+ public static class GroupData extends EntityAgeable.a {
+
+ public final EntityStrider.GroupData.Rider a;
+
+ public GroupData(EntityStrider.GroupData.Rider entitystrider_groupdata_rider) {
+ this.a = entitystrider_groupdata_rider;
+ }
+
+ public static enum Rider {
- public final EntityStrider$GroupData$Rider a;
+ NO_RIDER, BABY_RIDER, PIGLIN_RIDER;
- public a(EntityStrider$GroupData$Rider entitystrider$groupdata$rider) {
- this.a = entitystrider$groupdata$rider;
+ private Rider() {}
}
}
}

Datei anzeigen

@ -30,7 +30,7 @@
+ this.die();
+ // CraftBukkit end
} else {
this.aG();
this.aJ();
if (this.world.isClientSide) {
@@ -71,9 +77,16 @@
}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen