Update to Minecraft 1.15

This commit is contained in:
md_5 2019-12-11 09:00:00 +11:00
parent 656701746a
commit de42aa13f3
293 changed files with 2875 additions and 2648 deletions

View File

@ -15,10 +15,10 @@
Block block1 = worldserver.getType(this.a.down()).getBlock();
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata) && this.c) {
- worldserver.b(this.a, true);
- worldserver.a(this.a, true, entityvillager);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.a, Blocks.AIR.getBlockData()).isCancelled()) {
+ worldserver.b(this.a, true);
+ worldserver.a(this.a, true, entityvillager);
+ }
+ // CraftBukkit end
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BehaviorMakeLove.java
+++ b/net/minecraft/server/BehaviorMakeLove.java
@@ -99,6 +99,11 @@
@@ -100,6 +100,11 @@
private Optional<EntityVillager> a(EntityVillager entityvillager, EntityVillager entityvillager1) {
EntityVillager entityvillager2 = entityvillager.createChild(entityvillager1);
@ -12,16 +12,16 @@
if (entityvillager2 == null) {
return Optional.empty();
@@ -107,7 +112,7 @@
@@ -108,7 +113,7 @@
entityvillager1.setAgeRaw(6000);
entityvillager2.setAgeRaw(-24000);
entityvillager2.setPositionRotation(entityvillager.locX, entityvillager.locY, entityvillager.locZ, 0.0F, 0.0F);
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);
return Optional.of(entityvillager2);
}
@@ -116,6 +121,6 @@
@@ -117,6 +122,6 @@
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
GlobalPos globalpos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition);

View File

@ -21,8 +21,8 @@
public static void a(EntityLiving entityliving, ItemStack itemstack, EntityLiving entityliving1) {
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot
double d0 = entityliving.locY - 0.30000001192092896D + (double) entityliving.getHeadHeight();
EntityItem entityitem = new EntityItem(entityliving.world, entityliving.locX, d0, entityliving.locZ, itemstack);
double d0 = entityliving.getHeadY() - 0.30000001192092896D;
EntityItem entityitem = new EntityItem(entityliving.world, entityliving.locX(), d0, entityliving.locZ(), itemstack);
BlockPosition blockposition = new BlockPosition(entityliving1);
@@ -66,7 +67,7 @@

View File

@ -0,0 +1,35 @@
--- a/net/minecraft/server/BiomeStorage.java
+++ b/net/minecraft/server/BiomeStorage.java
@@ -77,7 +77,7 @@
int[] aint = new int[this.f.length];
for (int i = 0; i < this.f.length; ++i) {
- aint[i] = IRegistry.BIOME.a((Object) this.f[i]);
+ aint[i] = IRegistry.BIOME.a(this.f[i]); // CraftBukkit - decompile error
}
return aint;
@@ -90,7 +90,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
}
}
@@ -107,4 +107,14 @@
return this.f[i1 << BiomeStorage.d + BiomeStorage.d | j1 << BiomeStorage.d | l];
}
+
+ // CraftBukkit start
+ public void setBiome(int i, int j, int k, BiomeBase biome) {
+ int l = i & BiomeStorage.b;
+ int i1 = MathHelper.clamp(j, 0, BiomeStorage.c);
+ int j1 = k & BiomeStorage.b;
+
+ this.f[i1 << BiomeStorage.d + BiomeStorage.d | j1 << BiomeStorage.d | l] = biome;
+ }
+ // CraftBukkit end
}

View File

@ -1,16 +1,6 @@
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
@@ -434,7 +434,8 @@
}
public static List<ItemStack> getDrops(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, @Nullable TileEntity tileentity, Entity entity, ItemStack itemstack) {
- LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).a(worldserver.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, itemstack).set(LootContextParameters.THIS_ENTITY, entity).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
+ // CraftBukkit - make entity optional
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).a(worldserver.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, itemstack).setOptional(LootContextParameters.THIS_ENTITY, entity).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
return iblockdata.a(loottableinfo_builder);
}
@@ -488,7 +489,13 @@
@@ -489,7 +489,13 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
entityitem.defaultPickupDelay();
@ -25,8 +15,8 @@
}
}
@@ -685,6 +692,12 @@
return block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL;
@@ -682,6 +688,12 @@
return "Block{" + IRegistry.BLOCK.getKey(this) + "}";
}
+ // CraftBukkit start

View File

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

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockBambooSapling.java
+++ b/net/minecraft/server/BlockBambooSapling.java
@@ -74,6 +74,6 @@
@@ -69,6 +69,6 @@
}
protected void a(World world, BlockPosition blockposition) {

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockBed.java
+++ b/net/minecraft/server/BlockBed.java
@@ -42,12 +42,22 @@
@@ -43,7 +43,8 @@
}
}
@ -8,8 +8,11 @@
+ // CraftBukkit - moved world and biome check into EntityHuman
+ if (true || world.worldProvider.canRespawn() && world.getBiome(blockposition) != Biomes.NETHER) {
if ((Boolean) iblockdata.get(BlockBed.OCCUPIED)) {
entityhuman.a((IChatBaseComponent) (new ChatMessage("block.minecraft.bed.occupied", new Object[0])), true);
return true;
if (!this.a(world, blockposition)) {
entityhuman.a((IChatBaseComponent) (new ChatMessage("block.minecraft.bed.occupied", new Object[0])), true);
@@ -51,7 +52,16 @@
return EnumInteractionResult.SUCCESS;
} else {
+ // CraftBukkit start
+ IBlockData finaliblockdata = iblockdata;
@ -24,28 +27,28 @@
if (entityhuman_enumbedresult != null) {
entityhuman.a(entityhuman_enumbedresult.a(), true);
}
@@ -55,7 +65,14 @@
@@ -59,7 +69,14 @@
});
return true;
return EnumInteractionResult.SUCCESS;
}
+ // CraftBukkit start - moved bed explosion into separate method
} else {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
+ }
+ }
+
+ private boolean explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
world.a(blockposition, false);
BlockPosition blockposition1 = blockposition.shift(((EnumDirection) iblockdata.get(BlockBed.FACING)).opposite());
@@ -65,8 +82,7 @@
@@ -69,8 +86,7 @@
world.createExplosion((Entity) null, DamageSource.a(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
return true;
return EnumInteractionResult.SUCCESS;
- }
- }
+ // CraftBukkit end
}
@Override
private boolean a(World world, BlockPosition blockposition) {

View File

@ -14,7 +14,7 @@
public static final BlockStateBoolean POWERED = BlockProperties.w;
@@ -71,6 +76,19 @@
if ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)) {
return true;
return EnumInteractionResult.CONSUME;
} else {
+ // CraftBukkit start
+ boolean powered = ((Boolean) iblockdata.get(POWERED));
@ -26,30 +26,30 @@
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, true), 3);
this.d(iblockdata, world, blockposition);
this.a(entityhuman, world, blockposition, true);
this.e(iblockdata, world, blockposition);
@@ -117,6 +135,16 @@
return EnumInteractionResult.SUCCESS;
@@ -121,6 +139,16 @@
if (this.D) {
this.d(iblockdata, world, blockposition);
this.e(iblockdata, (World) worldserver, blockposition);
} else {
+ // CraftBukkit start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+ worldserver.getServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() > 0) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, false), 3);
this.e(iblockdata, world, blockposition);
this.a((EntityHuman) null, world, blockposition, false);
@@ -137,7 +165,44 @@
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, false), 3);
this.f(iblockdata, worldserver, blockposition);
this.a((EntityHuman) null, worldserver, blockposition, false);
@@ -141,7 +169,44 @@
boolean flag = !list.isEmpty();
boolean flag1 = (Boolean) iblockdata.get(BlockButtonAbstract.POWERED);
@ -92,5 +92,5 @@
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockButtonAbstract.POWERED, flag), 3);
this.e(iblockdata, world, blockposition);
this.f(iblockdata, world, blockposition);
this.a((EntityHuman) null, world, blockposition, flag);

View File

@ -13,12 +13,12 @@
int j = (Integer) iblockdata.get(BlockCactus.AGE);
if (j == 15) {
- world.setTypeUpdate(blockposition1, this.getBlockData());
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.getBlockData()); // CraftBukkit
- worldserver.setTypeUpdate(blockposition1, this.getBlockData());
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.getBlockData()); // CraftBukkit
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockCactus.AGE, 0);
world.setTypeAndData(blockposition, iblockdata1, 4);
@@ -95,7 +97,9 @@
worldserver.setTypeAndData(blockposition, iblockdata1, 4);
@@ -90,7 +92,9 @@
@Override
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {

View File

@ -1,7 +1,7 @@
--- a/net/minecraft/server/BlockCake.java
+++ b/net/minecraft/server/BlockCake.java
@@ -31,7 +31,18 @@
return false;
@@ -37,7 +37,18 @@
return EnumInteractionResult.PASS;
} else {
entityhuman.a(StatisticList.EAT_CAKE_SLICE);
- entityhuman.getFoodData().eat(2, 0.1F);

View File

@ -1,14 +1,14 @@
--- a/net/minecraft/server/BlockCampfire.java
+++ b/net/minecraft/server/BlockCampfire.java
@@ -142,6 +142,11 @@
if (entityarrow.isBurning() && !(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) {
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
@@ -148,6 +148,11 @@
if (flag1 && !(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) {
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, entityarrow).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true), 11);
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, entity).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true), 11);
}
}
}

View File

@ -8,10 +8,10 @@
public class BlockCauldron extends Block {
public static final BlockStateInteger LEVEL = BlockProperties.al;
@@ -32,8 +34,13 @@
@@ -27,8 +29,13 @@
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
if (!world.isClientSide && entity.isBurning() && i > 0 && entity.getBoundingBox().minY <= (double) f) {
if (!world.isClientSide && entity.isBurning() && i > 0 && entity.locY() <= (double) f) {
+ // CraftBukkit start
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH)) {
+ return;
@ -23,13 +23,13 @@
}
}
@@ -50,18 +57,27 @@
@@ -45,18 +52,27 @@
if (item == Items.WATER_BUCKET) {
if (i < 3 && !world.isClientSide) {
+ // CraftBukkit start
+ if (!this.changeLevel(world, blockposition, iblockdata, 3, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
if (!entityhuman.abilities.canInstantlyBuild) {
entityhuman.a(enumhand, new ItemStack(Items.BUCKET));
@ -42,17 +42,17 @@
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
return true;
return EnumInteractionResult.SUCCESS;
} else if (item == Items.BUCKET) {
if (i == 3 && !world.isClientSide) {
+ // CraftBukkit start
+ if (!this.changeLevel(world, blockposition, iblockdata, 0, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
if (itemstack.isEmpty()) {
@@ -72,7 +88,8 @@
@@ -67,7 +83,8 @@
}
entityhuman.a(StatisticList.USE_CAULDRON);
@ -62,18 +62,18 @@
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
@@ -82,6 +99,10 @@
@@ -77,6 +94,10 @@
if (item == Items.GLASS_BOTTLE) {
if (i > 0 && !world.isClientSide) {
+ // CraftBukkit start
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack1 = PotionUtil.a(new ItemStack(Items.POTION), Potions.WATER);
entityhuman.a(StatisticList.USE_CAULDRON);
@@ -96,12 +117,17 @@
@@ -91,12 +112,17 @@
}
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
@ -82,17 +82,17 @@
+ // CraftBukkit end
}
return true;
return EnumInteractionResult.SUCCESS;
} else if (item == Items.POTION && PotionUtil.d(itemstack) == Potions.WATER) {
if (i < 3 && !world.isClientSide) {
+ // CraftBukkit start
+ if (!this.changeLevel(world, blockposition, iblockdata, i + 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack1 = new ItemStack(Items.GLASS_BOTTLE);
entityhuman.a(StatisticList.USE_CAULDRON);
@@ -112,7 +138,8 @@
@@ -107,7 +133,8 @@
}
world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
@ -101,29 +101,29 @@
+ // CraftBukkit end
}
return true;
@@ -121,8 +148,13 @@
return EnumInteractionResult.SUCCESS;
@@ -116,8 +143,13 @@
IDyeable idyeable = (IDyeable) item;
if (idyeable.a(itemstack) && !world.isClientSide) {
+ // CraftBukkit start
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
idyeable.c(itemstack);
- this.a(world, blockposition, iblockdata, i - 1);
+ // this.a(world, blockposition, iblockdata, i - 1);
+ // CraftBukkit end
entityhuman.a(StatisticList.CLEAN_ARMOR);
return true;
return EnumInteractionResult.SUCCESS;
}
@@ -130,13 +162,18 @@
@@ -125,13 +157,18 @@
if (i > 0 && item instanceof ItemBanner) {
if (TileEntityBanner.a(itemstack) > 0 && !world.isClientSide) {
+ // CraftBukkit start
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
itemstack1 = itemstack.cloneItemStack();
itemstack1.setCount(1);
@ -137,7 +137,7 @@
}
if (itemstack.isEmpty()) {
@@ -173,9 +210,25 @@
@@ -169,9 +206,25 @@
}
}
@ -164,7 +164,7 @@
}
@Override
@@ -187,7 +240,7 @@
@@ -183,7 +236,7 @@
IBlockData iblockdata = world.getType(blockposition);
if ((Integer) iblockdata.get(BlockCauldron.LEVEL) < 3) {

View File

@ -1,10 +1,10 @@
--- a/net/minecraft/server/BlockChest.java
+++ b/net/minecraft/server/BlockChest.java
@@ -30,24 +30,7 @@
public ITileInventory b(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
@@ -35,24 +35,7 @@
public Optional<ITileInventory> a(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
- return new ITileInventory() {
- return Optional.of(new ITileInventory() {
- @Nullable
- @Override
- public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
@ -21,12 +21,12 @@
- public IChatBaseComponent getScoreboardDisplayName() {
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0])));
- }
- };
+ return new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest); // CraftBukkit
- });
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit
}
@Override
@@ -56,6 +39,38 @@
public Optional<ITileInventory> a(TileEntityChest tileentitychest) {
@@ -65,6 +48,38 @@
}
};
@ -62,6 +62,15 @@
+ };
+ // CraftBukkit end
+
protected BlockChest(Block.Info block_info) {
super(block_info);
this.o((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.b, BlockPropertyChestType.SINGLE)).set(BlockChest.c, false));
protected BlockChest(Block.Info block_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
super(block_info, supplier);
this.p((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.blockStateList.getBlockData()).set(BlockChest.FACING, EnumDirection.NORTH)).set(BlockChest.c, BlockPropertyChestType.SINGLE)).set(BlockChest.d, false));
@@ -217,7 +232,7 @@
}
public DoubleBlockFinder.Result<? extends TileEntityChest> a(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
- BiPredicate bipredicate;
+ BiPredicate<GeneratorAccess, BlockPosition> bipredicate; // CraftBukkit - decompile error
if (flag) {
bipredicate = (generatoraccess, blockposition1) -> {

View File

@ -12,13 +12,13 @@
@@ -58,8 +60,12 @@
}
if (flag && b((IWorldReader) world, blockposition1, (EnumDirection) null) && world.isEmpty(blockposition.up(2))) {
- world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
- this.b(world, blockposition1, i);
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);
+ // CraftBukkit start - add event
+ if (CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
+ world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
+ this.b(world, blockposition1, i);
+ 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);
+ }
+ // CraftBukkit end
} else if (i < 4) {
@ -27,12 +27,12 @@
@@ -73,18 +79,30 @@
BlockPosition blockposition2 = blockposition.shift(enumdirection);
if (world.isEmpty(blockposition2) && world.isEmpty(blockposition2.down()) && b((IWorldReader) world, blockposition2, enumdirection.opposite())) {
- this.b(world, blockposition2, i + 1);
if (worldserver.isEmpty(blockposition2) && worldserver.isEmpty(blockposition2.down()) && b((IWorldReader) worldserver, blockposition2, enumdirection.opposite())) {
- this.b(worldserver, blockposition2, i + 1);
- flag2 = true;
+ // CraftBukkit start - add event
+ if (CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) {
+ this.b(world, blockposition2, i + 1);
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) {
+ this.b(worldserver, blockposition2, i + 1);
+ flag2 = true;
+ }
+ // CraftBukkit end
@ -40,20 +40,20 @@
}
if (flag2) {
world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
worldserver.setTypeAndData(blockposition, this.b.a((IBlockAccess) worldserver, blockposition), 2);
} else {
- this.a(world, blockposition);
- this.a((World) worldserver, blockposition);
+ // CraftBukkit - add event
+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
+ this.a(world, blockposition);
+ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
+ this.a((World) worldserver, blockposition);
+ }
+ // CraftBukkit end
}
} else {
- this.a(world, blockposition);
- this.a((World) worldserver, blockposition);
+ // CraftBukkit - add event
+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
+ this.a(world, blockposition);
+ if (CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
+ this.a((World) worldserver, blockposition);
+ }
+ // CraftBukkit end
}

View File

@ -13,17 +13,17 @@
int i = (Integer) iblockdata.get(BlockCocoa.AGE);
if (i < 2) {
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2); // CraftBukkkit
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, i + 1), 2); // CraftBukkkit
}
}
@@ -92,7 +94,7 @@
@Override
public void b(World world, Random random, BlockPosition blockposition, IBlockData iblockdata) {
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2); // CraftBukkit
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockCocoa.AGE, (Integer) iblockdata.get(BlockCocoa.AGE) + 1), 2); // CraftBukkit
}
@Override

View File

@ -24,4 +24,4 @@
+ // CraftBukkit end
tileentitycommand.a(flag1);
if (!flag2 && !tileentitycommand.g() && tileentitycommand.u() != TileEntityCommand.Type.SEQUENCE) {
if (!flag2 && !tileentitycommand.g() && tileentitycommand.m() != TileEntityCommand.Type.SEQUENCE) {

View File

@ -2,13 +2,13 @@
+++ b/net/minecraft/server/BlockCoral.java
@@ -15,6 +15,11 @@
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!this.a((IBlockAccess) world, blockposition)) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!this.a((IBlockAccess) worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.a.getBlockData()).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, this.a.getBlockData(), 2);
worldserver.setTypeAndData(blockposition, this.a.getBlockData(), 2);
}

View File

@ -2,13 +2,13 @@
+++ b/net/minecraft/server/BlockCoralFan.java
@@ -19,6 +19,11 @@
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, world, blockposition)) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.a.getBlockData().set(BlockCoralFan.b, false)).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.a.getBlockData().set(BlockCoralFan.b, false)).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) this.a.getBlockData().set(BlockCoralFan.b, false), 2);
worldserver.setTypeAndData(blockposition, (IBlockData) this.a.getBlockData().set(BlockCoralFan.b, false), 2);
}

View File

@ -2,13 +2,13 @@
+++ b/net/minecraft/server/BlockCoralFanWall.java
@@ -19,6 +19,11 @@
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, world, blockposition)) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, false).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralFanWall.b, false).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a))).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.b, false)).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a)), 2);
worldserver.setTypeAndData(blockposition, (IBlockData) ((IBlockData) this.c.getBlockData().set(BlockCoralFanWall.b, false)).set(BlockCoralFanWall.a, iblockdata.get(BlockCoralFanWall.a)), 2);
}

View File

@ -2,13 +2,13 @@
+++ b/net/minecraft/server/BlockCoralPlant.java
@@ -20,6 +20,11 @@
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, world, blockposition)) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!b_(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, this.c.getBlockData().set(BlockCoralPlant.b, false)).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.c.getBlockData().set(BlockCoralPlant.b, false)).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) this.c.getBlockData().set(BlockCoralPlant.b, false), 2);
worldserver.setTypeAndData(blockposition, (IBlockData) this.c.getBlockData().set(BlockCoralPlant.b, false), 2);
}

View File

@ -10,11 +10,11 @@
public static final BlockStateInteger AGE = BlockProperties.ac;
@@ -52,7 +54,7 @@
float f = a((Block) this, (IBlockAccess) world, blockposition);
float f = a((Block) this, (IBlockAccess) worldserver, blockposition);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
- world.setTypeAndData(blockposition, this.setAge(i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.setAge(i + 1), 2); // CraftBukkit
- worldserver.setTypeAndData(blockposition, this.setAge(i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.setAge(i + 1), 2); // CraftBukkit
}
}
}
@ -33,6 +33,6 @@
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
- if (entity instanceof EntityRavager && world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
+ if (entity instanceof EntityRavager && !CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData(), !world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) { // CraftBukkit
world.b(blockposition, true);
world.a(blockposition, true, entity);
}

View File

@ -10,21 +10,21 @@
protected static final VoxelShape b = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
@@ -28,8 +30,18 @@
boolean flag1 = this.a(world, blockposition, iblockdata);
boolean flag1 = this.a((World) worldserver, blockposition, iblockdata);
if (flag && !flag1) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, false), 2);
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, false), 2);
} else if (!flag) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, true), 2);
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockDiodeAbstract.c, true), 2);
if (!flag1) {
world.getBlockTickList().a(blockposition, this, this.j(iblockdata), TickListPriority.HIGH);
worldserver.getBlockTickList().a(blockposition, this, this.h(iblockdata), TickListPriority.VERY_HIGH);

View File

@ -1,23 +1,23 @@
--- a/net/minecraft/server/BlockDirtSnowSpreadable.java
+++ b/net/minecraft/server/BlockDirtSnowSpreadable.java
@@ -31,6 +31,11 @@
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!world.isClientSide) {
if (!b(iblockdata, (IWorldReader) world, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
} else {
if (world.getLightLevel(blockposition.up()) >= 9) {
@@ -40,7 +45,7 @@
BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
@@ -30,6 +30,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!b(iblockdata, (IWorldReader) worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
} else {
if (worldserver.getLightLevel(blockposition.up()) >= 9) {
@@ -39,7 +44,7 @@
BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
if (world.getType(blockposition1).getBlock() == Blocks.DIRT && c(iblockdata1, (IWorldReader) world, blockposition1)) {
- world.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, world.getType(blockposition1.up()).getBlock() == Blocks.SNOW));
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, world.getType(blockposition1.up()).getBlock() == Blocks.SNOW)); // CraftBukkit
}
if (worldserver.getType(blockposition1).getBlock() == Blocks.DIRT && c(iblockdata1, (IWorldReader) worldserver, blockposition1)) {
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).getBlock() == Blocks.SNOW));
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).getBlock() == Blocks.SNOW)); // CraftBukkit
}
}
}

View File

@ -39,73 +39,73 @@
@Nullable
@@ -82,7 +104,7 @@
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (world.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) {
if (!iblockdata.canPlace(world, blockposition)) {
- world.a(blockposition, false);
+ fireExtinguished(world, blockposition); // CraftBukkit - invalid place location
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (worldserver.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) {
if (!iblockdata.canPlace(worldserver, blockposition)) {
- worldserver.a(blockposition, false);
+ fireExtinguished(worldserver, blockposition); // CraftBukkit - invalid place location
}
Block block = world.getType(blockposition.down()).getBlock();
Block block = worldserver.getType(blockposition.down()).getBlock();
@@ -90,7 +112,7 @@
int i = (Integer) iblockdata.get(BlockFire.AGE);
if (!flag && world.isRaining() && this.a(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
- world.a(blockposition, false);
+ fireExtinguished(world, blockposition); // CraftBukkit - extinguished by rain
if (!flag && worldserver.isRaining() && this.a((World) worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
- worldserver.a(blockposition, false);
+ fireExtinguished(worldserver, blockposition); // CraftBukkit - extinguished by rain
} else {
int j = Math.min(15, i + random.nextInt(3) / 2);
@@ -105,14 +127,14 @@
BlockPosition blockposition1 = blockposition.down();
if (!world.getType(blockposition1).d(world, blockposition1, EnumDirection.UP) || i > 3) {
- world.a(blockposition, false);
+ fireExtinguished(world, blockposition); // CraftBukkit
if (!worldserver.getType(blockposition1).d(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
- worldserver.a(blockposition, false);
+ fireExtinguished(worldserver, blockposition); // CraftBukkit
}
return;
}
if (i == 15 && random.nextInt(4) == 0 && !this.j(world.getType(blockposition.down()))) {
- world.a(blockposition, false);
+ fireExtinguished(world, blockposition); // CraftBukkit
if (i == 15 && random.nextInt(4) == 0 && !this.h(worldserver.getType(blockposition.down()))) {
- worldserver.a(blockposition, false);
+ fireExtinguished(worldserver, blockposition); // CraftBukkit
return;
}
}
@@ -120,12 +142,14 @@
boolean flag1 = world.s(blockposition);
boolean flag1 = worldserver.s(blockposition);
int k = flag1 ? -50 : 0;
- this.a(world, blockposition.east(), 300 + k, random, i);
- this.a(world, blockposition.west(), 300 + k, random, i);
- this.a(world, blockposition.down(), 250 + k, random, i);
- this.a(world, blockposition.up(), 250 + k, random, i);
- this.a(world, blockposition.north(), 300 + k, random, i);
- this.a(world, blockposition.south(), 300 + k, random, i);
- this.a(worldserver, blockposition.east(), 300 + k, random, i);
- this.a(worldserver, blockposition.west(), 300 + k, random, i);
- this.a(worldserver, blockposition.down(), 250 + k, random, i);
- this.a(worldserver, blockposition.up(), 250 + k, random, i);
- this.a(worldserver, blockposition.north(), 300 + k, random, i);
- this.a(worldserver, blockposition.south(), 300 + k, random, i);
+ // CraftBukkit start - add source blockposition to burn calls
+ this.a(world, blockposition.east(), 300 + k, random, i, blockposition);
+ this.a(world, blockposition.west(), 300 + k, random, i, blockposition);
+ this.a(world, blockposition.down(), 250 + k, random, i, blockposition);
+ this.a(world, blockposition.up(), 250 + k, random, i, blockposition);
+ this.a(world, blockposition.north(), 300 + k, random, i, blockposition);
+ this.a(world, blockposition.south(), 300 + k, random, i, blockposition);
+ this.a(worldserver, blockposition.east(), 300 + k, random, i, blockposition);
+ this.a(worldserver, blockposition.west(), 300 + k, random, i, blockposition);
+ this.a(worldserver, blockposition.down(), 250 + k, random, i, blockposition);
+ this.a(worldserver, blockposition.up(), 250 + k, random, i, blockposition);
+ this.a(worldserver, blockposition.north(), 300 + k, random, i, blockposition);
+ this.a(worldserver, blockposition.south(), 300 + k, random, i, blockposition);
+ // CraftBukkit end
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
for (int l = -1; l <= 1; ++l) {
@@ -151,7 +175,15 @@
if (i2 > 0 && random.nextInt(k1) <= i2 && (!world.isRaining() || !this.a(world, (BlockPosition) blockposition_mutableblockposition))) {
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);
- world.setTypeAndData(blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) world, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3);
- worldserver.setTypeAndData(blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) worldserver, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3);
+ // CraftBukkit start - Call to stop spread of fire
+ if (world.getType(blockposition_mutableblockposition).getBlock() != Blocks.FIRE) {
+ if (CraftEventFactory.callBlockIgniteEvent(world, blockposition_mutableblockposition, blockposition).isCancelled()) {
+ if (worldserver.getType(blockposition_mutableblockposition).getBlock() != Blocks.FIRE) {
+ if (CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition_mutableblockposition, blockposition).isCancelled()) {
+ continue;
+ }
+
+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) world, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3); // CraftBukkit
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition_mutableblockposition, (IBlockData) this.a((IBlockAccess) worldserver, (BlockPosition) blockposition_mutableblockposition).set(BlockFire.AGE, j2), 3); // CraftBukkit
+ }
+ // CraftBukkit end
}
@ -117,7 +117,7 @@
- private void a(World world, BlockPosition blockposition, int i, Random random, int j) {
+ private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
int k = this.q(world.getType(blockposition));
int k = this.i(world.getType(blockposition));
if (random.nextInt(i) < k) {
IBlockData iblockdata = world.getType(blockposition);
@ -150,9 +150,9 @@
} else {
world.getBlockTickList().a(blockposition, this, this.a((IWorldReader) world) + world.random.nextInt(10));
}
@@ -395,4 +440,12 @@
blockfire.a(Blocks.COMPOSTER, 5, 20);
blockfire.a(Blocks.SWEET_BERRY_BUSH, 60, 100);
@@ -392,4 +437,12 @@
blockfire.a(Blocks.BEEHIVE, 5, 20);
blockfire.a(Blocks.BEE_NEST, 30, 20);
}
+
+ // CraftBukkit start

View File

@ -1,11 +1,11 @@
--- a/net/minecraft/server/BlockGrass.java
+++ b/net/minecraft/server/BlockGrass.java
@@ -61,7 +61,7 @@
@@ -63,7 +63,7 @@
}
if (iblockdata3.canPlace(world, blockposition2)) {
- world.setTypeAndData(blockposition2, iblockdata3, 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition2, iblockdata3, 3); // CraftBukkit
if (iblockdata3.canPlace(worldserver, blockposition2)) {
- worldserver.setTypeAndData(blockposition2, iblockdata3, 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition2, iblockdata3, 3); // CraftBukkit
}
}
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockIce.java
+++ b/net/minecraft/server/BlockIce.java
@@ -41,6 +41,11 @@
@@ -36,6 +36,11 @@
}
protected void melt(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@ -1,11 +1,11 @@
--- a/net/minecraft/server/BlockKelp.java
+++ b/net/minecraft/server/BlockKelp.java
@@ -49,7 +49,7 @@
IBlockData iblockdata1 = world.getType(blockposition1);
@@ -44,7 +44,7 @@
IBlockData iblockdata1 = worldserver.getType(blockposition1);
if (iblockdata1.getBlock() == Blocks.WATER && (Integer) iblockdata.get(BlockKelp.a) < 25 && random.nextDouble() < 0.14D) {
- world.setTypeUpdate(blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a));
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a)); // CraftBukkit
- worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a));
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata.a((IBlockState) BlockKelp.a)); // CraftBukkit
}
}

View File

@ -9,18 +9,18 @@
public class BlockLeaves extends Block {
public static final BlockStateInteger DISTANCE = BlockProperties.ah;
@@ -21,6 +23,14 @@
@@ -20,6 +22,14 @@
@Override
public void c(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
public void b(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getServer().getPluginManager().callEvent(event);
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ worldserver.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled() || world.getType(blockposition).getBlock() != this) {
+ if (event.isCancelled() || worldserver.getType(blockposition).getBlock() != this) {
+ return;
+ }
+ // CraftBukkit end
c(iblockdata, world, blockposition);
world.a(blockposition, false);
c(iblockdata, (World) worldserver, blockposition);
worldserver.a(blockposition, false);
}

View File

@ -10,10 +10,10 @@
public static final BlockStateBoolean POWERED = BlockProperties.w;
@@ -64,6 +66,20 @@
return true;
return EnumInteractionResult.SUCCESS;
} else {
+ // CraftBukkit start - Interact Lever
+ boolean powered = !flag; // Old powered state
+ boolean powered = iblockdata.get(BlockLever.POWERED); // Old powered state
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = (powered) ? 15 : 0;
+ int current = (!powered) ? 15 : 0;
@ -22,10 +22,10 @@
+ world.getServer().getPluginManager().callEvent(eventRedstone);
+
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
+ return true;
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
+
world.setTypeAndData(blockposition, iblockdata, 3);
float f = flag ? 0.6F : 0.5F;
iblockdata1 = this.d(iblockdata, world, blockposition);
float f = (Boolean) iblockdata1.get(BlockLever.POWERED) ? 0.6F : 0.5F;

View File

@ -14,20 +14,28 @@
@@ -45,7 +49,7 @@
}
if (world.isEmpty(blockposition2) && iblockdata.canPlace(world, blockposition2)) {
- world.setTypeAndData(blockposition2, iblockdata, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, iblockdata, 2); // CraftBukkit
if (worldserver.isEmpty(blockposition2) && iblockdata.canPlace(worldserver, blockposition2)) {
- worldserver.setTypeAndData(blockposition2, iblockdata, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata, 2); // CraftBukkit
}
}
@@ -70,8 +74,10 @@
WorldGenerator<WorldGenHugeMushroomConfiguration> worldgenerator = null;
@@ -70,14 +74,16 @@
WorldGenFeatureConfigured worldgenfeatureconfigured;
if (this == Blocks.BROWN_MUSHROOM) {
- worldgenfeatureconfigured = WorldGenerator.HUGE_BROWN_MUSHROOM.b((WorldGenFeatureConfiguration) BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM);
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
worldgenerator = WorldGenerator.HUGE_BROWN_MUSHROOM;
} else if (this == Blocks.RED_MUSHROOM) {
+ worldgenfeatureconfigured = WorldGenerator.HUGE_BROWN_MUSHROOM.b(BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM); // CraftBukkit - decompile error
} else {
if (this != Blocks.RED_MUSHROOM) {
worldserver.setTypeAndData(blockposition, iblockdata, 3);
return false;
}
- worldgenfeatureconfigured = WorldGenerator.HUGE_RED_MUSHROOM.b((WorldGenFeatureConfiguration) BiomeDecoratorGroups.HUGE_RED_MUSHROOM);
+ BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
worldgenerator = WorldGenerator.HUGE_RED_MUSHROOM;
+ worldgenfeatureconfigured = WorldGenerator.HUGE_RED_MUSHROOM.b(BiomeDecoratorGroups.HUGE_RED_MUSHROOM); // CraftBukkit - decompile error
}
if (worldgenfeatureconfigured.a(worldserver, worldserver.getChunkProvider().getChunkGenerator(), random, blockposition)) {

View File

@ -4,8 +4,8 @@
if (i < 3 && random.nextInt(10) == 0) {
iblockdata = (IBlockData) iblockdata.set(BlockNetherWart.AGE, i + 1);
- world.setTypeAndData(blockposition, iblockdata, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata, 2); // CraftBukkit
- worldserver.setTypeAndData(blockposition, iblockdata, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
}
super.tick(iblockdata, world, blockposition, random);
super.tick(iblockdata, worldserver, blockposition, random);

View File

@ -33,7 +33,7 @@
- this.play(world, blockposition);
+ this.play(world, blockposition, iblockdata); // CraftBukkit
entityhuman.a(StatisticList.TUNE_NOTEBLOCK);
return true;
return EnumInteractionResult.SUCCESS;
}
@@ -58,7 +63,7 @@
@Override

View File

@ -11,20 +11,20 @@
public static final BlockStateBoolean b = BlockProperties.w;
@@ -29,8 +31,18 @@
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if ((Boolean) iblockdata.get(BlockObserver.b)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, false), 2);
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, false), 2);
} else {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, true), 2);
world.getBlockTickList().a(blockposition, this, 2);
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockObserver.b, true), 2);
worldserver.getBlockTickList().a(blockposition, this, 2);
}

View File

@ -1,8 +1,8 @@
--- a/net/minecraft/server/BlockPiston.java
+++ b/net/minecraft/server/BlockPiston.java
@@ -6,6 +6,14 @@
import java.util.List;
import java.util.Set;
@@ -7,6 +7,14 @@
import java.util.Map;
import java.util.Map.Entry;
+// CraftBukkit start
+import com.google.common.collect.ImmutableList;
@ -15,7 +15,7 @@
public class BlockPiston extends BlockDirectional {
public static final BlockStateBoolean EXTENDED = BlockProperties.g;
@@ -112,6 +120,18 @@
@@ -113,6 +121,18 @@
}
}
@ -31,13 +31,13 @@
+ }
+ // PAIL: checkME - what happened to setTypeAndData?
+ // CraftBukkit end
world.playBlockAction(blockposition, this, b0, enumdirection.a());
world.playBlockAction(blockposition, this, b0, enumdirection.b());
}
@@ -281,6 +301,48 @@
@@ -284,6 +304,48 @@
int j = list.size() + list2.size();
IBlockData[] aiblockdata = new IBlockData[j];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
Set<BlockPosition> set = Sets.newHashSet(list);
+ // CraftBukkit start
+ final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+

View File

@ -17,13 +17,13 @@
@@ -34,7 +41,8 @@
}
if (world.getType(blockposition).a((IBlockAccess) world, blockposition, EntityTypes.ZOMBIE_PIGMAN)) {
- Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(world, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false);
if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIE_PIGMAN)) {
- Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false);
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
+ Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(world, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
+ Entity entity = EntityTypes.ZOMBIE_PIGMAN.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.aX();
entity.portalCooldown = entity.ba();
@@ -48,8 +56,10 @@
BlockPortal.Shape blockportal_shape = this.b(generatoraccess, blockposition);
@ -37,7 +37,7 @@
} else {
return false;
}
@@ -85,6 +95,10 @@
@@ -80,6 +90,10 @@
@Override
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) {
@ -48,7 +48,7 @@
entity.c(blockposition);
}
@@ -177,6 +191,7 @@
@@ -172,6 +186,7 @@
private BlockPosition position;
private int height;
private int width;
@ -56,7 +56,7 @@
public Shape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
this.a = generatoraccess;
@@ -235,6 +250,9 @@
@@ -230,6 +245,9 @@
}
protected int c() {
@ -66,7 +66,7 @@
int i;
label56:
@@ -257,11 +275,21 @@
@@ -252,11 +270,21 @@
block = this.a.getType(blockposition.shift(this.d)).getBlock();
if (block != Blocks.OBSIDIAN) {
break label56;
@ -88,7 +88,7 @@
}
}
}
@@ -271,6 +299,11 @@
@@ -266,6 +294,11 @@
if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) {
this.height = 0;
break;
@ -100,7 +100,7 @@
}
}
@@ -294,7 +327,29 @@
@@ -289,7 +322,29 @@
return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
}
@ -131,7 +131,7 @@
for (int i = 0; i < this.width; ++i) {
BlockPosition blockposition = this.position.shift(this.c, i);
@@ -303,6 +358,7 @@
@@ -298,6 +353,7 @@
}
}

View File

@ -21,4 +21,4 @@
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockPoweredRail.POWERED, flag1), 3);
world.applyPhysics(blockposition.down(), this);
if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {
if (((BlockPropertyTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).b()) {

View File

@ -9,7 +9,7 @@
public abstract class BlockPressurePlateAbstract extends Block {
protected static final VoxelShape a = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
@@ -68,6 +70,19 @@
@@ -66,6 +68,19 @@
boolean flag = i > 0;
boolean flag1 = j > 0;

View File

@ -7,7 +7,7 @@
+
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
public static final BlockStateInteger POWER = BlockProperties.as;
public static final BlockStateInteger POWER = BlockProperties.at;
@@ -13,7 +15,31 @@
@Override

View File

@ -8,8 +8,8 @@
+
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.ay;
@@ -64,7 +66,8 @@
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.az;
@@ -70,7 +72,8 @@
@Nullable
private EntityItemFrame a(World world, EnumDirection enumdirection, BlockPosition blockposition) {
@ -19,7 +19,7 @@
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
});
@@ -119,8 +122,18 @@
@@ -125,8 +128,18 @@
boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.c);
if (flag1 && !flag) {

View File

@ -21,15 +21,15 @@
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
}
}
@@ -48,6 +55,11 @@
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (!world.isClientSide) {
if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !world.isBlockIndirectlyPowered(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
}
@@ -47,6 +54,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if ((Boolean) iblockdata.get(BlockRedstoneLamp.a) && !worldserver.isBlockIndirectlyPowered(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.a((IBlockState) BlockRedstoneLamp.a), 2);
}

View File

@ -12,7 +12,7 @@
public class BlockRedstoneOre extends Block {
public static final BlockStateBoolean a = BlockRedstoneTorch.LIT;
@@ -18,25 +23,46 @@
@@ -18,14 +23,30 @@
@Override
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
@ -46,10 +46,14 @@
}
@Override
public boolean interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
- interact(iblockdata, world, blockposition);
+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman
return super.interact(iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock);
@@ -34,14 +55,19 @@
playEffect(world, blockposition);
return EnumInteractionResult.SUCCESS;
} else {
- interact(iblockdata, world, blockposition);
+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman
return EnumInteractionResult.PASS;
}
}
- private static void interact(IBlockData iblockdata, World world, BlockPosition blockposition) {
@ -64,19 +68,19 @@
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, true), 3);
}
@@ -45,6 +71,11 @@
@@ -50,6 +76,11 @@
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if ((Boolean) iblockdata.get(BlockRedstoneOre.a)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, iblockdata.set(BlockRedstoneOre.a, false)).isCancelled()) {
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.set(BlockRedstoneOre.a, false)).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, false), 3);
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneOre.a, false), 3);
}
@@ -53,14 +84,27 @@
@@ -58,12 +89,25 @@
@Override
public void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
super.dropNaturally(iblockdata, world, blockposition, itemstack);
@ -87,8 +91,8 @@
this.dropExperience(world, blockposition, i);
}
+ // */
}
+
+ }
+ @Override
+ public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
@ -99,8 +103,6 @@
+ }
+ return 0;
+ // CraftBukkit end
+ }
+
}
private static void playEffect(World world, BlockPosition blockposition) {
double d0 = 0.5625D;
Random random = world.random;

View File

@ -4,8 +4,8 @@
int j = (Integer) iblockdata.get(BlockReed.AGE);
if (j == 15) {
- world.setTypeUpdate(blockposition.up(), this.getBlockData());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, blockposition.up(), this.getBlockData()); // CraftBukkit
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, 0), 4);
- worldserver.setTypeUpdate(blockposition.up(), this.getBlockData());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition.up(), this.getBlockData()); // CraftBukkit
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, 0), 4);
} else {
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, j + 1), 4);
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockReed.AGE, j + 1), 4);

View File

@ -15,7 +15,7 @@
+
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
public static final BlockStateInteger STAGE = BlockProperties.at;
public static final BlockStateInteger STAGE = BlockProperties.au;
protected static final VoxelShape b = Block.a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
private final WorldGenTreeProvider c;
+ public static TreeType treeType; // CraftBukkit
@ -23,21 +23,21 @@
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, Block.Info block_info) {
super(block_info);
@@ -23,7 +33,30 @@
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
super.tick(iblockdata, world, blockposition, random);
if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
super.tick(iblockdata, worldserver, blockposition, random);
if (worldserver.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
+ // CraftBukkit start
+ world.captureTreeGeneration = true;
+ worldserver.captureTreeGeneration = true;
+ // CraftBukkit end
this.grow(world, blockposition, iblockdata, random);
this.grow(worldserver, blockposition, iblockdata, random);
+ // CraftBukkit start
+ world.captureTreeGeneration = false;
+ if (world.capturedBlockStates.size() > 0) {
+ worldserver.captureTreeGeneration = false;
+ if (worldserver.capturedBlockStates.size() > 0) {
+ TreeType treeType = BlockSapling.treeType;
+ BlockSapling.treeType = null;
+ Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ List<BlockState> blocks = (List<BlockState>) world.capturedBlockStates.clone();
+ world.capturedBlockStates.clear();
+ Location location = new Location(worldserver.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ List<BlockState> blocks = (List<BlockState>) worldserver.capturedBlockStates.clone();
+ worldserver.capturedBlockStates.clear();
+ StructureGrowEvent event = null;
+ if (treeType != null) {
+ event = new StructureGrowEvent(location, treeType, false, null, blocks);

View File

@ -1,11 +1,11 @@
--- a/net/minecraft/server/BlockScaffolding.java
+++ b/net/minecraft/server/BlockScaffolding.java
@@ -78,7 +78,7 @@
int i = a((IBlockAccess) world, blockposition);
IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.set(BlockScaffolding.a, i)).set(BlockScaffolding.c, this.a(world, blockposition, i));
@@ -73,7 +73,7 @@
int i = a((IBlockAccess) worldserver, blockposition);
IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.set(BlockScaffolding.a, i)).set(BlockScaffolding.c, this.a(worldserver, blockposition, i));
- if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7) {
+ if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - BlockFadeEvent
+ if ((Integer) iblockdata1.get(BlockScaffolding.a) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit - BlockFadeEvent
if ((Integer) iblockdata.get(BlockScaffolding.a) == 7) {
world.addEntity(new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.set(BlockScaffolding.b, false)));
worldserver.addEntity(new EntityFallingBlock(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (IBlockData) iblockdata1.set(BlockScaffolding.b, false)));
} else {

View File

@ -2,13 +2,13 @@
+++ b/net/minecraft/server/BlockSnow.java
@@ -58,6 +58,11 @@
@Override
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (world.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
c(iblockdata, world, blockposition);
world.a(blockposition, false);
c(iblockdata, (World) worldserver, blockposition);
worldserver.a(blockposition, false);
}

View File

@ -11,19 +11,19 @@
+
public class BlockSoil extends Block {
public static final BlockStateInteger MOISTURE = BlockProperties.ap;
public static final BlockStateInteger MOISTURE = BlockProperties.aq;
@@ -53,12 +58,12 @@
if (!a((IWorldReader) world, blockposition) && !world.isRainingAt(blockposition.up())) {
if (!a((IWorldReader) worldserver, blockposition) && !worldserver.isRainingAt(blockposition.up())) {
if (i > 0) {
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit
} else if (!a((IBlockAccess) world, blockposition)) {
fade(iblockdata, world, blockposition);
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit
} else if (!a((IBlockAccess) worldserver, blockposition)) {
fade(iblockdata, worldserver, blockposition);
}
} else if (i < 7) {
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2); // CraftBukkit
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSoil.MOISTURE, 7), 2); // CraftBukkit
}
}

View File

@ -13,29 +13,29 @@
if (i < 7) {
iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, i + 1);
- world.setTypeAndData(blockposition, iblockdata, 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata, 2); // CraftBukkit
- worldserver.setTypeAndData(blockposition, iblockdata, 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
} else {
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random);
BlockPosition blockposition1 = blockposition.shift(enumdirection);
Block block = world.getType(blockposition1.down()).getBlock();
Block block = worldserver.getType(blockposition1.down()).getBlock();
if (world.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) {
- world.setTypeUpdate(blockposition1, this.blockFruit.getBlockData());
if (worldserver.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) {
- worldserver.setTypeUpdate(blockposition1, this.blockFruit.getBlockData());
+ // CraftBukkit start
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.blockFruit.getBlockData())) {
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.blockFruit.getBlockData())) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.e().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
worldserver.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
}
}
@@ -66,7 +72,7 @@
int i = Math.min(7, (Integer) iblockdata.get(BlockStem.AGE) + MathHelper.nextInt(world.random, 2, 5));
int i = Math.min(7, (Integer) iblockdata.get(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockStem.AGE, i);
- world.setTypeAndData(blockposition, iblockdata1, 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata1, 2); // CraftBukkit
- worldserver.setTypeAndData(blockposition, iblockdata1, 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2); // CraftBukkit
if (i == 7) {
iblockdata1.a(world, blockposition, world.random);
iblockdata1.a(worldserver, blockposition, worldserver.random);
}

View File

@ -14,14 +14,14 @@
@@ -24,7 +28,7 @@
int i = (Integer) iblockdata.get(BlockSweetBerryBush.a);
if (i < 3 && random.nextInt(5) == 0 && world.getLightLevel(blockposition.up(), 0) >= 9) {
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2); // CraftBukkit
if (i < 3 && random.nextInt(5) == 0 && worldserver.getLightLevel(blockposition.up(), 0) >= 9) {
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.set(BlockSweetBerryBush.a, i + 1), 2); // CraftBukkit
}
}
@@ -38,7 +42,9 @@
double d1 = Math.abs(entity.locZ - entity.J);
double d1 = Math.abs(entity.locZ() - entity.G);
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BlockTNT.java
+++ b/net/minecraft/server/BlockTNT.java
@@ -93,6 +93,11 @@
@@ -95,6 +95,11 @@
if (entityarrow.isBurning()) {
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();

View File

@ -9,7 +9,7 @@
public class BlockTripwire extends Block {
public static final BlockStateBoolean POWERED = BlockProperties.w;
@@ -139,6 +141,40 @@
@@ -132,6 +134,40 @@
}
}

View File

@ -38,28 +38,28 @@
if (i < 2) {
+ // CraftBukkit start - Call BlockGrowEvent
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata.set(BlockTurtleEgg.a, i + 1), 2)) {
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata.set(BlockTurtleEgg.a, i + 1), 2)) {
+ return;
+ }
+ // CraftBukkit end
world.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2);
+ // world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); // CraftBukkit - handled above
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
- worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2);
+ // worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); // CraftBukkit - handled above
} else {
+ // CraftBukkit start - Call BlockFadeEvent
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
world.a(blockposition, false);
if (!world.isClientSide) {
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
worldserver.a(blockposition, false);
@@ -73,7 +102,7 @@
entityturtle.setAgeRaw(-24000);
entityturtle.g(blockposition);
entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
- world.addEntity(entityturtle);
+ world.addEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
}
entityturtle.setAgeRaw(-24000);
entityturtle.g(blockposition);
entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
- worldserver.addEntity(entityturtle);
+ worldserver.addEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
}
}
}

View File

@ -9,51 +9,51 @@
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockSprawling.e;
@@ -178,20 +180,24 @@
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
@@ -177,20 +179,24 @@
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
+ // CraftBukkit start - Call BlockSpreadEvent
+ BlockPosition source = blockposition;
+ // CraftBukkit start - Call BlockSpreadEvent
+ BlockPosition source = blockposition;
+
if (flag && a((IBlockAccess) world, blockposition3, enumdirection1)) {
- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
} else if (flag1 && a((IBlockAccess) world, blockposition4, enumdirection2)) {
- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
} else {
EnumDirection enumdirection3 = enumdirection.opposite();
if (flag && a((IBlockAccess) worldserver, blockposition3, enumdirection1)) {
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
} else if (flag1 && a((IBlockAccess) worldserver, blockposition4, enumdirection2)) {
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
} else {
EnumDirection enumdirection3 = enumdirection.opposite();
if (flag && world.isEmpty(blockposition3) && a((IBlockAccess) world, blockposition.shift(enumdirection1), enumdirection3)) {
- world.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
} else if (flag1 && world.isEmpty(blockposition4) && a((IBlockAccess) world, blockposition.shift(enumdirection2), enumdirection3)) {
- world.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
} else if ((double) world.random.nextFloat() < 0.05D && a((IBlockAccess) world, blockposition2.up(), EnumDirection.UP)) {
- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
}
+ // CraftBukkit end
}
} else if (a((IBlockAccess) world, blockposition2, enumdirection)) {
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
@@ -221,7 +227,7 @@
if (flag && worldserver.isEmpty(blockposition3) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection1), enumdirection3)) {
- worldserver.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
} else if (flag1 && worldserver.isEmpty(blockposition4) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection2), enumdirection3)) {
- worldserver.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
} else if ((double) worldserver.random.nextFloat() < 0.05D && a((IBlockAccess) worldserver, blockposition2.up(), EnumDirection.UP)) {
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
}
+ // CraftBukkit end
}
} else if (a((IBlockAccess) worldserver, blockposition2, enumdirection)) {
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
@@ -220,7 +226,7 @@
}
if (this.canSpread(iblockdata3)) {
- world.setTypeAndData(blockposition1, iblockdata3, 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, iblockdata3, 2); // CraftBukkit
}
if (this.canSpread(iblockdata3)) {
- worldserver.setTypeAndData(blockposition1, iblockdata3, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata3, 2); // CraftBukkit
}
return;
@@ -236,7 +242,7 @@
IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random);
return;
@@ -235,7 +241,7 @@
IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random);
if (iblockdata4 != iblockdata5 && this.canSpread(iblockdata5)) {
- world.setTypeAndData(blockposition2, iblockdata5, 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, iblockdata5, 2); // CraftBukkit
}
if (iblockdata4 != iblockdata5 && this.canSpread(iblockdata5)) {
- worldserver.setTypeAndData(blockposition2, iblockdata5, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata5, 2); // CraftBukkit
}
}
}

View File

@ -4,8 +4,8 @@
@Override
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
super.a(iblockdata, world, blockposition, entity);
- if (entity instanceof EntityBoat) {
+ if (entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit
world.b(new BlockPosition(blockposition), true);
- if (world instanceof WorldServer && entity instanceof EntityBoat) {
+ if (world instanceof WorldServer && entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { // CraftBukkit
world.a(new BlockPosition(blockposition), true, entity);
}

View File

@ -38,8 +38,8 @@
}
@@ -50,6 +58,15 @@
entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.aK = shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.aI = shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.l();
+ // CraftBukkit start
+ if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {

View File

@ -18,7 +18,7 @@
+ // CraftBukkit end
+
public Chunk(World world, ProtoChunk protochunk) {
this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.q(), protochunk.getSections(), (Consumer) null);
this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null);
Iterator iterator = protochunk.y().iterator();
@@ -138,6 +149,7 @@
@ -55,7 +55,7 @@
iblockdata.onPlace(this.world, blockposition, iblockdata1, flag);
}
@@ -382,7 +402,12 @@
@@ -377,7 +397,12 @@
@Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@ -69,8 +69,8 @@
if (tileentity == null) {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition);
@@ -429,6 +454,13 @@
tileentity1.V_();
@@ -423,6 +448,13 @@
tileentity1.ab_();
}
+ // CraftBukkit start
@ -83,7 +83,7 @@
}
}
@@ -478,6 +510,50 @@
@@ -472,6 +504,50 @@
}
@ -134,7 +134,16 @@
public void markDirty() {
this.s = true;
}
@@ -552,7 +628,7 @@
@@ -525,7 +601,7 @@
Iterator iterator = this.entitySlices[k].a(Entity.class).iterator();
while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
+ T entity = (T) iterator.next(); // CraftBukkit - decompile error
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
list.add(entity);
@@ -546,7 +622,7 @@
Iterator iterator = this.entitySlices[k].a(oclass).iterator();
while (iterator.hasNext()) {
@ -143,7 +152,7 @@
if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) {
list.add(t0);
@@ -626,7 +702,7 @@
@@ -620,7 +696,7 @@
@Override
public boolean isNeedsSaving() {
@ -152,7 +161,7 @@
}
public void d(boolean flag) {
@@ -767,7 +843,7 @@
@@ -761,7 +837,7 @@
public void B() {
if (this.o instanceof ProtoChunkTickList) {
@ -161,7 +170,7 @@
return this.getType(blockposition).getBlock();
});
this.o = TickListEmpty.b();
@@ -777,7 +853,7 @@
@@ -771,7 +847,7 @@
}
if (this.p instanceof ProtoChunkTickList) {
@ -170,7 +179,7 @@
return this.getFluid(blockposition).getType();
});
this.p = TickListEmpty.b();
@@ -789,12 +865,12 @@
@@ -783,12 +859,12 @@
}
public void a(WorldServer worldserver) {

View File

@ -1,22 +1,21 @@
--- a/net/minecraft/server/ChunkGenerator.java
+++ b/net/minecraft/server/ChunkGenerator.java
@@ -148,6 +148,19 @@
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
StructureStart structurestart = StructureStart.a;
@@ -147,6 +147,18 @@
StructureStart structurestart1 = StructureStart.a;
BiomeBase biomebase = biomemanager.a(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9));
+ // CraftBukkit start
+ if (structuregenerator == WorldGenerator.STRONGHOLD) {
+ synchronized (structuregenerator) {
+ if (structuregenerator.a(chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z)) {
+ BiomeBase biomebase = this.getWorldChunkManager().getBiome(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9));
+ StructureStart structurestart1 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, biomebase, StructureBoundingBox.a(), 0, chunkgenerator.getSeed());
+ if (structuregenerator.a(biomemanager, chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z, biomebase)) {
+ StructureStart structurestart2 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, StructureBoundingBox.a(), i, chunkgenerator.getSeed());
+
+ structurestart1.a(this, definedstructuremanager, chunkcoordintpair.x, chunkcoordintpair.z, biomebase);
+ structurestart = structurestart1.e() ? structurestart1 : StructureStart.a;
+ structurestart2.a(this, definedstructuremanager, chunkcoordintpair.x, chunkcoordintpair.z, biomebase);
+ structurestart1 = structurestart2.e() ? structurestart2 : StructureStart.a;
+ }
+ }
+ } else
+ // CraftBukkit end
if (structuregenerator.a(chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z)) {
BiomeBase biomebase = this.getWorldChunkManager().getBiome(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9));
StructureStart structurestart1 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, biomebase, StructureBoundingBox.a(), 0, chunkgenerator.getSeed());
if (structuregenerator.a(biomemanager, chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z, biomebase)) {
StructureStart structurestart2 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, StructureBoundingBox.a(), i, chunkgenerator.getSeed());

View File

@ -1,24 +1,15 @@
--- a/net/minecraft/server/ChunkMapDistance.java
+++ b/net/minecraft/server/ChunkMapDistance.java
@@ -32,7 +32,7 @@
private static final Logger LOGGER = LogManager.getLogger();
private static final int b = 33 + ChunkStatus.a(ChunkStatus.FULL) - 2;
private final Long2ObjectMap<ObjectSet<EntityPlayer>> c = new Long2ObjectOpenHashMap();
- private final Long2ObjectOpenHashMap<ObjectSortedSet<Ticket<?>>> tickets = new Long2ObjectOpenHashMap();
+ public final Long2ObjectOpenHashMap<ObjectSortedSet<Ticket<?>>> tickets = new Long2ObjectOpenHashMap(); // CraftBukkit - private -> public
private final ChunkMapDistance.a e = new ChunkMapDistance.a();
private final ChunkMapDistance.b f = new ChunkMapDistance.b(8);
private final ChunkMapDistance.c g = new ChunkMapDistance.c(33);
@@ -62,7 +62,7 @@
@@ -59,7 +59,7 @@
while (objectiterator.hasNext()) {
Entry<ObjectSortedSet<Ticket<?>>> entry = (Entry) objectiterator.next();
Entry<ArraySetSorted<Ticket<?>>> entry = (Entry) objectiterator.next();
- if (((ObjectSortedSet) entry.getValue()).removeIf((ticket) -> {
+ if ((entry.getValue()).removeIf((ticket) -> { // Craftbukkit - decompile error
return ticket.a(this.currentTick);
- if (((ArraySetSorted) entry.getValue()).removeIf((ticket) -> {
+ if ((entry.getValue()).removeIf((ticket) -> { // CraftBukkit - decompile error
return ticket.b(this.currentTick);
})) {
this.e.b(entry.getLongKey(), this.a((ObjectSortedSet) entry.getValue()), false);
@@ -100,10 +100,25 @@
this.e.b(entry.getLongKey(), a((ArraySetSorted) entry.getValue()), false);
@@ -95,10 +95,25 @@
}
if (!this.pendingChunkUpdates.isEmpty()) {
@ -47,7 +38,7 @@
return true;
} else {
if (!this.l.isEmpty()) {
@@ -125,7 +140,7 @@
@@ -120,7 +135,7 @@
completablefuture.thenAccept((either) -> {
this.m.execute(() -> {
@ -56,86 +47,79 @@
}, j, false));
});
});
@@ -139,7 +154,7 @@
@@ -134,23 +149,25 @@
}
}
- private void addTicket(long i, Ticket<?> ticket) {
+ private boolean addTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
ObjectSortedSet<Ticket<?>> objectsortedset = this.e(i);
ObjectBidirectionalIterator<Ticket<?>> objectbidirectionaliterator = objectsortedset.iterator();
int j;
@@ -150,21 +165,24 @@
j = PlayerChunkMap.GOLDEN_TICKET + 1;
}
+ boolean ret = false; // CraftBukkit
if (objectsortedset.add(ticket)) {
- ;
+ ret = true; // CraftBukkit
}
ArraySetSorted<Ticket<?>> arraysetsorted = this.e(i);
int j = a(arraysetsorted);
- Ticket<?> ticket1 = (Ticket) arraysetsorted.a((Object) ticket);
+ Ticket<?> ticket1 = (Ticket) arraysetsorted.a(ticket); // CraftBukkit - decompile error
ticket1.a(this.currentTick);
if (ticket.b() < j) {
this.e.b(i, ticket.b(), true);
}
+ return ret; // CraftBukkit
+ return ticket == ticket1; // CraftBukkit
}
- private void removeTicket(long i, Ticket<?> ticket) {
+ private boolean removeTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
ObjectSortedSet<Ticket<?>> objectsortedset = this.e(i);
ArraySetSorted<Ticket<?>> arraysetsorted = this.e(i);
+ boolean removed = false; // CraftBukkit
if (objectsortedset.remove(ticket)) {
if (arraysetsorted.remove(ticket)) {
- ;
+ removed = true; // CraftBukkit
}
if (objectsortedset.isEmpty()) {
@@ -172,16 +190,29 @@
if (arraysetsorted.isEmpty()) {
@@ -158,16 +175,29 @@
}
this.e.b(i, this.a(objectsortedset), false);
this.e.b(i, a(arraysetsorted), false);
+ return removed; // CraftBukkit
}
public <T> void a(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
- this.addTicket(chunkcoordintpair.pair(), new Ticket<>(tickettype, i, t0, this.currentTick));
- this.addTicket(chunkcoordintpair.pair(), new Ticket<>(tickettype, i, t0));
+ // CraftBukkit start
+ this.addTicketAtLevel(tickettype, chunkcoordintpair, i, t0);
+ }
+
+ public <T> boolean addTicketAtLevel(TicketType<T> ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) {
+ return this.addTicket(chunkcoordintpair.pair(), new Ticket<>(ticketType, level, identifier, this.currentTick));
+ return this.addTicket(chunkcoordintpair.pair(), new Ticket<>(ticketType, level, identifier));
+ // CraftBukkit end
}
public <T> void b(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
- Ticket<T> ticket = new Ticket<>(tickettype, i, t0, this.currentTick);
- Ticket<T> ticket = new Ticket<>(tickettype, i, t0);
+ // CraftBukkit start
+ this.removeTicketAtLevel(tickettype, chunkcoordintpair, i, t0);
+ }
- this.removeTicket(chunkcoordintpair.pair(), ticket);
+ public <T> boolean removeTicketAtLevel(TicketType<T> ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) {
+ Ticket<T> ticket = new Ticket<>(ticketType, level, identifier, this.currentTick);
+ Ticket<T> ticket = new Ticket<>(ticketType, level, identifier);
+
+ return this.removeTicket(chunkcoordintpair.pair(), ticket);
+ // CraftBukkit end
}
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
@@ -265,6 +296,21 @@
@@ -251,6 +281,21 @@
return this.i.a();
}
+ // CraftBukkit start
+ public <T> void removeAllTicketsFor(TicketType<T> ticketType, int ticketLevel, T ticketIdentifier) {
+ Ticket<T> target = new Ticket<>(ticketType, ticketLevel, ticketIdentifier, this.currentTick);
+ Ticket<T> target = new Ticket<>(ticketType, ticketLevel, ticketIdentifier);
+
+ for (java.util.Iterator<ObjectSortedSet<Ticket<?>>> iterator = this.tickets.values().iterator(); iterator.hasNext();) {
+ ObjectSortedSet<Ticket<?>> tickets = iterator.next();
+ for (java.util.Iterator<ArraySetSorted<Ticket<?>>> iterator = this.tickets.values().iterator(); iterator.hasNext();) {
+ ArraySetSorted<Ticket<?>> tickets = iterator.next();
+ tickets.remove(target);
+
+ if (tickets.isEmpty()) {
@ -148,8 +132,8 @@
class a extends ChunkMap {
public a() {
@@ -351,13 +397,13 @@
Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i), ChunkMapDistance.this.currentTick);
@@ -331,13 +376,13 @@
Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i));
if (flag1) {
- ChunkMapDistance.this.j.a((Object) ChunkTaskQueueSorter.a(() -> {
@ -164,7 +148,7 @@
}, i, false));
}
@@ -366,7 +412,7 @@
@@ -346,7 +391,7 @@
return j;
}));
} else {

View File

@ -9,7 +9,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);
@@ -82,6 +82,11 @@
@@ -83,6 +83,11 @@
f4 = 1.0F + f4 * 2.0F;
f5 = 1.0F + f5 * 4.0F;
}
@ -19,5 +19,5 @@
+ }
+ // CraftBukkit end
float f6 = ChunkProviderGenerate.h[k + 2 + (l + 2) * 5] / (f4 + 2.0F);
float f6 = ChunkProviderGenerate.h[l + 2 + (i1 + 2) * 5] / (f4 + 2.0F);

View File

@ -130,8 +130,8 @@
+ int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits
if (object2intmap.getInt(enumcreaturetype) <= k1) {
SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition);
@@ -497,12 +547,18 @@
SpawnerCreature.a(enumcreaturetype, this.world, chunk, blockposition);
@@ -496,12 +546,18 @@
@Override
protected boolean executeNext() {

View File

@ -8,19 +8,19 @@
public abstract class CommandBlockListenerAbstract implements ICommandListener {
@@ -15,6 +16,10 @@
@@ -16,6 +17,10 @@
private IChatBaseComponent lastOutput;
private String command = "";
private IChatBaseComponent customName = new ChatComponentText("@");
private IChatBaseComponent customName;
+ // CraftBukkit start
+ @Override
+ public abstract CommandSender getBukkitSender(CommandListenerWrapper wrapper);
+ // CraftBukkit end
public CommandBlockListenerAbstract() {}
@@ -102,14 +107,7 @@
if (minecraftserver != null && minecraftserver.F() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.command)) {
public CommandBlockListenerAbstract() {
this.customName = CommandBlockListenerAbstract.c;
@@ -105,14 +110,7 @@
if (minecraftserver != null && minecraftserver.J() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.command)) {
try {
this.lastOutput = null;
- CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> {
@ -35,15 +35,3 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
@@ -140,6 +138,11 @@
}
public void setName(IChatBaseComponent ichatbasecomponent) {
+ // CraftBukkit start
+ if (ichatbasecomponent == null) {
+ ichatbasecomponent = new ChatComponentText("@");
+ }
+ // CraftBukkit end
this.customName = ichatbasecomponent;
}

View File

@ -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;
@ -23,7 +23,7 @@
CommandAdvancement.a(this.b);
CommandExecute.a(this.b);
CommandBossBar.a(this.b);
@@ -93,14 +102,59 @@
@@ -100,14 +109,59 @@
}
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
@ -84,7 +84,7 @@
StringReader stringreader = new StringReader(s);
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -112,7 +166,6 @@
@@ -119,7 +173,6 @@
byte b0;
try {
@ -92,7 +92,7 @@
ChatComponentText chatcomponenttext;
try {
@@ -121,52 +174,56 @@
@@ -128,58 +181,62 @@
return i;
} catch (CommandException commandexception) {
commandlistenerwrapper.sendFailureMessage(commandexception.a());
@ -144,39 +144,49 @@
} catch (Exception exception) {
- chatcomponenttext = new ChatComponentText;
- }
-
- chatcomponenttext.<init>(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
- ChatComponentText chatcomponenttext1 = chatcomponenttext;
+ ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]);
- if (CommandDispatcher.LOGGER.isDebugEnabled()) {
- StackTraceElement[] astacktraceelement = exception.getStackTrace();
- chatcomponenttext.<init>(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
- ChatComponentText chatcomponenttext1 = chatcomponenttext;
+ chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
+ if (CommandDispatcher.LOGGER.isDebugEnabled()) {
+ CommandDispatcher.LOGGER.error("Command exception: {}", s, exception);
+ StackTraceElement[] astacktraceelement = exception.getStackTrace();
- for(int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber()));
- if (CommandDispatcher.LOGGER.isDebugEnabled()) {
- CommandDispatcher.LOGGER.error("Command exception: {}", s, exception);
- StackTraceElement[] astacktraceelement = exception.getStackTrace();
+ for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
+ chatcomponenttext.a("\n\n" + astacktraceelement[k].getMethodName() + "\n " + astacktraceelement[k].getFileName() + ":" + astacktraceelement[k].getLineNumber());
+ }
+ }
- for(int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) {
- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber()));
+ chatmessage1.getChatModifier().setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext));
+ commandlistenerwrapper.sendFailureMessage(chatmessage1);
+ if (SharedConstants.b) {
+ commandlistenerwrapper.sendFailureMessage(new ChatComponentText(SystemUtils.d(exception)));
+ CommandDispatcher.LOGGER.error("'" + s + "' threw an exception", exception);
}
- }
- commandlistenerwrapper.sendFailureMessage((new ChatMessage("command.failed", new Object[0])).a((chatmodifier) -> {
- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext1));
- }));
- b0 = 0;
+ chatmessage1.getChatModifier().setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext));
+ commandlistenerwrapper.sendFailureMessage(chatmessage1);
- if (SharedConstants.b) {
- commandlistenerwrapper.sendFailureMessage(new ChatComponentText(SystemUtils.d(exception)));
- CommandDispatcher.LOGGER.error("'" + s + "' threw an exception", exception);
- }
+ byte b1 = 0;
+
- b0 = 0;
+ return b1;
+ }
} finally {
commandlistenerwrapper.getServer().getMethodProfiler().exit();
}
@@ -175,11 +232,36 @@
@@ -188,11 +245,36 @@
}
public void a(EntityPlayer entityplayer) {
@ -214,7 +224,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
}
@@ -190,7 +272,7 @@
@@ -203,7 +285,7 @@
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
if (commandnode2.canUse(commandlistenerwrapper)) {
@ -223,7 +233,7 @@
argumentbuilder.requires((icompletionprovider) -> {
return true;
@@ -213,7 +295,7 @@
@@ -226,7 +308,7 @@
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
}

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandEffect.java
+++ b/net/minecraft/server/CommandEffect.java
@@ -60,7 +60,7 @@
@@ -63,7 +63,7 @@
if (entity instanceof EntityLiving) {
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
@ -9,7 +9,7 @@
++j;
}
}
@@ -86,7 +86,7 @@
@@ -89,7 +89,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -18,7 +18,7 @@
++i;
}
}
@@ -111,7 +111,7 @@
@@ -114,7 +114,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View File

@ -98,7 +98,7 @@
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return (Boolean) this.containerAccess.a((world, blockposition) -> {
return !world.getType(blockposition).a(TagsBlock.ANVIL) ? false : entityhuman.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
return !world.getType(blockposition).a(TagsBlock.ANVIL) ? false : entityhuman.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= 64.0D;
}, true);
@@ -370,4 +382,18 @@

View File

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

View File

@ -30,7 +30,7 @@
private final ContainerAccess containerAccess;
private final ContainerProperty d;
private Runnable e;
@@ -28,6 +50,13 @@
@@ -29,6 +51,13 @@
ContainerLoom.this.a((IInventory) this);
ContainerLoom.this.e.run();
}
@ -44,7 +44,7 @@
};
this.resultInventory = new InventorySubcontainer(1) {
@Override
@@ -35,6 +64,13 @@
@@ -36,6 +65,13 @@
super.update();
ContainerLoom.this.e.run();
}
@ -58,7 +58,7 @@
};
this.containerAccess = containeraccess;
this.f = this.a(new Slot(this.craftInventory, 0, 13, 26) {
@@ -89,10 +125,12 @@
@@ -96,10 +132,12 @@
}
this.a(this.d);
@ -71,7 +71,7 @@
return a(this.containerAccess, entityhuman, Blocks.LOOM);
}
@@ -211,6 +249,11 @@
@@ -218,6 +256,11 @@
if (nbttagcompound.hasKeyOfType("Patterns", 9)) {
nbttaglist = nbttagcompound.getList("Patterns", 10);

View File

@ -42,4 +42,4 @@
+ if (!this.merchant.getWorld().isClientSide && this.merchant instanceof Entity) { // CraftBukkit - SPIGOT-5035
Entity entity = (Entity) this.merchant;
this.merchant.getWorld().a(entity.locX, entity.locY, entity.locZ, this.merchant.eb(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);
this.merchant.getWorld().a(entity.locX(), entity.locY(), entity.locZ(), this.merchant.getTradeSound(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ContainerPlayer.java
+++ b/net/minecraft/server/ContainerPlayer.java
@@ -1,18 +1,36 @@
@@ -1,5 +1,10 @@
package net.minecraft.server;
+// CraftBukkit start
@ -10,15 +10,18 @@
+
public class ContainerPlayer extends ContainerRecipeBook<InventoryCrafting> {
private static final String[] d = new String[]{"item/empty_armor_slot_boots", "item/empty_armor_slot_leggings", "item/empty_armor_slot_chestplate", "item/empty_armor_slot_helmet"};
private static final EnumItemSlot[] e = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
public static final MinecraftKey c = new MinecraftKey("textures/atlas/blocks.png");
@@ -10,15 +15,28 @@
public static final MinecraftKey h = new MinecraftKey("item/empty_armor_slot_shield");
private static final MinecraftKey[] j = new MinecraftKey[]{ContainerPlayer.g, ContainerPlayer.f, ContainerPlayer.e, ContainerPlayer.d};
private static final EnumItemSlot[] k = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
- private final InventoryCrafting craftInventory = new InventoryCrafting(this, 2, 2);
- private final InventoryCraftResult resultInventory = new InventoryCraftResult();
+ // CraftBukkit start
+ private final InventoryCrafting craftInventory;
+ private final InventoryCraftResult resultInventory;
+ // CraftBukkit end
public final boolean c;
public final boolean i;
private final EntityHuman owner;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
@ -27,7 +30,7 @@
public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) {
super((Containers) null, 0);
this.c = flag;
this.i = flag;
this.owner = entityhuman;
+ // CraftBukkit start
+ this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
@ -39,7 +42,7 @@
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28)));
int i;
@@ -79,7 +97,7 @@
@@ -85,7 +103,7 @@
@Override
public void a(IInventory iinventory) {
@ -48,7 +51,7 @@
}
@Override
@@ -182,4 +200,17 @@
@@ -188,4 +206,17 @@
public int h() {
return this.craftInventory.f();
}

View File

@ -1,7 +1,7 @@
--- a/net/minecraft/server/ContainerStonecutter.java
+++ b/net/minecraft/server/ContainerStonecutter.java
@@ -3,6 +3,11 @@
import com.google.common.collect.ImmutableList;
@@ -2,6 +2,11 @@
import com.google.common.collect.Lists;
import java.util.List;
+// CraftBukkit start
@ -12,8 +12,8 @@
public class ContainerStonecutter extends Container {
@@ -18,6 +23,21 @@
private Runnable m;
@@ -16,6 +21,21 @@
private Runnable l;
public final IInventory inventory;
private final InventoryCraftResult resultInventory;
+ // CraftBukkit start
@ -34,7 +34,7 @@
public ContainerStonecutter(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -83,10 +103,12 @@
@@ -81,10 +101,12 @@
}
this.a(this.containerProperty);

View File

@ -70,7 +70,7 @@
return a(this.containerAccess, entityhuman, Blocks.CRAFTING_TABLE);
}
@@ -166,4 +180,17 @@
@@ -168,4 +182,17 @@
public int h() {
return this.craftInventory.f();
}

View File

@ -8,4 +8,4 @@
+ ParseResults<CommandListenerWrapper> parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.g()); // CraftBukkit
if (parseresults.getReader().canRead()) {
if (parseresults.getExceptions().size() == 1) {
throw CommandDispatcher.a(parseresults);

View File

@ -17,5 +17,5 @@
+ }
+ // CraftBukkit end
public static DamageSource mobAttack(EntityLiving entityliving) {
return new EntityDamageSource("mob", entityliving);
public static DamageSource a(EntityLiving entityliving) {
return new EntityDamageSource("sting", entityliving);

View File

@ -219,7 +219,7 @@
return this.remoteControlCommandListener.getMessages();
}
@@ -562,4 +673,16 @@
public boolean b(GameProfile gameprofile) {
public boolean a(GameProfile gameprofile) {
return false;
}
+

View File

@ -4,34 +4,35 @@
public class DimensionManager implements MinecraftSerializable {
- public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true));
- public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false));
- public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false));
- public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true, GenLayerZoomVoronoiFixed.INSTANCE));
- public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false, GenLayerZoomVoronoi.INSTANCE));
- public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false, GenLayerZoomVoronoi.INSTANCE));
+ // CraftBukkit start
+ public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true, null));
+ public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false, null));
+ public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false, null));
+ public static final DimensionManager OVERWORLD = register("overworld", new DimensionManager(1, "", "", WorldProviderNormal::new, true, GenLayerZoomVoronoiFixed.INSTANCE, null));
+ public static final DimensionManager NETHER = register("the_nether", new DimensionManager(0, "_nether", "DIM-1", WorldProviderHell::new, false, GenLayerZoomVoronoiFixed.INSTANCE, null));
+ public static final DimensionManager THE_END = register("the_end", new DimensionManager(2, "_end", "DIM1", WorldProviderTheEnd::new, false, GenLayerZoomVoronoiFixed.INSTANCE, null));
+ // CraftBukkit end
private final int id;
private final String suffix;
public final String folder;
@@ -21,12 +23,14 @@
@@ -22,13 +24,15 @@
return (DimensionManager) IRegistry.a(IRegistry.DIMENSION_TYPE, dimensionmanager.id, s, dimensionmanager);
}
- public DimensionManager(int i, String s, String s1, BiFunction<World, DimensionManager, ? extends WorldProvider> bifunction, boolean flag) {
- public DimensionManager(int i, String s, String s1, BiFunction<World, DimensionManager, ? extends WorldProvider> bifunction, boolean flag, GenLayerZoomer genlayerzoomer) {
+ // CraftBukkit - add type
+ public DimensionManager(int i, String s, String s1, BiFunction<World, DimensionManager, ? extends WorldProvider> bifunction, boolean flag, DimensionManager type) {
+ public DimensionManager(int i, String s, String s1, BiFunction<World, DimensionManager, ? extends WorldProvider> bifunction, boolean flag, GenLayerZoomer genlayerzoomer, DimensionManager type) {
this.id = i;
this.suffix = s;
this.folder = s1;
this.providerFactory = bifunction;
this.hasSkyLight = flag;
this.genLayerZoomer = genlayerzoomer;
+ this.type = type; // CraftBukkit
}
public static DimensionManager a(Dynamic<?> dynamic) {
@@ -80,4 +84,12 @@
@@ -86,4 +90,12 @@
public <T> T a(DynamicOps<T> dynamicops) {
return dynamicops.createString(IRegistry.DIMENSION_TYPE.getKey(this).toString());
}

View File

@ -47,7 +47,7 @@
+ // CraftBukkit end
entityboat.setType(this.c);
entityboat.yaw = enumdirection.l();
entityboat.yaw = enumdirection.n();
- world.addEntity(entityboat);
- itemstack.subtract(1);
+ if (!world.addEntity(entityboat)) itemstack.add(1); // CraftBukkit

View File

@ -22,25 +22,25 @@
d();
}
+ // CraftBukkit start - easier than fixing the decompile
+ DataConverterFlattenData.a(1008, "{Name:'minecraft:oak_sign',Properties:{rotation:'0'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'0'}}");
+ DataConverterFlattenData.a(1009, "{Name:'minecraft:oak_sign',Properties:{rotation:'1'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'1'}}");
+ DataConverterFlattenData.a(1010, "{Name:'minecraft:oak_sign',Properties:{rotation:'2'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'2'}}");
+ DataConverterFlattenData.a(1011, "{Name:'minecraft:oak_sign',Properties:{rotation:'3'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'3'}}");
+ DataConverterFlattenData.a(1012, "{Name:'minecraft:oak_sign',Properties:{rotation:'4'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'4'}}");
+ DataConverterFlattenData.a(1013, "{Name:'minecraft:oak_sign',Properties:{rotation:'5'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'5'}}");
+ DataConverterFlattenData.a(1014, "{Name:'minecraft:oak_sign',Properties:{rotation:'6'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'6'}}");
+ DataConverterFlattenData.a(1015, "{Name:'minecraft:oak_sign',Properties:{rotation:'7'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'7'}}");
+ DataConverterFlattenData.a(1016, "{Name:'minecraft:oak_sign',Properties:{rotation:'8'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'8'}}");
+ DataConverterFlattenData.a(1017, "{Name:'minecraft:oak_sign',Properties:{rotation:'9'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'9'}}");
+ DataConverterFlattenData.a(1018, "{Name:'minecraft:oak_sign',Properties:{rotation:'10'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'10'}}");
+ DataConverterFlattenData.a(1019, "{Name:'minecraft:oak_sign',Properties:{rotation:'11'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'11'}}");
+ DataConverterFlattenData.a(1020, "{Name:'minecraft:oak_sign',Properties:{rotation:'12'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'12'}}");
+ DataConverterFlattenData.a(1021, "{Name:'minecraft:oak_sign',Properties:{rotation:'13'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'13'}}");
+ DataConverterFlattenData.a(1022, "{Name:'minecraft:oak_sign',Properties:{rotation:'14'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'14'}}");
+ DataConverterFlattenData.a(1023, "{Name:'minecraft:oak_sign',Properties:{rotation:'15'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'15'}}");
+ DataConverterFlattenData.map(1008, "{Name:'minecraft:oak_sign',Properties:{rotation:'0'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'0'}}");
+ DataConverterFlattenData.map(1009, "{Name:'minecraft:oak_sign',Properties:{rotation:'1'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'1'}}");
+ DataConverterFlattenData.map(1010, "{Name:'minecraft:oak_sign',Properties:{rotation:'2'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'2'}}");
+ DataConverterFlattenData.map(1011, "{Name:'minecraft:oak_sign',Properties:{rotation:'3'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'3'}}");
+ DataConverterFlattenData.map(1012, "{Name:'minecraft:oak_sign',Properties:{rotation:'4'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'4'}}");
+ DataConverterFlattenData.map(1013, "{Name:'minecraft:oak_sign',Properties:{rotation:'5'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'5'}}");
+ DataConverterFlattenData.map(1014, "{Name:'minecraft:oak_sign',Properties:{rotation:'6'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'6'}}");
+ DataConverterFlattenData.map(1015, "{Name:'minecraft:oak_sign',Properties:{rotation:'7'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'7'}}");
+ DataConverterFlattenData.map(1016, "{Name:'minecraft:oak_sign',Properties:{rotation:'8'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'8'}}");
+ DataConverterFlattenData.map(1017, "{Name:'minecraft:oak_sign',Properties:{rotation:'9'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'9'}}");
+ DataConverterFlattenData.map(1018, "{Name:'minecraft:oak_sign',Properties:{rotation:'10'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'10'}}");
+ DataConverterFlattenData.map(1019, "{Name:'minecraft:oak_sign',Properties:{rotation:'11'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'11'}}");
+ DataConverterFlattenData.map(1020, "{Name:'minecraft:oak_sign',Properties:{rotation:'12'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'12'}}");
+ DataConverterFlattenData.map(1021, "{Name:'minecraft:oak_sign',Properties:{rotation:'13'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'13'}}");
+ DataConverterFlattenData.map(1022, "{Name:'minecraft:oak_sign',Properties:{rotation:'14'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'14'}}");
+ DataConverterFlattenData.map(1023, "{Name:'minecraft:oak_sign',Properties:{rotation:'15'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'15'}}");
+ DataConverterMaterialId.ID_MAPPING.put(323, "minecraft:oak_sign");
+
+ DataConverterFlattenData.a(1440, "{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}", new String[]{"{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}"});
+ DataConverterFlattenData.map(1440, "{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}", new String[]{"{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}"});
+
+ DataConverterMaterialId.ID_MAPPING.put(409, "minecraft:prismarine_shard");
+ DataConverterMaterialId.ID_MAPPING.put(410, "minecraft:prismarine_crystals");

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/server/EnchantmentThorns.java
+++ b/net/minecraft/server/EnchantmentThorns.java
@@ -34,7 +34,7 @@
Random random = entityliving.getRandom();
Entry<EnumItemSlot, ItemStack> entry = EnchantmentManager.b(Enchantments.THORNS, entityliving);
- if (a(i, random)) {
+ if (entity != null && a(i, random)) { // CraftBukkit
if (entity != null) {
entity.damageEntity(DamageSource.a(entityliving), (float) b(i, random));
}

View File

@ -58,7 +58,7 @@
protected static final Logger LOGGER = LogManager.getLogger();
private static final AtomicInteger entityCount = new AtomicInteger();
private static final List<ItemStack> c = Collections.emptyList();
@@ -106,6 +155,20 @@
@@ -110,6 +159,20 @@
private long aH;
private EntitySize size;
private float headHeight;
@ -79,7 +79,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.entityCount.incrementAndGet();
@@ -204,6 +267,12 @@
@@ -214,6 +277,12 @@
}
protected void setPose(EntityPose entitypose) {
@ -92,7 +92,7 @@
this.datawatcher.set(Entity.POSE, entitypose);
}
@@ -212,6 +281,33 @@
@@ -222,6 +291,33 @@
}
protected void setYawPitch(float f, float f1) {
@ -126,15 +126,15 @@
this.yaw = f % 360.0F;
this.pitch = f1 % 360.0F;
}
@@ -224,6 +320,7 @@
@@ -232,6 +328,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));
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
}
public void tick() {
@@ -234,6 +331,15 @@
protected void Z() {
@@ -246,6 +343,15 @@
this.entityBaseTick();
}
@ -150,16 +150,16 @@
public void entityBaseTick() {
this.world.getMethodProfiler().enter("entityBaseTick");
if (this.isPassenger() && this.getVehicle().dead) {
@@ -250,7 +356,7 @@
this.lastZ = this.locZ;
@@ -259,7 +365,7 @@
this.A = this.B;
this.lastPitch = this.pitch;
this.lastYaw = this.yaw;
- this.doPortalTick();
+ if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick
this.aA();
this.aE();
this.m();
if (this.world.isClientSide) {
@@ -300,12 +406,44 @@
@@ -309,12 +415,44 @@
protected void burnFromLava() {
if (!this.isFireProof()) {
@ -205,8 +205,8 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -409,6 +547,28 @@
block1.a((IBlockAccess) this.world, this);
@@ -404,6 +542,28 @@
block.a((IBlockAccess) this.world, this);
}
+ // CraftBukkit start
@ -231,10 +231,10 @@
+ }
+ // CraftBukkit end
+
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
double d0 = vec3d1.x;
double d1 = vec3d1.y;
@@ -462,7 +622,14 @@
if (this.onGround && !this.bk()) {
block.stepOn(this.world, blockposition, this);
}
@@ -458,7 +618,14 @@
if (!flag) {
++this.fireTicks;
if (this.fireTicks == 0) {
@ -250,15 +250,15 @@
}
}
@@ -698,6 +865,7 @@
this.locX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D;
this.locY = axisalignedbb.minY;
this.locZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D;
@@ -683,6 +850,7 @@
AxisAlignedBB axisalignedbb = this.getBoundingBox();
this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D);
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
}
protected SoundEffect getSoundSwim() {
@@ -869,7 +1037,7 @@
@@ -854,7 +1022,7 @@
return null;
}
@ -267,7 +267,7 @@
if (!this.isFireProof()) {
this.damageEntity(DamageSource.FIRE, (float) i);
}
@@ -1102,6 +1270,13 @@
@@ -1088,6 +1256,13 @@
}
public void spawnIn(World world) {
@ -281,15 +281,15 @@
this.world = world;
}
@@ -1127,6 +1302,7 @@
this.lastYaw -= 360.0F;
}
@@ -1103,6 +1278,7 @@
this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
+ world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // CraftBukkit
this.setPosition(this.locX, this.locY, this.locZ);
this.setYawPitch(f, f1);
}
@@ -1295,7 +1471,7 @@
public void setPositionRotation(BlockPosition blockposition, float f, float f1) {
@@ -1279,7 +1455,7 @@
public boolean c(NBTTagCompound nbttagcompound) {
String s = this.getSaveID();
@ -298,7 +298,7 @@
nbttagcompound.setString("id", s);
this.save(nbttagcompound);
return true;
@@ -1314,15 +1490,33 @@
@@ -1298,15 +1474,33 @@
Vec3D vec3d = this.getMot();
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
@ -333,7 +333,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1380,6 +1574,11 @@
@@ -1364,6 +1558,11 @@
}
}
@ -345,7 +345,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
@@ -1420,7 +1619,7 @@
@@ -1396,7 +1595,7 @@
this.setAirTicks(nbttagcompound.getShort("Air"));
this.onGround = nbttagcompound.getBoolean("OnGround");
if (nbttagcompound.hasKey("Dimension")) {
@ -354,7 +354,7 @@
}
this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
@@ -1463,6 +1662,43 @@
@@ -1439,6 +1638,43 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@ -398,7 +398,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1538,9 +1774,22 @@
@@ -1514,9 +1750,22 @@
} else if (this.world.isClientSide) {
return null;
} else {
@ -408,7 +408,7 @@
+ return null;
+ }
+ // CraftBukkit end
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY() + (double) f, this.locZ(), itemstack);
entityitem.defaultPickupDelay();
+ // CraftBukkit start
@ -421,7 +421,7 @@
this.world.addEntity(entityitem);
return entityitem;
}
@@ -1644,7 +1893,7 @@
@@ -1624,7 +1873,7 @@
}
this.vehicle = entity;
@ -430,7 +430,7 @@
return true;
}
}
@@ -1669,15 +1918,36 @@
@@ -1649,15 +1898,36 @@
Entity entity = this.vehicle;
this.vehicle = null;
@ -469,7 +469,7 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1685,15 +1955,33 @@
@@ -1665,15 +1935,33 @@
}
}
@ -504,15 +504,15 @@
}
protected boolean q(Entity entity) {
@@ -1736,11 +2024,17 @@
@@ -1717,11 +2005,17 @@
int i = this.ab();
if (this.ai) {
- if (this.world.getMinecraftServer().getAllowNether() && !this.isPassenger() && this.aj++ >= i) {
+ if ((true || this.world.getMinecraftServer().getAllowNether()) && !this.isPassenger() && this.aj++ >= i) { // CraftBukkit
if (this.af) {
- if (this.world.getMinecraftServer().getAllowNether() && !this.isPassenger() && this.ag++ >= i) {
+ if ((true || this.world.getMinecraftServer().getAllowNether()) && !this.isPassenger() && this.ag++ >= i) { // CraftBukkit
this.world.getMethodProfiler().enter("portal");
this.aj = i;
this.portalCooldown = this.aX();
this.ag = i;
this.portalCooldown = this.ba();
- this.a(this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER);
+ // CraftBukkit start
+ if (this instanceof EntityPlayer) {
@ -524,7 +524,7 @@
this.world.getMethodProfiler().exit();
}
@@ -1820,6 +2114,13 @@
@@ -1821,6 +2115,13 @@
}
public void setSwimming(boolean flag) {
@ -538,7 +538,7 @@
this.setFlag(4, flag);
}
@@ -1880,16 +2181,56 @@
@@ -1881,16 +2182,56 @@
}
public void setAirTicks(int i) {
@ -598,7 +598,7 @@
}
public void j(boolean flag) {
@@ -2037,33 +2378,46 @@
@@ -2042,33 +2383,46 @@
@Nullable
public Entity a(DimensionManager dimensionmanager) {
@ -639,8 +639,8 @@
+ } else if (dimensionmanager.getType() == DimensionManager.THE_END) { // CraftBukkit
blockposition = worldserver1.getDimensionSpawn();
} else {
double d0 = this.locX;
double d1 = this.locZ;
double d0 = this.locX();
double d1 = this.locZ();
double d2 = 8.0D;
- if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
@ -652,7 +652,7 @@
d0 *= 8.0D;
d1 *= 8.0D;
}
@@ -2088,6 +2442,28 @@
@@ -2093,6 +2447,28 @@
vec3d = shapedetector_shape.velocity;
f = (float) shapedetector_shape.yaw;
}
@ -681,7 +681,7 @@
this.world.getMethodProfiler().exitEnter("reloading");
Entity entity = this.getEntityType().a((World) worldserver1);
@@ -2097,6 +2473,14 @@
@@ -2102,6 +2478,14 @@
entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch);
entity.setMot(vec3d);
worldserver1.addEntityTeleport(entity);
@ -696,7 +696,7 @@
}
this.dead = true;
@@ -2298,7 +2682,26 @@
@@ -2308,7 +2692,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {

View File

@ -8,16 +8,16 @@
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
super(entitytypes, world);
@@ -30,7 +31,7 @@
@@ -46,7 +47,7 @@
if (entityageable != null) {
entityageable.setAgeRaw(-24000);
entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
entityageable.setPositionRotation(this.locX(), this.locY(), this.locZ(), 0.0F, 0.0F);
- this.world.addEntity(entityageable);
+ this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
if (itemstack.hasName()) {
entityageable.setCustomName(itemstack.getName());
}
@@ -103,6 +104,7 @@
@@ -119,6 +120,7 @@
super.b(nbttagcompound);
nbttagcompound.setInt("Age", this.getAge());
nbttagcompound.setInt("ForcedAge", this.c);
@ -25,7 +25,7 @@
}
@Override
@@ -110,6 +112,7 @@
@@ -126,6 +128,7 @@
super.a(nbttagcompound);
this.setAgeRaw(nbttagcompound.getInt("Age"));
this.c = nbttagcompound.getInt("ForcedAge");
@ -33,7 +33,7 @@
}
@Override
@@ -124,7 +127,7 @@
@@ -140,7 +143,7 @@
@Override
public void movementTick() {
super.movementTick();
@ -41,4 +41,4 @@
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit
if (this.d > 0) {
if (this.d % 4 == 0) {
this.world.addParticle(Particles.HAPPY_VILLAGER, this.locX + (double) (this.random.nextFloat() * this.getWidth() * 2.0F) - (double) this.getWidth(), this.locY + 0.5D + (double) (this.random.nextFloat() * this.getHeight()), this.locZ + (double) (this.random.nextFloat() * this.getWidth() * 2.0F) - (double) this.getWidth(), 0.0D, 0.0D, 0.0D);
this.world.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.cv() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D);

View File

@ -26,7 +26,7 @@
@Override
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
@@ -139,6 +144,7 @@
@@ -140,6 +145,7 @@
if (entityhuman != null) {
this.breedCause = entityhuman.getUniqueID();
}

View File

@ -15,7 +15,7 @@
+
public class EntityArmorStand extends EntityLiving {
private static final Vector3f bu = new Vector3f(0.0F, 0.0F, 0.0F);
private static final Vector3f br = new Vector3f(0.0F, 0.0F, 0.0F);
@@ -53,6 +62,13 @@
this.setPosition(d0, d1, d2);
}
@ -28,31 +28,31 @@
+ // CraftBukkit end
+
@Override
public void updateSize() {
double d0 = this.locX;
@@ -374,6 +390,21 @@
if (itemstack1.isEmpty() || (this.bE & 1 << enumitemslot.c() + 8) == 0) {
if (!itemstack1.isEmpty() || (this.bE & 1 << enumitemslot.c() + 16) == 0) {
ItemStack itemstack2;
+ // CraftBukkit start
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack);
public boolean bt() {
return !this.isMarker() && super.bt();
@@ -386,6 +402,21 @@
return false;
} else {
ItemStack itemstack2;
+ // CraftBukkit start
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack);
+
+ Player player = (Player) entityhuman.getBukkitEntity();
+ ArmorStand self = (ArmorStand) this.getBukkitEntity();
+ Player player = (Player) entityhuman.getBukkitEntity();
+ ArmorStand self = (ArmorStand) this.getBukkitEntity();
+
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
+ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent);
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
+ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent);
+
+ if (armorStandManipulateEvent.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+ if (armorStandManipulateEvent.isCancelled()) {
+ return true;
+ }
+ // CraftBukkit end
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.cloneItemStack();
@@ -398,12 +429,22 @@
if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.cloneItemStack();
@@ -414,12 +445,22 @@
public boolean damageEntity(DamageSource damagesource, float f) {
if (!this.world.isClientSide && !this.dead) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
@ -64,10 +64,10 @@
+ // CraftBukkit end
+ this.killEntity(); // CraftBukkit - this.die() -> this.killEntity()
return false;
- } else if (!this.isInvulnerable(damagesource) && !this.bD && !this.isMarker()) {
+ } else if (!this.isInvulnerable(damagesource) && (true || !this.bD) && !this.isMarker()) { // CraftBukkit
- } else if (!this.isInvulnerable(damagesource) && !this.armorStandInvisible && !this.isMarker()) {
+ } else if (!this.isInvulnerable(damagesource) && (true || !this.armorStandInvisible) && !this.isMarker()) { // CraftBukkit
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.bD)) { // PAIL: armorStandInvisible
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.armorStandInvisible)) {
+ return false;
+ }
+ // CraftBukkit end
@ -78,7 +78,7 @@
return false;
} else if (DamageSource.FIRE.equals(damagesource)) {
if (this.isBurning()) {
@@ -428,7 +469,7 @@
@@ -444,7 +485,7 @@
} else if (damagesource.v()) {
this.F();
this.D();
@ -87,7 +87,7 @@
return flag1;
} else {
long i = this.world.getTime();
@@ -439,7 +480,7 @@
@@ -455,7 +496,7 @@
} else {
this.f(damagesource);
this.D();
@ -96,7 +96,7 @@
}
return true;
@@ -466,7 +507,7 @@
@@ -482,7 +523,7 @@
f1 -= f;
if (f1 <= 0.5F) {
this.g(damagesource);
@ -105,7 +105,7 @@
} else {
this.setHealth(f1);
}
@@ -474,13 +515,13 @@
@@ -490,13 +531,13 @@
}
private void f(DamageSource damagesource) {
@ -121,7 +121,7 @@
ItemStack itemstack;
int i;
@@ -488,7 +529,7 @@
@@ -504,7 +545,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.a);
}
}
@@ -496,10 +537,11 @@
@@ -512,10 +553,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@ -143,7 +143,7 @@
}
@@ -600,8 +642,16 @@
@@ -616,8 +658,16 @@
return this.isSmall();
}

View File

@ -12,8 +12,8 @@
+
public abstract class EntityArrow extends Entity implements IProjectile {
private static final DataWatcherObject<Byte> ar = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a);
@@ -252,6 +258,7 @@
private static final DataWatcherObject<Byte> ao = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a);
@@ -255,6 +261,7 @@
}
protected void a(MovingObjectPosition movingobjectposition) {
@ -21,10 +21,10 @@
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
if (movingobjectposition_enummovingobjecttype == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
@@ -334,7 +341,13 @@
@@ -336,7 +343,13 @@
int j = entity.ad();
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
if (this.isBurning() && !flag) {
- entity.setOnFire(5);
+ // CraftBukkit start
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
@ -36,7 +36,7 @@
}
if (entity.damageEntity(damagesource, (float) i)) {
@@ -471,6 +484,7 @@
@@ -477,6 +490,7 @@
public void setShooter(@Nullable Entity entity) {
this.shooter = entity == null ? null : entity.getUniqueID();
@ -44,14 +44,14 @@
if (entity instanceof EntityHuman) {
this.fromPlayer = ((EntityHuman) entity).abilities.canInstantlyBuild ? EntityArrow.PickupStatus.CREATIVE_ONLY : EntityArrow.PickupStatus.ALLOWED;
}
@@ -485,9 +499,23 @@
@@ -491,9 +505,23 @@
@Override
public void pickup(EntityHuman entityhuman) {
if (!this.world.isClientSide && (this.inGround || this.v()) && this.shake <= 0) {
+ // CraftBukkit start
+ ItemStack itemstack = this.getItemStack();
+ if (this.fromPlayer == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.inventory.canHold(itemstack) > 0) {
+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
+ EntityItem item = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), itemstack);
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
+ this.world.getServer().getPluginManager().callEvent(event);

View File

@ -33,7 +33,7 @@
} else {
if (this.d != null && (!this.world.isEmpty(this.d) || this.d.getY() < 1)) {
@@ -134,7 +143,11 @@
this.bd = 0.5F;
this.bb = 0.5F;
this.yaw += f1;
if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).isOccluding(this.world, blockposition1)) {
- this.setAsleep(true);
@ -45,7 +45,7 @@
}
}
@@ -162,7 +175,11 @@
@@ -164,7 +177,11 @@
return false;
} else {
if (!this.world.isClientSide && this.isAsleep()) {

View File

@ -0,0 +1,74 @@
--- a/net/minecraft/server/EntityBee.java
+++ b/net/minecraft/server/EntityBee.java
@@ -157,7 +157,7 @@
}
this.setHasStung(true);
- this.setGoalTarget((EntityLiving) null);
+ this.setGoalTarget((EntityLiving) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
this.a(SoundEffects.ENTITY_BEE_STING, 1.0F, 1.0F);
}
@@ -572,7 +572,7 @@
class d extends EntityBee.a {
private d() {
- super(null);
+ super(); // CraftBukkit - decompile error
}
@Override
@@ -632,7 +632,7 @@
class g extends EntityBee.a {
private g() {
- super(null);
+ super(); // CraftBukkit - decompile error
}
@Override
@@ -696,7 +696,7 @@
class i extends EntityBee.a {
private i() {
- super(null);
+ super(); // CraftBukkit - decompile error
}
@Override
@@ -760,7 +760,7 @@
private int h = 0;
k() {
- super(null);
+ super(); // CraftBukkit - decompile error
this.a(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -944,7 +944,7 @@
private int c;
f() {
- super(null);
+ super(); // CraftBukkit - decompile error
this.c = EntityBee.this.world.random.nextInt(10);
this.a(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -1001,7 +1001,7 @@
private PathEntity e;
e() {
- super(null);
+ super(); // CraftBukkit - decompile error
this.c = EntityBee.this.world.random.nextInt(10);
this.d = Lists.newArrayList();
this.e = null;
@@ -1210,7 +1210,7 @@
@Override
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.e.hasLineOfSight(entityliving) && ((EntityBee) entityinsentient).a((Entity) entityliving)) {
- entityinsentient.setGoalTarget(entityliving);
+ entityinsentient.setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
}
}

View File

@ -17,8 +17,8 @@
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityBoat.class, DataWatcherRegistry.b);
@@ -37,6 +46,14 @@
private float aO;
private float aP;
private float aL;
private float aM;
+ // CraftBukkit start
+ // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable.
@ -30,7 +30,7 @@
+
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.as = new float[2];
this.ap = new float[2];
@@ -98,6 +115,19 @@
if (damagesource instanceof EntityDamageSourceIndirect && damagesource.getEntity() != null && this.w(damagesource.getEntity())) {
return false;
@ -94,14 +94,14 @@
}
@@ -176,6 +231,7 @@
return this.getDirection().e();
return this.getDirection().f();
}
+ private Location lastLocation; // CraftBukkit
@Override
public void tick() {
this.aJ = this.aI;
@@ -219,6 +275,22 @@
this.aG = this.aF;
@@ -216,6 +272,22 @@
this.setMot(Vec3D.a);
}
@ -109,7 +109,7 @@
+ org.bukkit.Server server = this.world.getServer();
+ org.bukkit.World bworld = this.world.getWorld();
+
+ Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
+ Location to = new Location(bworld, this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch);
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+
+ server.getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
@ -124,7 +124,7 @@
this.q();
for (int i = 0; i <= 1; ++i) {
@@ -740,6 +812,11 @@
@@ -734,6 +806,11 @@
this.b(this.fallDistance, 1.0F);
if (!this.world.isClientSide && !this.dead) {
@ -136,7 +136,7 @@
this.die();
if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
int i;
@@ -753,6 +830,7 @@
@@ -747,6 +824,7 @@
}
}
}

View File

@ -1,24 +1,24 @@
--- a/net/minecraft/server/EntityCat.java
+++ b/net/minecraft/server/EntityCat.java
@@ -16,7 +16,7 @@
private static final DataWatcherObject<Boolean> bF = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> bG = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Integer> bH = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
- public static final Map<Integer, MinecraftKey> bC = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ public static final Map<Integer, MinecraftKey> bC = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
private static final DataWatcherObject<Boolean> bC = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> bD = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Integer> bE = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
- public static final Map<Integer, MinecraftKey> bz = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ public static final Map<Integer, MinecraftKey> bz = (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"));
@@ -329,7 +329,7 @@
} else if (this.i(itemstack)) {
this.a(entityhuman, itemstack);
if (!this.world.isClientSide) {
@@ -347,7 +347,7 @@
}
} else if (this.i(itemstack)) {
this.a(entityhuman, itemstack);
- if (this.random.nextInt(3) == 0) {
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
this.tame(entityhuman);
this.r(true);
this.goalSit.setSitting(true);
@@ -518,7 +518,7 @@
this.world.broadcastEntityEffect(this, (byte) 7);
@@ -533,7 +533,7 @@
static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@ -27,7 +27,7 @@
private final EntityCat d;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -553,9 +553,9 @@
@@ -568,9 +568,9 @@
private final EntityCat i;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

View File

@ -10,10 +10,10 @@
+ }
+ // CraftBukkit end
super.movementTick();
this.bC = this.bz;
this.bB = this.bA;
this.bz = this.bw;
this.by = this.bx;
@@ -62,7 +67,9 @@
this.bz += this.bD * 2.0F;
this.bw += this.bA * 2.0F;
if (!this.world.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggLayTime <= 0) {
this.a(SoundEffects.ENTITY_CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.forceDrops = true; // CraftBukkit

View File

@ -12,7 +12,7 @@
public class EntityCreeper extends EntityMonster {
@@ -165,9 +170,19 @@
@@ -167,9 +172,19 @@
@Override
public void onLightningStrike(EntityLightning entitylightning) {
super.onLightningStrike(entitylightning);
@ -33,12 +33,12 @@
@Override
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.b(enumhand);
@@ -192,10 +207,18 @@
@@ -194,10 +209,18 @@
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
float f = this.isPowered() ? 2.0F : 1.0F;
- this.killed = true;
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, explosion_effect);
- this.world.explode(this, this.locX(), this.locY(), this.locZ(), (float) this.explosionRadius * f, explosion_effect);
- this.die();
- this.createEffectCloud();
+ // CraftBukkit start
@ -46,7 +46,7 @@
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ this.killed = true;
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), explosion_effect);
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), explosion_effect);
+ this.die();
+ this.createEffectCloud();
+ } else {
@ -56,15 +56,15 @@
}
}
@@ -206,6 +229,7 @@
@@ -208,6 +231,7 @@
if (!collection.isEmpty()) {
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ);
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX(), this.locY(), this.locZ());
+ entityareaeffectcloud.setSource(this); // CraftBukkit
entityareaeffectcloud.setRadius(2.5F);
entityareaeffectcloud.setRadiusOnUse(-0.5F);
entityareaeffectcloud.setWaitTime(10);
@@ -219,7 +243,7 @@
@@ -221,7 +245,7 @@
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
}

View File

@ -21,7 +21,7 @@
this.setSlot(EnumItemSlot.MAINHAND, itemstack);
this.dropChanceHand[EnumItemSlot.MAINHAND.b()] = 2.0F;
this.receive(entityitem, itemstack.getCount());
@@ -422,7 +427,7 @@
@@ -425,7 +430,7 @@
@Override
public void c() {
@ -30,7 +30,7 @@
}
@Override
@@ -441,7 +446,7 @@
@@ -444,7 +449,7 @@
}
if (this.c.isSwimming() && this.c.world.random.nextInt(6) == 0) {

View File

@ -45,11 +45,11 @@
+ }
- entitychicken.setAgeRaw(-24000);
- entitychicken.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
- entitychicken.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F);
- this.world.addEntity(entitychicken);
+ if (hatching) {
+ for (int i = 0; i < b0; ++i) {
+ Entity entity = world.getWorld().createEntity(new org.bukkit.Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass());
+ Entity entity = world.getWorld().createEntity(new org.bukkit.Location(world.getWorld(), this.locX(), this.locY(), this.locZ(), this.yaw, 0.0F), hatchingType.getEntityClass());
+ if (entity.getBukkitEntity() instanceof Ageable) {
+ ((Ageable) entity.getBukkitEntity()).setBaby();
+ }

View File

@ -12,7 +12,7 @@
public class EntityEnderCrystal extends Entity {
private static final DataWatcherObject<Optional<BlockPosition>> c = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.m);
@@ -41,7 +46,11 @@
@@ -38,7 +43,11 @@
BlockPosition blockposition = new BlockPosition(this);
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(blockposition).isAir()) {
@ -25,7 +25,7 @@
}
}
@@ -81,9 +90,22 @@
@@ -78,9 +87,22 @@
return false;
} else {
if (!this.dead && !this.world.isClientSide) {
@ -36,7 +36,7 @@
+ // CraftBukkit end
this.die();
if (!damagesource.isExplosion()) {
- this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, Explosion.Effect.DESTROY);
- this.world.explode((Entity) null, this.locX(), this.locY(), this.locZ(), 6.0F, Explosion.Effect.DESTROY);
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
+ this.world.getServer().getPluginManager().callEvent(event);
@ -44,7 +44,7 @@
+ this.dead = false;
+ return false;
+ }
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
+ this.world.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
+ // CraftBukkit end
}

View File

@ -14,23 +14,23 @@
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogManager.getLogger();
@@ -35,6 +41,7 @@
private final PathPoint[] bT = new PathPoint[24];
private final int[] bU = new int[24];
private final Path bV = new Path();
@@ -38,6 +44,7 @@
private final PathPoint[] bR = new PathPoint[24];
private final int[] bS = new int[24];
private final Path bT = new Path();
+ private Explosion explosionSource = new Explosion(null, this, 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) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -173,7 +180,7 @@
@@ -177,7 +184,7 @@
Vec3D vec3d1 = idragoncontroller.g();
- if (vec3d1 != null) {
+ if (vec3d1 != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.HOVER) { // CraftBukkit - Don't move when hovering
d0 = vec3d1.x - this.locX;
d1 = vec3d1.y - this.locY;
d2 = vec3d1.z - this.locZ;
d0 = vec3d1.x - this.locX();
d1 = vec3d1.y - this.locY();
d2 = vec3d1.z - this.locZ();
@@ -315,7 +322,14 @@
if (this.currentEnderCrystal.dead) {
this.currentEnderCrystal = null;
@ -47,7 +47,7 @@
}
}
@@ -388,6 +402,9 @@
@@ -390,6 +404,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@ -57,7 +57,7 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -398,7 +415,11 @@
@@ -400,7 +417,11 @@
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) && !TagsBlock.DRAGON_IMMUNE.isTagged(block)) {
@ -70,7 +70,7 @@
} else {
flag = true;
}
@@ -407,6 +428,48 @@
@@ -409,6 +430,51 @@
}
}
@ -107,7 +107,10 @@
+ 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.a).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
+
+ Block.b(craftBlock.getNMS(), loottableinfo_builder);
+ craftBlock.getNMS().a(loottableinfo_builder).forEach((itemstack) -> {
+ Block.a(world, blockposition, itemstack);
+ });
+ craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a);
+ }
+ nmsBlock.wasExploded(world, blockposition, explosionSource);
+

View File

@ -19,14 +19,6 @@
if (entityplayer.playerConnection.a().isConnected() && entityplayer.world == this.world && !entityplayer.isSleeping()) {
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world);
-
- entityendermite.setPlayerSpawned(true);
- entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
- this.world.addEntity(entityendermite);
- }
-
- if (entityliving.isPassenger()) {
- entityliving.stopRiding();
+ // CraftBukkit start - Fire PlayerTeleportEvent
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
+ org.bukkit.Location location = getBukkitEntity().getLocation();
@ -39,12 +31,17 @@
+ if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
+ if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world);
+
- entityendermite.setPlayerSpawned(true);
+ entityendermite.setPlayerSpawned(true);
+ entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
entityendermite.setPositionRotation(entityliving.locX(), entityliving.locY(), entityliving.locZ(), entityliving.yaw, entityliving.pitch);
- this.world.addEntity(entityendermite);
- }
+ this.world.addEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
+ }
+
- if (entityliving.isPassenger()) {
- entityliving.stopRiding();
+ if (entityliving.isPassenger()) {
+ entityliving.stopRiding();
+ }
@ -56,10 +53,10 @@
+ CraftEventFactory.entityDamage = null;
}
-
- entityliving.enderTeleportTo(this.locX, this.locY, this.locZ);
- entityliving.enderTeleportTo(this.locX(), this.locY(), this.locZ());
- entityliving.fallDistance = 0.0F;
- entityliving.damageEntity(DamageSource.FALL, 5.0F);
+ // CraftBukkit end
}
} else if (entityliving != null) {
entityliving.enderTeleportTo(this.locX, this.locY, this.locZ);
entityliving.enderTeleportTo(this.locX(), this.locY(), this.locZ());

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityEnderman.java
+++ b/net/minecraft/server/EntityEnderman.java
@@ -51,7 +51,17 @@
@@ -52,7 +52,17 @@
@Override
public void setGoalTarget(@Nullable EntityLiving entityliving) {
@ -19,7 +19,7 @@
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -65,6 +75,7 @@
@@ -67,6 +77,7 @@
attributeinstance.addModifier(EntityEnderman.c);
}
}
@ -27,8 +27,8 @@
}
@@ -304,8 +315,12 @@
boolean flag = movingobjectpositionblock.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && movingobjectpositionblock.getBlockPosition().equals(blockposition);
@@ -323,8 +334,12 @@
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- this.enderman.setCarried(iblockdata);
@ -42,7 +42,7 @@
}
}
@@ -338,8 +353,12 @@
@@ -357,8 +372,12 @@
IBlockData iblockdata2 = this.a.getCarried();
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {

View File

@ -41,11 +41,11 @@
+
+ if (this.targetPlayer != null && !cancelled) {
+ // CraftBukkit end
Vec3D vec3d = new Vec3D(this.targetPlayer.locX - this.locX, this.targetPlayer.locY + (double) this.targetPlayer.getHeadHeight() / 2.0D - this.locY, this.targetPlayer.locZ - this.locZ);
Vec3D vec3d = new Vec3D(this.targetPlayer.locX() - this.locX(), this.targetPlayer.locY() + (double) this.targetPlayer.getHeadHeight() / 2.0D - this.locY(), this.targetPlayer.locZ() - this.locZ());
double d1 = vec3d.g();
@@ -113,7 +134,7 @@
protected void az() {}
protected void aD() {}
@Override
- protected void burn(int i) {

View File

@ -9,7 +9,7 @@
public class EntityFallingBlock extends Entity {
private IBlockData block;
@@ -73,7 +75,7 @@
@@ -70,7 +72,7 @@
if (this.ticksLived++ == 0) {
blockposition = new BlockPosition(this);
@ -18,7 +18,7 @@
this.world.a(blockposition, false);
} else if (!this.world.isClientSide) {
this.die();
@@ -124,6 +126,11 @@
@@ -121,6 +123,11 @@
this.block = (IBlockData) this.block.set(BlockProperties.C, true);
}
@ -30,7 +30,7 @@
if (this.world.setTypeAndData(blockposition, this.block, 3)) {
if (block instanceof BlockFalling) {
((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata);
@@ -180,7 +187,9 @@
@@ -177,7 +184,9 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View File

@ -22,8 +22,8 @@
this(entitytypes, world);
this.shooter = entityliving;
+ this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.setPosition(this.locX, this.locY, this.locZ);
this.setPositionRotation(entityliving.locX(), entityliving.locY(), entityliving.locZ(), entityliving.yaw, entityliving.pitch);
this.Z();
this.setMot(Vec3D.a);
+ // CraftBukkit start - Added setDirection method
+ this.setDirection(d0, d1, d2);
@ -47,7 +47,7 @@
}
Vec3D vec3d = this.getMot();
@@ -147,6 +164,11 @@
@@ -157,6 +174,11 @@
} else {
this.velocityChanged();
if (damagesource.getEntity() != null) {
@ -59,7 +59,7 @@
Vec3D vec3d = damagesource.getEntity().getLookDirection();
this.setMot(vec3d);
@@ -155,6 +177,7 @@
@@ -165,6 +187,7 @@
this.dirZ = vec3d.z * 0.1D;
if (damagesource.getEntity() instanceof EntityLiving) {
this.shooter = (EntityLiving) damagesource.getEntity();

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityFireworks.java
+++ b/net/minecraft/server/EntityFireworks.java
@@ -3,12 +3,13 @@
@@ -3,6 +3,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.OptionalInt;
@ -8,14 +8,7 @@
public class EntityFireworks extends Entity implements IProjectile {
public static final DataWatcherObject<ItemStack> FIREWORK_ITEM = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.g);
private static final DataWatcherObject<OptionalInt> c = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.r);
- private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
+ public static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); // PAIL
private int ticksFlown;
public int expectedLifespan;
private EntityLiving ridingEntity;
@@ -133,7 +134,11 @@
@@ -130,7 +131,11 @@
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
@ -28,7 +21,7 @@
}
}
@@ -146,7 +151,11 @@
@@ -143,7 +148,11 @@
protected void a(MovingObjectPosition movingobjectposition) {
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY && !this.world.isClientSide) {
@ -38,13 +31,13 @@
+ this.explode();
+ }
+ // CraftBukkit end
} else if (this.z) {
} else if (this.w) {
BlockPosition blockposition;
@@ -158,7 +167,11 @@
@@ -155,7 +164,11 @@
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
if (this.l()) {
if (this.hasExplosions()) {
- this.explode();
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) {
@ -54,7 +47,7 @@
}
}
@@ -184,7 +197,9 @@
@@ -181,7 +194,9 @@
if (f > 0.0F) {
if (this.ridingEntity != null) {
@ -64,7 +57,7 @@
}
double d0 = 5.0D;
@@ -211,7 +226,9 @@
@@ -208,7 +223,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g(entityliving)) / 5.0D);

View File

@ -12,7 +12,7 @@
public class EntityFishingHook extends Entity {
@@ -207,6 +212,7 @@
@@ -204,6 +209,7 @@
}, RayTrace.BlockCollisionOption.COLLIDER, true);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
@ -20,10 +20,10 @@
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity();
this.n();
@@ -239,6 +245,10 @@
if (this.ar <= 0) {
this.as = 0;
this.at = 0;
@@ -236,6 +242,10 @@
if (this.ao <= 0) {
this.ap = 0;
this.aq = 0;
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
@ -31,7 +31,7 @@
} else {
this.setMot(this.getMot().add(0.0D, -0.2D * (double) this.random.nextFloat() * (double) this.random.nextFloat(), 0.0D));
}
@@ -274,6 +284,13 @@
@@ -271,6 +281,13 @@
worldserver.a(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
}
} else {
@ -45,7 +45,7 @@
Vec3D vec3d = this.getMot();
this.setMot(vec3d.x, (double) (-0.4F * MathHelper.a(this.random, 0.6F, 1.0F)), vec3d.z);
@@ -330,6 +347,14 @@
@@ -327,6 +344,14 @@
int i = 0;
if (this.hooked != null) {
@ -60,10 +60,10 @@
this.reel();
CriterionTriggers.D.a((EntityPlayer) this.owner, itemstack, this, Collections.emptyList());
this.world.broadcastEntityEffect(this, (byte) 31);
@@ -345,6 +370,15 @@
@@ -342,6 +367,15 @@
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack1);
EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), itemstack1);
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (FishHook) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
+ playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
@ -73,23 +73,23 @@
+ return 0;
+ }
+ // CraftBukkit end
double d0 = this.owner.locX - this.locX;
double d1 = this.owner.locY - this.locY;
double d2 = this.owner.locZ - this.locZ;
@@ -352,7 +386,11 @@
double d0 = this.owner.locX() - this.locX();
double d1 = this.owner.locY() - this.locY();
double d2 = this.owner.locZ() - this.locZ();
@@ -349,7 +383,11 @@
entityitem.setMot(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
this.world.addEntity(entityitem);
- this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(6) + 1));
- this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, this.random.nextInt(6) + 1));
+ // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
+ if (playerFishEvent.getExpToDrop() > 0) {
+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop()));
+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, playerFishEvent.getExpToDrop()));
+ }
+ // CraftBukkit end
if (itemstack1.getItem().a(TagsItem.FISHES)) {
this.owner.a(StatisticList.FISH_CAUGHT, 1);
}
@@ -362,8 +400,25 @@
@@ -359,8 +397,25 @@
}
if (this.isInGround) {

View File

@ -1,17 +1,17 @@
--- a/net/minecraft/server/EntityFox.java
+++ b/net/minecraft/server/EntityFox.java
@@ -267,8 +267,8 @@
private List<UUID> ek() {
@@ -263,8 +263,8 @@
private List<UUID> eE() {
List<UUID> list = Lists.newArrayList();
- list.add(((Optional) this.datawatcher.get(EntityFox.bB)).orElse((Object) null));
- list.add(((Optional) this.datawatcher.get(EntityFox.bC)).orElse((Object) null));
+ list.add(((Optional<UUID>) this.datawatcher.get(EntityFox.bB)).orElse(null)); // CraftBukkit - decompile error
+ list.add(((Optional<UUID>) this.datawatcher.get(EntityFox.bC)).orElse(null)); // CraftBukkit - decompile error
- list.add(((Optional) this.datawatcher.get(EntityFox.by)).orElse((Object) null));
- list.add(((Optional) this.datawatcher.get(EntityFox.bz)).orElse((Object) null));
+ list.add(((Optional<UUID>) this.datawatcher.get(EntityFox.by)).orElse(null)); // CraftBukkit - decompile error
+ list.add(((Optional<UUID>) this.datawatcher.get(EntityFox.bz)).orElse(null)); // CraftBukkit - decompile error
return list;
}
@@ -401,7 +401,7 @@
@@ -397,7 +397,7 @@
protected void a(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItemStack();
@ -20,7 +20,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -944,6 +944,11 @@
@@ -918,6 +918,11 @@
int i = (Integer) iblockdata.get(BlockSweetBerryBush.a);
iblockdata.set(BlockSweetBerryBush.a, 1);
@ -32,7 +32,7 @@
int j = 1 + EntityFox.this.world.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getEquipment(EnumItemSlot.MAINHAND);
@@ -983,7 +988,7 @@
@@ -957,7 +962,7 @@
private int f;
public r() {
@ -41,7 +41,7 @@
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
}
@@ -1035,7 +1040,7 @@
@@ -1009,7 +1014,7 @@
private int c;
public t() {
@ -50,7 +50,7 @@
this.c = EntityFox.this.random.nextInt(140);
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK, PathfinderGoal.Type.JUMP));
}
@@ -1146,7 +1151,7 @@
@@ -1120,7 +1125,7 @@
private EntityLiving k;
private int l;
@ -59,7 +59,7 @@
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
}
@@ -1181,7 +1186,7 @@
@@ -1155,7 +1160,7 @@
@Override
public void c() {
@ -67,8 +67,8 @@
+ EntityFox.this.setGoalTarget(this.j, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit
this.c = this.j;
if (this.k != null) {
this.l = this.k.ct();
@@ -1225,6 +1230,14 @@
this.l = this.k.cI();
@@ -1199,6 +1204,14 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.b(entityplayer1.getUniqueID());
}
@ -83,18 +83,18 @@
if (entityplayer2 != null) {
entityplayer2.a(StatisticList.ANIMALS_BRED);
@@ -1239,10 +1252,14 @@
@@ -1213,10 +1226,14 @@
this.partner.resetLove();
entityfox.setAgeRaw(-24000);
entityfox.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F);
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
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));
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), this.animal.getRandom().nextInt(7) + 1));
+ // CraftBukkit start - use event experience
+ if (experience > 0) {
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, experience));
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience));
+ }
+ // CraftBukkit end
}

Some files were not shown because too many files have changed in this diff Show More