mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
Update to Minecraft 1.9
This commit is contained in:
parent
e1ebe524a7
commit
aa008dff0f
305 changed files with 6684 additions and 6105 deletions
|
@ -1,62 +0,0 @@
|
|||
public+synthetic org/bukkit/Bukkit/getOnlinePlayers()[Lorg/bukkit/entity/Player;
|
||||
public+synthetic org/bukkit/Server/getOnlinePlayers()[Lorg/bukkit/entity/Player;
|
||||
|
||||
public+synthetic org/bukkit/entity/Damageable/damage(I)V
|
||||
public+synthetic org/bukkit/entity/Damageable/damage(ILorg/bukkit/entity/Entity;)V
|
||||
public+synthetic org/bukkit/entity/Damageable/getHealth()I
|
||||
public+synthetic org/bukkit/entity/Damageable/getMaxHealth()I
|
||||
public+synthetic org/bukkit/entity/Damageable/setHealth(I)V
|
||||
public+synthetic org/bukkit/entity/Damageable/setMaxHealth(I)V
|
||||
|
||||
public+synthetic org/bukkit/entity/LivingEntity/getLastDamage()I
|
||||
public+synthetic org/bukkit/entity/LivingEntity/setLastDamage(I)V
|
||||
|
||||
public+synthetic org/bukkit/entity/Minecart/getDamage()I
|
||||
public+synthetic org/bukkit/entity/Minecart/setDamage(I)V
|
||||
|
||||
public+synthetic org/bukkit/entity/Projectile/getShooter()Lorg/bukkit/entity/LivingEntity;
|
||||
public+synthetic org/bukkit/entity/Projectile/setShooter(Lorg/bukkit/entity/LivingEntity;)V
|
||||
|
||||
public+synthetic org/bukkit/event/entity/EntityDamageEvent/getDamage()I
|
||||
public+synthetic org/bukkit/event/entity/EntityDamageEvent/setDamage(I)V
|
||||
|
||||
public+synthetic org/bukkit/event/entity/EntityRegainHealthEvent/getAmount()I
|
||||
public+synthetic org/bukkit/event/entity/EntityRegainHealthEvent/setAmount(I)V
|
||||
|
||||
public+synthetic org/bukkit/event/vehicle/VehicleDamageEvent/getDamage()I
|
||||
public+synthetic org/bukkit/event/vehicle/VehicleDamageEvent/setDamage(I)V
|
||||
|
||||
# CraftBukkit
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/CraftServer/getOnlinePlayers()[Lorg/bukkit/entity/Player;
|
||||
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftArrow/getShooter()Lorg/bukkit/entity/LivingEntity;
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftArrow/setShooter(Lorg/bukkit/entity/LivingEntity;)V
|
||||
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftEnderDragonPart/damage(I)V
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftEnderDragonPart/damage(ILorg/bukkit/entity/Entity;)V
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftEnderDragonPart/getHealth()I
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftEnderDragonPart/getMaxHealth()I
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftEnderDragonPart/setHealth(I)V
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftEnderDragonPart/setMaxHealth(I)V
|
||||
|
||||
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftFireball/getShooter()Lorg/bukkit/entity/LivingEntity;
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftFireball/setShooter(Lorg/bukkit/entity/LivingEntity;)V
|
||||
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftFish/getShooter()Lorg/bukkit/entity/LivingEntity;
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftFish/setShooter(Lorg/bukkit/entity/LivingEntity;)V
|
||||
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/damage(I)V
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/damage(ILorg/bukkit/entity/Entity;)V
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/getHealth()I
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/getMaxHealth()I
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/setHealth(I)V
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/setMaxHealth(I)V
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/getLastDamage()I
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftLivingEntity/setLastDamage(I)V
|
||||
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftMinecart/getDamage()I
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftMinecart/setDamage(I)V
|
||||
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftProjectile/getShooter()Lorg/bukkit/entity/LivingEntity;
|
||||
public+synthetic org/bukkit/craftbukkit/v1_8_R3/entity/CraftProjectile/setShooter(Lorg/bukkit/entity/LivingEntity;)V
|
|
@ -1,27 +1,27 @@
|
|||
org/bukkit/Bukkit _INVALID_getOnlinePlayers ()[Lorg/bukkit/entity/Player; getOnlinePlayers
|
||||
org/bukkit/Server _INVALID_getOnlinePlayers ()[Lorg/bukkit/entity/Player; getOnlinePlayers
|
||||
org/bukkit/Bukkit getOnlinePlayers ()[Lorg/bukkit/entity/Player; _INVALID_getOnlinePlayers
|
||||
org/bukkit/Server getOnlinePlayers ()[Lorg/bukkit/entity/Player; _INVALID_getOnlinePlayers
|
||||
|
||||
org/bukkit/entity/Damageable _INVALID_damage (I)V damage
|
||||
org/bukkit/entity/Damageable _INVALID_damage (ILorg/bukkit/entity/Entity;)V damage
|
||||
org/bukkit/entity/Damageable _INVALID_getHealth ()I getHealth
|
||||
org/bukkit/entity/Damageable _INVALID_getMaxHealth ()I getMaxHealth
|
||||
org/bukkit/entity/Damageable _INVALID_setHealth (I)V setHealth
|
||||
org/bukkit/entity/Damageable _INVALID_setMaxHealth (I)V setMaxHealth
|
||||
org/bukkit/entity/Damageable damage (I)V _INVALID_damage
|
||||
org/bukkit/entity/Damageable damage (ILorg/bukkit/entity/Entity;)V _INVALID_damage
|
||||
org/bukkit/entity/Damageable getHealth ()I _INVALID_getHealth
|
||||
org/bukkit/entity/Damageable getMaxHealth ()I _INVALID_getMaxHealth
|
||||
org/bukkit/entity/Damageable setHealth (I)V _INVALID_setHealth
|
||||
org/bukkit/entity/Damageable setMaxHealth (I)V _INVALID_setMaxHealth
|
||||
|
||||
org/bukkit/entity/LivingEntity _INVALID_getLastDamage ()I getLastDamage
|
||||
org/bukkit/entity/LivingEntity _INVALID_setLastDamage (I)V setLastDamage
|
||||
org/bukkit/entity/LivingEntity getLastDamage ()I _INVALID_getLastDamage
|
||||
org/bukkit/entity/LivingEntity setLastDamage (I)V _INVALID_setLastDamage
|
||||
|
||||
org/bukkit/entity/Minecart _INVALID_getDamage ()I getDamage
|
||||
org/bukkit/entity/Minecart _INVALID_setDamage (I)V setDamage
|
||||
org/bukkit/entity/Minecart getDamage ()I _INVALID_getDamage
|
||||
org/bukkit/entity/Minecart setDamage (I)V _INVALID_setDamage
|
||||
|
||||
org/bukkit/entity/Projectile _INVALID_getShooter ()Lorg/bukkit/entity/LivingEntity; getShooter
|
||||
org/bukkit/entity/Projectile _INVALID_setShooter (Lorg/bukkit/entity/LivingEntity;)V setShooter
|
||||
org/bukkit/entity/Projectile getShooter ()Lorg/bukkit/entity/LivingEntity; _INVALID_getShooter
|
||||
org/bukkit/entity/Projectile setShooter (Lorg/bukkit/entity/LivingEntity;)V _INVALID_setShooter
|
||||
|
||||
org/bukkit/event/entity/EntityDamageEvent _INVALID_getDamage ()I getDamage
|
||||
org/bukkit/event/entity/EntityDamageEvent _INVALID_setDamage (I)V setDamage
|
||||
org/bukkit/event/entity/EntityDamageEvent getDamage ()I _INVALID_getDamage
|
||||
org/bukkit/event/entity/EntityDamageEvent setDamage (I)V _INVALID_setDamage
|
||||
|
||||
org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_getAmount ()I getAmount
|
||||
org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_setAmount (I)V setAmount
|
||||
org/bukkit/event/entity/EntityRegainHealthEvent getAmount ()I _INVALID_getAmount
|
||||
org/bukkit/event/entity/EntityRegainHealthEvent setAmount (I)V _INVALID_setAmount
|
||||
|
||||
org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_getDamage ()I getDamage
|
||||
org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_setDamage (I)V setDamage
|
||||
org/bukkit/event/vehicle/VehicleDamageEvent getDamage ()I _INVALID_getDamage
|
||||
org/bukkit/event/vehicle/VehicleDamageEvent setDamage (I)V _INVALID_setDamage
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- a/net/minecraft/server/BiomeTheEndDecorator.java
|
||||
+++ b/net/minecraft/server/BiomeTheEndDecorator.java
|
||||
@@ -21,7 +21,7 @@
|
||||
EntityEnderDragon entityenderdragon = new EntityEnderDragon(this.a);
|
||||
|
||||
entityenderdragon.setPositionRotation(0.0D, 128.0D, 0.0D, this.b.nextFloat() * 360.0F, 0.0F);
|
||||
- this.a.addEntity(entityenderdragon);
|
||||
+ this.a.addEntity(entityenderdragon, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,15 @@
|
|||
--- a/net/minecraft/server/Block.java
|
||||
+++ b/net/minecraft/server/Block.java
|
||||
@@ -336,7 +336,8 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
private String name;
|
||||
|
||||
public static int getId(Block block) {
|
||||
- return Block.REGISTRY.a((Object) block);
|
||||
+ return Block.REGISTRY.a(block); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static int getCombinedId(IBlockData iblockdata) {
|
||||
@@ -301,7 +301,8 @@
|
||||
int j = this.getDropCount(i, world.random);
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
|
@ -10,14 +19,34 @@
|
|||
Item item = this.getDropType(iblockdata, world.random, i);
|
||||
|
||||
if (item != null) {
|
||||
@@ -1002,4 +1003,10 @@
|
||||
return this.getBreakSound();
|
||||
}
|
||||
@@ -825,7 +826,7 @@
|
||||
|
||||
if (hashset.contains(block16)) {
|
||||
for (int i = 0; i < 15; ++i) {
|
||||
- int j = Block.REGISTRY.a((Object) block16) << 4 | i;
|
||||
+ int j = Block.REGISTRY.a(block16) << 4 | i; // CraftBukkit - decompile error
|
||||
|
||||
Block.REGISTRY_ID.a(block16.fromLegacyData(i), j);
|
||||
}
|
||||
@@ -834,7 +835,7 @@
|
||||
|
||||
while (iterator2.hasNext()) {
|
||||
IBlockData iblockdata = (IBlockData) iterator2.next();
|
||||
- int k = Block.REGISTRY.a((Object) block16) << 4 | block16.toLegacyData(iblockdata);
|
||||
+ int k = Block.REGISTRY.a(block16) << 4 | block16.toLegacyData(iblockdata); // CraftBukkit - decompile error
|
||||
|
||||
Block.REGISTRY_ID.a(iblockdata, k);
|
||||
}
|
||||
@@ -843,6 +844,12 @@
|
||||
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public int getExpDrop(World world, IBlockData data, int enchantmentLevel) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+
|
||||
private static void a(int i, MinecraftKey minecraftkey, Block block) {
|
||||
Block.REGISTRY.a(i, minecraftkey, block);
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
--- a/net/minecraft/server/BlockBloodStone.java
|
||||
+++ b/net/minecraft/server/BlockBloodStone.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockBloodStone extends Block {
|
||||
|
||||
public BlockBloodStone() {
|
||||
@@ -10,4 +12,17 @@
|
||||
public MaterialMapColor g(IBlockData iblockdata) {
|
||||
return MaterialMapColor.K;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public void doPhysics(World world, BlockPosition position, IBlockData iblockdata, Block block) {
|
||||
+ if (block != null && block.isPowerSource()) {
|
||||
+ org.bukkit.block.Block bl = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
+ int power = bl.getBlockPower();
|
||||
+
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(bl, power, power);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
|
@ -9,10 +9,10 @@
|
|||
+import org.bukkit.event.entity.EntityInteractEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class BlockButtonAbstract extends Block {
|
||||
public abstract class BlockButtonAbstract extends BlockDirectional {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing");
|
||||
@@ -124,6 +129,19 @@
|
||||
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
|
||||
@@ -121,6 +126,19 @@
|
||||
if (((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue()) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -31,10 +31,10 @@
|
|||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)), 3);
|
||||
world.b(blockposition, blockposition);
|
||||
world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
@@ -161,6 +179,16 @@
|
||||
if (this.N) {
|
||||
this.f(world, blockposition, iblockdata);
|
||||
this.a(entityhuman, world, blockposition);
|
||||
@@ -162,6 +180,16 @@
|
||||
if (this.I) {
|
||||
this.e(iblockdata, world, blockposition);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
|
@ -48,8 +48,8 @@
|
|||
+ // CraftBukkit end
|
||||
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false)));
|
||||
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
@@ -195,7 +223,41 @@
|
||||
this.b(world, blockposition);
|
||||
@@ -187,7 +215,41 @@
|
||||
boolean flag = !list.isEmpty();
|
||||
boolean flag1 = ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue();
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
|||
world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)));
|
||||
this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
|
||||
world.b(blockposition, blockposition);
|
||||
@@ -203,6 +265,16 @@
|
||||
@@ -195,6 +257,16 @@
|
||||
}
|
||||
|
||||
if (!flag && flag1) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
public class BlockCactus extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 15);
|
||||
@@ -28,9 +30,10 @@
|
||||
@@ -30,9 +32,10 @@
|
||||
int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue();
|
||||
|
||||
if (j == 15) {
|
||||
|
@ -21,7 +21,7 @@
|
|||
world.setTypeAndData(blockposition, iblockdata1, 4);
|
||||
this.doPhysics(world, blockposition1, iblockdata1, this);
|
||||
} else {
|
||||
@@ -83,7 +86,9 @@
|
||||
@@ -87,7 +90,9 @@
|
||||
}
|
||||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--- a/net/minecraft/server/BlockCake.java
|
||||
+++ b/net/minecraft/server/BlockCake.java
|
||||
@@ -55,7 +55,18 @@
|
||||
@@ -33,7 +33,18 @@
|
||||
private void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
if (entityhuman.j(false)) {
|
||||
entityhuman.b(StatisticList.H);
|
||||
if (entityhuman.l(false)) {
|
||||
entityhuman.b(StatisticList.J);
|
||||
- entityhuman.getFoodData().eat(2, 0.1F);
|
||||
+ // CraftBukkit start
|
||||
+ // entityhuman.getFoodData().eat(2, 0.1F);
|
||||
|
|
144
nms-patches/BlockCauldron.patch
Normal file
144
nms-patches/BlockCauldron.patch
Normal file
|
@ -0,0 +1,144 @@
|
|||
--- a/net/minecraft/server/BlockCauldron.java
|
||||
+++ b/net/minecraft/server/BlockCauldron.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
+import org.bukkit.event.block.CauldronLevelChangeEvent; // CraftBukkit
|
||||
|
||||
public class BlockCauldron extends Block {
|
||||
|
||||
@@ -42,8 +43,13 @@
|
||||
float f = (float) blockposition.getY() + (6.0F + (float) (3 * i)) / 16.0F;
|
||||
|
||||
if (!world.isClientSide && entity.isBurning() && i > 0 && entity.getBoundingBox().b <= (double) f) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH)) {
|
||||
+ return;
|
||||
+ }
|
||||
entity.extinguish();
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,17 +63,26 @@
|
||||
|
||||
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;
|
||||
+ }
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
entityhuman.a(enumhand, new ItemStack(Items.BUCKET));
|
||||
}
|
||||
|
||||
entityhuman.b(StatisticList.K);
|
||||
- this.a(world, blockposition, iblockdata, 3);
|
||||
+ // this.a(world, blockposition, iblockdata, 3);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return true;
|
||||
} 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;
|
||||
+ }
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
--itemstack.count;
|
||||
if (itemstack.count == 0) {
|
||||
@@ -78,7 +93,8 @@
|
||||
}
|
||||
|
||||
entityhuman.b(StatisticList.L);
|
||||
- this.a(world, blockposition, iblockdata, 0);
|
||||
+ // this.a(world, blockposition, iblockdata, 0);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -87,6 +103,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;
|
||||
+ }
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack1 = PotionUtil.a(new ItemStack(Items.POTION), Potions.b);
|
||||
entityhuman.b(StatisticList.L);
|
||||
@@ -99,7 +119,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -108,8 +129,13 @@
|
||||
ItemArmor itemarmor = (ItemArmor) item;
|
||||
|
||||
if (itemarmor.d() == ItemArmor.EnumArmorMaterial.LEATHER && itemarmor.e_(itemstack) && !world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
|
||||
+ return true;
|
||||
+ }
|
||||
itemarmor.c(itemstack);
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ // CraftBukkit end
|
||||
entityhuman.b(StatisticList.M);
|
||||
return true;
|
||||
}
|
||||
@@ -134,7 +160,7 @@
|
||||
}
|
||||
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
- this.a(world, blockposition, iblockdata, i - 1);
|
||||
+ this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,9 +173,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
- world.setTypeAndData(blockposition, iblockdata.set(BlockCauldron.LEVEL, Integer.valueOf(MathHelper.clamp(i, 0, 3))), 2);
|
||||
+ this.changeLevel(world, blockposition, iblockdata, i, null, CauldronLevelChangeEvent.ChangeReason.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ private boolean changeLevel(World world, BlockPosition blockposition, IBlockData iblockdata, int i, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
|
||||
+ int newLevel = Integer.valueOf(MathHelper.clamp(i, 0, 3));
|
||||
+ CauldronLevelChangeEvent event = new CauldronLevelChangeEvent(
|
||||
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
+ entity.getBukkitEntity(), reason, iblockdata.get(BlockCauldron.LEVEL), newLevel
|
||||
+ );
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ world.setTypeAndData(blockposition, iblockdata.set(BlockCauldron.LEVEL, newLevel), 2);
|
||||
world.updateAdjacentComparators(blockposition, this);
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void h(World world, BlockPosition blockposition) {
|
||||
@@ -160,7 +202,7 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
if (((Integer) iblockdata.get(BlockCauldron.LEVEL)).intValue() < 3) {
|
||||
- world.setTypeAndData(blockposition, iblockdata.a((IBlockState) BlockCauldron.LEVEL), 2);
|
||||
+ a(world, blockposition, iblockdata.a((IBlockState) BlockCauldron.LEVEL), 2); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
92
nms-patches/BlockChorusFlower.patch
Normal file
92
nms-patches/BlockChorusFlower.patch
Normal file
|
@ -0,0 +1,92 @@
|
|||
--- a/net/minecraft/server/BlockChorusFlower.java
|
||||
+++ b/net/minecraft/server/BlockChorusFlower.java
|
||||
@@ -3,6 +3,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockChorusFlower extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 5);
|
||||
@@ -66,8 +68,20 @@
|
||||
}
|
||||
|
||||
if (flag && a(world, blockposition1, (EnumDirection) null) && world.isEmpty(blockposition.up(2))) {
|
||||
- world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
- this.a(world, blockposition1, i);
|
||||
+ // world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
+ // this.a(world, blockposition1, i);
|
||||
+ // CraftBukkit start - add event
|
||||
+ BlockPosition target = blockposition.up();
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(
|
||||
+ world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()),
|
||||
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
+ this,
|
||||
+ toLegacyData(this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)))
|
||||
+ )) {
|
||||
+ world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
+ world.triggerEffect(1033, blockposition, 0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (i < 4) {
|
||||
j = random.nextInt(4);
|
||||
boolean flag2 = false;
|
||||
@@ -81,18 +95,53 @@
|
||||
BlockPosition blockposition2 = blockposition.shift(enumdirection);
|
||||
|
||||
if (world.isEmpty(blockposition2) && world.isEmpty(blockposition2.down()) && a(world, blockposition2, enumdirection.opposite())) {
|
||||
- this.a(world, blockposition2, i + 1);
|
||||
- flag2 = true;
|
||||
+ // CraftBukkit start - add event
|
||||
+ // this.a(world, blockposition2, i + 1);
|
||||
+ BlockPosition target = blockposition1;
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(
|
||||
+ world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()),
|
||||
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
+ this,
|
||||
+ toLegacyData(this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)))
|
||||
+ )) {
|
||||
+ world.triggerEffect(1033, blockposition, 0);
|
||||
+ flag2 = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
} else {
|
||||
- this.c(world, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(
|
||||
+ world,
|
||||
+ blockposition.getX(),
|
||||
+ blockposition.getY(),
|
||||
+ blockposition.getZ(),
|
||||
+ this,
|
||||
+ toLegacyData(iblockdata.set(BlockChorusFlower.AGE, Integer.valueOf(5)))
|
||||
+ )) {
|
||||
+ world.triggerEffect(1034, blockposition, 0);
|
||||
+ }
|
||||
+ // this.c(world, blockposition);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (i == 4) {
|
||||
- this.c(world, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(
|
||||
+ world,
|
||||
+ blockposition.getX(),
|
||||
+ blockposition.getY(),
|
||||
+ blockposition.getZ(),
|
||||
+ this,
|
||||
+ toLegacyData(iblockdata.set(BlockChorusFlower.AGE, Integer.valueOf(5)))
|
||||
+ )) {
|
||||
+ world.triggerEffect(1034, blockposition, 0);
|
||||
+ }
|
||||
+ // this.c(world, blockposition);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockCocoa extends BlockDirectional implements IBlockFragilePlantElement {
|
||||
public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 2);
|
||||
@@ -19,7 +21,10 @@
|
||||
@@ -23,7 +25,10 @@
|
||||
int i = ((Integer) iblockdata.get(BlockCocoa.AGE)).intValue();
|
||||
|
||||
if (i < 2) {
|
||||
|
@ -21,7 +21,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +130,10 @@
|
||||
@@ -124,7 +129,10 @@
|
||||
}
|
||||
|
||||
public void b(World world, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
|
|
|
@ -6,15 +6,16 @@
|
|||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockCommand extends BlockContainer {
|
||||
public class BlockCommand extends BlockTileEntity {
|
||||
|
||||
public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered");
|
||||
@@ -20,10 +22,19 @@
|
||||
boolean flag = world.isBlockIndirectlyPowered(blockposition);
|
||||
boolean flag1 = ((Boolean) iblockdata.get(BlockCommand.TRIGGERED)).booleanValue();
|
||||
public static final BlockStateDirection a = BlockDirectional.FACING;
|
||||
@@ -29,7 +31,17 @@
|
||||
boolean flag1 = tileentitycommand.d();
|
||||
boolean flag2 = tileentitycommand.e();
|
||||
|
||||
- if (flag && !flag1) {
|
||||
- if (flag && !flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: This section - renames, ordering
|
||||
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ int old = flag1 ? 15 : 0;
|
||||
+ int current = flag ? 15 : 0;
|
||||
|
@ -24,10 +25,15 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockCommand.TRIGGERED, Boolean.valueOf(true)), 4);
|
||||
world.a(blockposition, (Block) this, this.a(world));
|
||||
- } else if (!flag && flag1) {
|
||||
tileentitycommand.a(true);
|
||||
if (tileentitycommand.i() != TileEntityCommand.Type.SEQUENCE && !flag2) {
|
||||
boolean flag3 = !tileentitycommand.j() || this.e(world, blockposition, iblockdata);
|
||||
@@ -40,7 +52,7 @@
|
||||
this.c(world, blockposition);
|
||||
}
|
||||
}
|
||||
- } else if (!flag && flag1) {
|
||||
+ } else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockCommand.TRIGGERED, Boolean.valueOf(false)), 4);
|
||||
}
|
||||
}
|
||||
tileentitycommand.a(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,27 +9,27 @@
|
|||
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 7);
|
||||
@@ -31,7 +33,10 @@
|
||||
@@ -53,7 +55,10 @@
|
||||
float f = a((Block) this, world, blockposition);
|
||||
|
||||
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
- world.setTypeAndData(blockposition, iblockdata.set(BlockCrops.AGE, Integer.valueOf(i + 1)), 2);
|
||||
- world.setTypeAndData(blockposition, this.setAge(i + 1), 2);
|
||||
+ // CraftBukkit start
|
||||
+ IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1));
|
||||
+ IBlockData data = this.setAge(i + 1);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +50,10 @@
|
||||
i = 7;
|
||||
@@ -68,7 +73,10 @@
|
||||
i = j;
|
||||
}
|
||||
|
||||
- world.setTypeAndData(blockposition, iblockdata.set(BlockCrops.AGE, Integer.valueOf(i)), 2);
|
||||
- world.setTypeAndData(blockposition, this.setAge(i), 2);
|
||||
+ // CraftBukkit start
|
||||
+ IBlockData data = iblockdata.set(AGE, Integer.valueOf(i));
|
||||
+ IBlockData data = this.setAge(i);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected static float a(Block block, World world, BlockPosition blockposition) {
|
||||
protected int b(World world) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/server/BlockDaylightDetector.java
|
||||
+++ b/net/minecraft/server/BlockDaylightDetector.java
|
||||
@@ -41,6 +41,7 @@
|
||||
}
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
i = MathHelper.clamp(i, 0, 15);
|
||||
if (((Integer) iblockdata.get(BlockDaylightDetector.POWER)).intValue() != i) {
|
||||
+ i = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), ((Integer) iblockdata.get(POWER)), i).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockDaylightDetector.POWER, Integer.valueOf(i)), 3);
|
||||
|
|
|
@ -6,25 +6,25 @@
|
|||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public abstract class BlockDiodeAbstract extends BlockDirectional {
|
||||
public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
|
||||
|
||||
protected final boolean N;
|
||||
@@ -31,8 +33,18 @@
|
||||
protected static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D);
|
||||
@@ -35,8 +37,18 @@
|
||||
boolean flag = this.e(world, blockposition, iblockdata);
|
||||
|
||||
if (this.N && !flag) {
|
||||
if (this.d && !flag) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, this.k(iblockdata), 2);
|
||||
} else if (!this.N) {
|
||||
world.setTypeAndData(blockposition, this.y(iblockdata), 2);
|
||||
} else if (!this.d) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, this.e(iblockdata), 2);
|
||||
world.setTypeAndData(blockposition, this.x(iblockdata), 2);
|
||||
if (!flag) {
|
||||
world.a(blockposition, this.e(iblockdata).getBlock(), this.m(iblockdata), -1);
|
||||
world.a(blockposition, this.x(iblockdata).getBlock(), this.D(iblockdata), -1);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@@ -8,6 +8,7 @@
|
||||
public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered");
|
||||
public static final RegistryDefault<Item, IDispenseBehavior> REGISTRY = new RegistryDefault(new DispenseBehaviorItem());
|
||||
protected Random O = new Random();
|
||||
protected Random d = new Random();
|
||||
+ public static boolean eventFired = false; // CraftBukkit
|
||||
|
||||
protected BlockDispenser() {
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--- a/net/minecraft/server/BlockDoor.java
|
||||
+++ b/net/minecraft/server/BlockDoor.java
|
||||
@@ -3,6 +3,8 @@
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL);
|
||||
@@ -155,9 +157,22 @@
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -137,9 +139,22 @@
|
||||
this.b(world, blockposition, iblockdata, 0);
|
||||
}
|
||||
} else {
|
||||
- boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition2);
|
||||
|
||||
- if ((flag1 || block.isPowerSource()) && block != this && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) {
|
||||
- if (block != this && (flag1 || block.getBlockData().m()) && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
|
@ -34,8 +34,8 @@
|
|||
world.setTypeAndData(blockposition2, iblockdata2.set(BlockDoor.POWERED, Boolean.valueOf(flag1)), 2);
|
||||
if (flag1 != ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.OPEN, Boolean.valueOf(flag1)), 2);
|
||||
@@ -165,6 +180,7 @@
|
||||
world.a((EntityHuman) null, flag1 ? 1003 : 1006, blockposition, 0);
|
||||
@@ -147,6 +162,7 @@
|
||||
world.a((EntityHuman) null, flag1 ? this.g() : this.e(), blockposition, 0);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
+
|
||||
public class BlockDragonEgg extends Block {
|
||||
|
||||
public BlockDragonEgg() {
|
||||
@@ -61,6 +63,18 @@
|
||||
protected static final AxisAlignedBB a = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D);
|
||||
@@ -66,6 +68,18 @@
|
||||
BlockPosition blockposition1 = blockposition.a(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
|
||||
|
||||
if (world.getType(blockposition1).getBlock().material == Material.AIR) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
+
|
||||
public class BlockDropper extends BlockDispenser {
|
||||
|
||||
private final IDispenseBehavior P = new DispenseBehaviorItem();
|
||||
private final IDispenseBehavior e = new DispenseBehaviorItem();
|
||||
@@ -38,8 +43,25 @@
|
||||
itemstack1 = null;
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockEnderPortal extends BlockContainer {
|
||||
public class BlockEnderPortal extends BlockTileEntity {
|
||||
|
||||
protected BlockEnderPortal(Material material) {
|
||||
protected static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D);
|
||||
@@ -36,6 +38,10 @@
|
||||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (entity.vehicle == null && entity.passenger == null && !world.isClientSide) {
|
||||
if (!entity.isPassenger() && !entity.isVehicle() && entity.aV() && !world.isClientSide && entity.getBoundingBox().b(iblockdata.c(world, blockposition).a(blockposition))) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
public class BlockFire extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 15);
|
||||
@@ -109,7 +115,7 @@
|
||||
@@ -93,7 +99,7 @@
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (world.getGameRules().getBoolean("doFireTick")) {
|
||||
if (!this.canPlace(world, blockposition)) {
|
||||
|
@ -22,19 +22,19 @@
|
|||
}
|
||||
|
||||
Block block = world.getType(blockposition.down()).getBlock();
|
||||
@@ -120,7 +126,7 @@
|
||||
}
|
||||
@@ -106,7 +112,7 @@
|
||||
int i = ((Integer) iblockdata.get(BlockFire.AGE)).intValue();
|
||||
|
||||
if (!flag && world.S() && this.e(world, blockposition)) {
|
||||
if (!flag && world.W() && this.b(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - extinguished by rain
|
||||
} else {
|
||||
int i = ((Integer) iblockdata.get(BlockFire.AGE)).intValue();
|
||||
|
||||
@@ -133,14 +139,14 @@
|
||||
if (i < 15) {
|
||||
iblockdata = iblockdata.set(BlockFire.AGE, Integer.valueOf(i + random.nextInt(3) / 2));
|
||||
@@ -117,14 +123,14 @@
|
||||
if (!flag) {
|
||||
if (!this.f(world, blockposition)) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) || i > 3) {
|
||||
if (!this.c(world, blockposition)) {
|
||||
if (!world.getType(blockposition.down()).q() || i > 3) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
@ -42,13 +42,13 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (!this.e((IBlockAccess) world, blockposition.down()) && i == 15 && random.nextInt(4) == 0) {
|
||||
if (!this.c((IBlockAccess) world, blockposition.down()) && i == 15 && random.nextInt(4) == 0) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +192,26 @@
|
||||
@@ -170,7 +176,26 @@
|
||||
l1 = 15;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -224,6 +249,17 @@
|
||||
@@ -208,6 +233,17 @@
|
||||
if (random.nextInt(i) < k) {
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
|||
if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {
|
||||
int l = j + random.nextInt(5) / 4;
|
||||
|
||||
@@ -233,7 +269,7 @@
|
||||
@@ -217,7 +253,7 @@
|
||||
|
||||
world.setTypeAndData(blockposition, this.getBlockData().set(BlockFire.AGE, Integer.valueOf(l)), 3);
|
||||
} else {
|
||||
|
@ -103,27 +103,27 @@
|
|||
}
|
||||
|
||||
if (iblockdata.getBlock() == Blocks.TNT) {
|
||||
@@ -290,7 +326,7 @@
|
||||
@@ -274,7 +310,7 @@
|
||||
|
||||
public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) && !this.f(world, blockposition)) {
|
||||
if (!world.getType(blockposition.down()).q() && !this.c(world, blockposition)) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block gone
|
||||
}
|
||||
|
||||
}
|
||||
@@ -298,7 +334,7 @@
|
||||
@@ -282,7 +318,7 @@
|
||||
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (world.worldProvider.getDimension() > 0 || !Blocks.PORTAL.e(world, blockposition)) {
|
||||
if (!World.a((IBlockAccess) world, blockposition.down()) && !this.f(world, blockposition)) {
|
||||
if (world.worldProvider.getDimensionManager().getDimensionID() > 0 || !Blocks.PORTAL.b(world, blockposition)) {
|
||||
if (!world.getType(blockposition.down()).q() && !this.c(world, blockposition)) {
|
||||
- world.setAir(blockposition);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
|
||||
} else {
|
||||
world.a(blockposition, (Block) this, this.a(world) + world.random.nextInt(10));
|
||||
}
|
||||
@@ -320,4 +356,12 @@
|
||||
@@ -304,4 +340,12 @@
|
||||
protected BlockStateList getStateList() {
|
||||
return new BlockStateList(this, new IBlockState[] { BlockFire.AGE, BlockFire.NORTH, BlockFire.EAST, BlockFire.SOUTH, BlockFire.WEST, BlockFire.UPPER, BlockFire.FLIP, BlockFire.ALT});
|
||||
return new BlockStateList(this, new IBlockState[] { BlockFire.AGE, BlockFire.NORTH, BlockFire.EAST, BlockFire.SOUTH, BlockFire.WEST, BlockFire.UPPER});
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
+ server.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (!event.isCancelled()) {
|
||||
if (this.material == Material.LAVA && world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER) {
|
||||
if (this.material == Material.LAVA && world.getType(blockposition.down()).getMaterial() == Material.WATER) {
|
||||
world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
|
||||
this.fizz(world, blockposition.down());
|
||||
@@ -99,6 +115,8 @@
|
||||
|
@ -44,7 +44,7 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (i >= 0 && (i == 0 || this.g(world, blockposition.down(), iblockdata2))) {
|
||||
Set set = this.f(world, blockposition);
|
||||
Set set = this.c(world, blockposition);
|
||||
|
||||
@@ -116,14 +134,23 @@
|
||||
while (iterator1.hasNext()) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@@ -22,7 +30,19 @@
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (!world.isClientSide) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().p() > 2) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).c() > 2) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
|
@ -36,10 +36,10 @@
|
|||
} else {
|
||||
if (world.getLightLevel(blockposition.up()) >= 9) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@@ -31,7 +51,19 @@
|
||||
IBlockData iblockdata1 = world.getType(blockposition1);
|
||||
@@ -36,7 +56,19 @@
|
||||
IBlockData iblockdata2 = world.getType(blockposition1);
|
||||
|
||||
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.p() <= 2) {
|
||||
if (iblockdata2.getBlock() == Blocks.DIRT && iblockdata2.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && iblockdata1.c() <= 2) {
|
||||
- world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData());
|
||||
|
@ -57,8 +57,8 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -74,13 +106,15 @@
|
||||
IBlockData iblockdata1 = blockflowers.getBlockData().set(blockflowers.n(), blockflowers_enumflowervarient);
|
||||
@@ -79,13 +111,15 @@
|
||||
IBlockData iblockdata1 = blockflowers.getBlockData().set(blockflowers.g(), blockflowers_enumflowervarient);
|
||||
|
||||
if (blockflowers.f(world, blockposition2, iblockdata1)) {
|
||||
- world.setTypeAndData(blockposition2, iblockdata1, 3);
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
--- a/net/minecraft/server/BlockIce.java
|
||||
+++ b/net/minecraft/server/BlockIce.java
|
||||
@@ -44,6 +44,12 @@
|
||||
@@ -50,6 +50,11 @@
|
||||
}
|
||||
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (world.b(EnumSkyBlock.BLOCK, blockposition) > 11 - this.p()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), world.worldProvider.n() ? Blocks.AIR : Blocks.WATER).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (world.worldProvider.n()) {
|
||||
world.setAir(blockposition);
|
||||
} else {
|
||||
protected void b(World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), world.worldProvider.l() ? Blocks.AIR : Blocks.WATER).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.worldProvider.l()) {
|
||||
world.setAir(blockposition);
|
||||
} else {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
|
||||
+
|
||||
public abstract class BlockLeaves extends BlockTransparent {
|
||||
public abstract class BlockLeaves extends Block {
|
||||
|
||||
public static final BlockStateBoolean DECAYABLE = BlockStateBoolean.of("decayable");
|
||||
@@ -130,6 +132,14 @@
|
||||
@@ -132,6 +134,14 @@
|
||||
}
|
||||
|
||||
private void e(World world, BlockPosition blockposition) {
|
||||
private void b(World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
public class BlockLever extends Block {
|
||||
|
||||
public static final BlockStateEnum<BlockLever.EnumLeverPosition> FACING = BlockStateEnum.of("facing", BlockLever.EnumLeverPosition.class);
|
||||
@@ -155,6 +157,20 @@
|
||||
@@ -127,6 +129,20 @@
|
||||
if (world.isClientSide) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@
|
|||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
iblockdata = iblockdata.a(BlockLever.POWERED);
|
||||
+
|
||||
iblockdata = iblockdata.a((IBlockState) BlockLever.POWERED);
|
||||
world.setTypeAndData(blockposition, iblockdata, 3);
|
||||
world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, ((Boolean) iblockdata.get(BlockLever.POWERED)).booleanValue() ? 0.6F : 0.5F);
|
||||
float f3 = ((Boolean) iblockdata.get(BlockLever.POWERED)).booleanValue() ? 0.6F : 0.5F;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/BlockMinecartDetector.java
|
||||
+++ b/net/minecraft/server/BlockMinecartDetector.java
|
||||
@@ -4,6 +4,8 @@
|
||||
@@ -5,6 +5,8 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
||||
|
||||
public static final BlockStateEnum<BlockMinecartTrackAbstract.EnumTrackPosition> SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() {
|
||||
@@ -64,6 +66,17 @@
|
||||
@@ -65,6 +67,17 @@
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
|
@ -26,4 +26,4 @@
|
|||
+
|
||||
if (flag1 && !flag) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockMinecartDetector.POWERED, Boolean.valueOf(true)), 3);
|
||||
world.applyPhysics(blockposition, this);
|
||||
this.b(world, blockposition, iblockdata, true);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
--- a/net/minecraft/server/BlockMinecartTrackAbstract.java
|
||||
+++ b/net/minecraft/server/BlockMinecartTrackAbstract.java
|
||||
@@ -87,7 +87,7 @@
|
||||
flag = true;
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
protected static final AxisAlignedBB b = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.15625D, 1.0D);
|
||||
protected final boolean c;
|
||||
|
||||
- if (flag) {
|
||||
+ if (flag && !world.isEmpty(blockposition)) { // CraftBukkit - SPIGOT-424, MC-73474
|
||||
this.b(world, blockposition, iblockdata, 0);
|
||||
world.setAir(blockposition);
|
||||
} else {
|
||||
+ // PAIL: We stage this entire file just to unsynthetic this method. We should rename and AT it in future
|
||||
public static boolean b(World world, BlockPosition blockposition) {
|
||||
return i(world.getType(blockposition));
|
||||
}
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b(IBlockData iblockdata) {
|
||||
|
|
|
@ -15,6 +15,6 @@
|
|||
entitysilverfish.setPositionRotation((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
|
||||
- world.addEntity(entitysilverfish);
|
||||
+ world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
|
||||
entitysilverfish.y();
|
||||
entitysilverfish.doSpawnEffect();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
+
|
||||
public class BlockMushroom extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
protected BlockMushroom() {
|
||||
@@ -13,6 +19,7 @@
|
||||
protected static final AxisAlignedBB a = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.4000000059604645D, 0.699999988079071D);
|
||||
@@ -16,6 +22,7 @@
|
||||
}
|
||||
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
|
@ -21,7 +21,7 @@
|
|||
if (random.nextInt(25) == 0) {
|
||||
int i = 5;
|
||||
boolean flag = true;
|
||||
@@ -40,7 +47,19 @@
|
||||
@@ -43,7 +50,19 @@
|
||||
}
|
||||
|
||||
if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) {
|
||||
|
@ -42,7 +42,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +88,10 @@
|
||||
@@ -72,8 +91,10 @@
|
||||
WorldGenHugeMushroom worldgenhugemushroom = null;
|
||||
|
||||
if (this == Blocks.BROWN_MUSHROOM) {
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
@@ -22,7 +29,19 @@
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (!world.isClientSide) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().p() > 2) {
|
||||
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).c() > 2) {
|
||||
- world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.DIRT));
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, EnumDirtVariant.DIRT));
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.DIRT));
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ BlockState blockState = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState();
|
||||
+ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.DIRT));
|
||||
|
@ -36,9 +36,9 @@
|
|||
if (world.getLightLevel(blockposition.up()) >= 9) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@@ -31,7 +50,19 @@
|
||||
Block block = world.getType(blockposition1.up()).getBlock();
|
||||
IBlockData iblockdata2 = world.getType(blockposition1.up());
|
||||
|
||||
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.p() <= 2) {
|
||||
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && iblockdata2.c() <= 2) {
|
||||
- world.setTypeUpdate(blockposition1, this.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ // world.setTypeUpdate(blockposition1, this.getBlockData());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/BlockNetherWart.java
|
||||
+++ b/net/minecraft/server/BlockNetherWart.java
|
||||
@@ -29,7 +29,8 @@
|
||||
@@ -31,7 +31,8 @@
|
||||
|
||||
if (i < 3 && random.nextInt(10) == 0) {
|
||||
iblockdata = iblockdata.set(BlockNetherWart.AGE, Integer.valueOf(i + 1));
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
if (this.getDropType(iblockdata, world.random, i) != Item.getItemOf(this)) {
|
||||
int j = 0;
|
||||
|
||||
@@ -54,9 +55,34 @@
|
||||
@@ -54,13 +55,42 @@
|
||||
|
||||
this.dropExperience(world, blockposition, j);
|
||||
}
|
||||
|
@ -40,6 +40,14 @@
|
|||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
public int getDropData(World world, BlockPosition blockposition) {
|
||||
return 0;
|
||||
public ItemStack a(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
return new ItemStack(this);
|
||||
}
|
||||
|
||||
+ public int getDropData(World world, BlockPosition blockposition) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
public int getDropData(IBlockData iblockdata) {
|
||||
return this == Blocks.LAPIS_ORE ? EnumColor.BLUE.getInvColorIndex() : 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/BlockPiston.java
|
||||
+++ b/net/minecraft/server/BlockPiston.java
|
||||
@@ -2,6 +2,18 @@
|
||||
|
||||
@@ -4,6 +4,18 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -16,10 +16,10 @@
|
|||
+import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPiston extends Block {
|
||||
public class BlockPiston extends BlockDirectional {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing");
|
||||
@@ -56,6 +68,17 @@
|
||||
public static final BlockStateBoolean EXTENDED = BlockStateBoolean.of("extended");
|
||||
@@ -98,6 +110,18 @@
|
||||
world.playBlockAction(blockposition, this, 0, enumdirection.a());
|
||||
}
|
||||
} else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) {
|
||||
|
@ -33,23 +33,24 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // PAIL: checkME - what happened to setTypeAndData?
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockPiston.EXTENDED, Boolean.valueOf(false)), 2);
|
||||
world.playBlockAction(blockposition, this, 1, enumdirection.a());
|
||||
}
|
||||
@@ -146,7 +169,7 @@
|
||||
|
||||
@@ -188,7 +212,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!flag1 && block.getMaterial() != Material.AIR && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.k() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) {
|
||||
+ if (!flag1 && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.k() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition
|
||||
- if (!flag1 && iblockdata1.getMaterial() != Material.AIR && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false) && (iblockdata1.o() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) {
|
||||
+ if (!flag1 && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false) && (iblockdata1.o() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition
|
||||
this.a(world, blockposition, enumdirection, false);
|
||||
}
|
||||
} else {
|
||||
@@ -286,10 +309,53 @@
|
||||
if (!pistonextendschecker.a()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -284,6 +308,48 @@
|
||||
int j = list.size() + list1.size();
|
||||
IBlockData[] aiblockdata = new IBlockData[j];
|
||||
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
|
||||
+ // CraftBukkit start
|
||||
+ final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+
|
||||
|
@ -72,11 +73,6 @@
|
|||
+ return bblock.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
int i = list.size() + list1.size();
|
||||
Block[] ablock = new Block[i];
|
||||
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
|
||||
|
||||
+ org.bukkit.event.block.BlockPistonEvent event;
|
||||
+ if (flag) {
|
||||
+ event = new BlockPistonExtendEvent(bblock, blocks, CraftBlock.notchToBlockFace(enumdirection1));
|
||||
|
@ -87,16 +83,16 @@
|
|||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ for (BlockPosition b : broken) {
|
||||
+ world.notify(b);
|
||||
+ world.notify(b, Blocks.AIR.getBlockData(), world.getType(b), 3);
|
||||
+ }
|
||||
+ for (BlockPosition b : moved) {
|
||||
+ world.notify(b);
|
||||
+ world.notify(b.shift(enumdirection1));
|
||||
+ world.notify(b, Blocks.AIR.getBlockData(), world.getType(b), 3);
|
||||
+ b = b.shift(enumdirection1);
|
||||
+ world.notify(b, Blocks.AIR.getBlockData(), world.getType(b), 3);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
int j;
|
||||
BlockPosition blockposition1;
|
||||
|
||||
int k;
|
||||
BlockPosition blockposition2;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
public class BlockPlant extends Block {
|
||||
|
||||
@@ -40,6 +44,15 @@
|
||||
@@ -39,6 +43,15 @@
|
||||
|
||||
protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (!this.f(world, blockposition, iblockdata)) {
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
public class BlockPortal extends BlockHalfTransparent {
|
||||
|
||||
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockStateEnum.of("axis", EnumDirection.EnumAxis.class, new EnumDirection.EnumAxis[] { EnumDirection.EnumAxis.X, EnumDirection.EnumAxis.Z});
|
||||
@@ -25,7 +28,8 @@
|
||||
@@ -42,7 +45,8 @@
|
||||
}
|
||||
|
||||
if (i > 0 && !world.getType(blockposition1.up()).getBlock().isOccluding()) {
|
||||
- Entity entity = ItemMonsterEgg.a(world, 57, (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D);
|
||||
if (i > 0 && !world.getType(blockposition1.up()).l()) {
|
||||
- Entity entity = ItemMonsterEgg.a(world, EntityTypes.getName(EntityPigZombie.class), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D);
|
||||
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
|
||||
+ Entity entity = ItemMonsterEgg.spawnCreature(world, 57, (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
||||
+ Entity entity = ItemMonsterEgg.spawnCreature(world, EntityTypes.getName(EntityPigZombie.class), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
||||
|
||||
if (entity != null) {
|
||||
entity.portalCooldown = entity.aq();
|
||||
@@ -67,14 +71,16 @@
|
||||
entity.portalCooldown = entity.aC();
|
||||
@@ -68,14 +72,16 @@
|
||||
BlockPortal.Shape blockportal_shape = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.X);
|
||||
|
||||
if (blockportal_shape.d() && blockportal_shape.e == 0) {
|
||||
|
@ -41,18 +41,18 @@
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -105,6 +111,10 @@
|
||||
@@ -106,6 +112,10 @@
|
||||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (entity.vehicle == null && entity.passenger == null) {
|
||||
if (!entity.isPassenger() && !entity.isVehicle() && entity.aV()) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
entity.d(blockposition);
|
||||
entity.e(blockposition);
|
||||
}
|
||||
|
||||
@@ -185,6 +195,7 @@
|
||||
@@ -251,6 +261,7 @@
|
||||
private BlockPosition position;
|
||||
private int height;
|
||||
private int width;
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
public Shape(World world, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
this.a = world;
|
||||
@@ -243,6 +254,10 @@
|
||||
@@ -309,6 +320,10 @@
|
||||
}
|
||||
|
||||
protected int c() {
|
||||
|
@ -71,7 +71,7 @@
|
|||
int i;
|
||||
|
||||
label56:
|
||||
@@ -263,11 +278,21 @@
|
||||
@@ -329,11 +344,21 @@
|
||||
block = this.a.getType(blockposition.shift(this.d)).getBlock();
|
||||
if (block != Blocks.OBSIDIAN) {
|
||||
break label56;
|
||||
|
@ -93,7 +93,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -277,6 +302,11 @@
|
||||
@@ -343,6 +368,11 @@
|
||||
if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) {
|
||||
this.height = 0;
|
||||
break;
|
||||
|
@ -105,7 +105,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +328,27 @@
|
||||
@@ -364,7 +394,27 @@
|
||||
return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@
|
|||
for (int i = 0; i < this.width; ++i) {
|
||||
BlockPosition blockposition = this.position.shift(this.c, i);
|
||||
|
||||
@@ -307,6 +357,7 @@
|
||||
@@ -373,6 +423,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
+
|
||||
public abstract class BlockPressurePlateAbstract extends Block {
|
||||
|
||||
protected BlockPressurePlateAbstract(Material material) {
|
||||
@@ -99,6 +101,19 @@
|
||||
protected static final AxisAlignedBB a = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.03125D, 0.9375D);
|
||||
@@ -93,6 +95,19 @@
|
||||
boolean flag = i > 0;
|
||||
boolean flag1 = j > 0;
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
|
||||
@@ -45,6 +47,26 @@
|
||||
@@ -63,6 +65,26 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
+ // CraftBukkit start - Call interact event when turning on a pressure plate
|
||||
+ if (this.e(world.getType(blockposition)) == 0) {
|
||||
+ if (this.getPower(world.getType(blockposition)) == 0) {
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
|
@ -33,6 +33,6 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!entity.aI()) {
|
||||
if (!entity.isIgnoreBlockTrigger()) {
|
||||
return 15;
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
@@ -16,7 +18,31 @@
|
||||
}
|
||||
|
||||
protected int f(World world, BlockPosition blockposition) {
|
||||
- int i = Math.min(world.a(Entity.class, this.getBoundingBox(blockposition)).size(), this.weight);
|
||||
protected int e(World world, BlockPosition blockposition) {
|
||||
- int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).size(), this.weight);
|
||||
+ // CraftBukkit start
|
||||
+ //int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b);
|
||||
+ // int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).size(), this.weight);
|
||||
+ int i = 0;
|
||||
+ java.util.Iterator iterator = world.a(Entity.class, this.getBoundingBox(blockposition)).iterator();
|
||||
+ java.util.Iterator iterator = world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ Entity entity = (Entity) iterator.next();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPumpkin extends BlockDirectional {
|
||||
public class BlockPumpkin extends BlockFacingHorizontal {
|
||||
|
||||
private ShapeDetector snowGolemPart;
|
||||
@@ -40,17 +46,24 @@
|
||||
|
|
|
@ -12,47 +12,49 @@
|
|||
public class BlockRedstoneOre extends Block {
|
||||
|
||||
private final boolean a;
|
||||
@@ -20,23 +25,44 @@
|
||||
@@ -20,23 +25,46 @@
|
||||
}
|
||||
|
||||
public void attack(World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
- this.e(world, blockposition);
|
||||
+ this.e(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
- this.interact(world, blockposition);
|
||||
+ this.interact(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
super.attack(world, blockposition, entityhuman);
|
||||
}
|
||||
|
||||
public void a(World world, BlockPosition blockposition, Entity entity) {
|
||||
- this.e(world, blockposition);
|
||||
- super.a(world, blockposition, entity);
|
||||
public void stepOn(World world, BlockPosition blockposition, Entity entity) {
|
||||
- this.interact(world, blockposition);
|
||||
- super.stepOn(world, blockposition, entity);
|
||||
+ // CraftBukkit start
|
||||
+ // this.e(world, blockposition);
|
||||
+ // super.a(world, blockposition, entity);
|
||||
+ // PAIL: Rename this method
|
||||
+ // this.interact(world, blockposition);
|
||||
+ // super.stepOn(world, blockposition, entity);
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.e(world, blockposition, entity); // add entity
|
||||
+ super.a(world, blockposition, entity);
|
||||
+ this.interact(world, blockposition, entity); // add entity
|
||||
+ super.stepOn(world, blockposition, entity);
|
||||
+ }
|
||||
+ } else {
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.e(world, blockposition, entity); // add entity
|
||||
+ super.a(world, blockposition, entity);
|
||||
+ this.interact(world, blockposition, entity); // add entity
|
||||
+ super.stepOn(world, blockposition, entity);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
- this.e(world, blockposition);
|
||||
+ this.e(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
return super.interact(world, blockposition, iblockdata, entityhuman, enumdirection, f, f1, f2);
|
||||
+
|
||||
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
|
||||
- this.interact(world, blockposition);
|
||||
+ this.interact(world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
return super.interact(world, blockposition, iblockdata, entityhuman, enumhand, itemstack, enumdirection, f, f1, f2);
|
||||
}
|
||||
|
||||
- private void e(World world, BlockPosition blockposition) {
|
||||
+ private void e(World world, BlockPosition blockposition, Entity entity) { // CraftBukkit - add Entity
|
||||
this.f(world, blockposition);
|
||||
- private void interact(World world, BlockPosition blockposition) {
|
||||
+ private void interact(World world, BlockPosition blockposition, Entity entity) { // CraftBukkit - add Entity
|
||||
this.playEffect(world, blockposition);
|
||||
if (this == Blocks.REDSTONE_ORE) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.LIT_REDSTONE_ORE, 0).isCancelled()) {
|
||||
|
@ -62,7 +64,7 @@
|
|||
world.setTypeUpdate(blockposition, Blocks.LIT_REDSTONE_ORE.getBlockData());
|
||||
}
|
||||
|
||||
@@ -44,6 +70,11 @@
|
||||
@@ -44,6 +72,11 @@
|
||||
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (this == Blocks.LIT_REDSTONE_ORE) {
|
||||
|
@ -74,7 +76,7 @@
|
|||
world.setTypeUpdate(blockposition, Blocks.REDSTONE_ORE.getBlockData());
|
||||
}
|
||||
|
||||
@@ -63,12 +94,24 @@
|
||||
@@ -63,12 +96,24 @@
|
||||
|
||||
public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
|
||||
super.dropNaturally(world, blockposition, iblockdata, f, i);
|
||||
|
@ -98,4 +100,4 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private void f(World world, BlockPosition blockposition) {
|
||||
private void playEffect(World world, BlockPosition blockposition) {
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
+
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = Maps.newHashMap();
|
||||
private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> g = Maps.newHashMap();
|
||||
@@ -13,7 +15,7 @@
|
||||
|
||||
private boolean a(World world, BlockPosition blockposition, boolean flag) {
|
||||
if (!BlockRedstoneTorch.b.containsKey(world)) {
|
||||
- BlockRedstoneTorch.b.put(world, Lists.newArrayList());
|
||||
+ BlockRedstoneTorch.b.put(world, Lists.<BlockRedstoneTorch.RedstoneUpdateInfo>newArrayList()); // CraftBukkit - fix decompile error
|
||||
if (!BlockRedstoneTorch.g.containsKey(world)) {
|
||||
- BlockRedstoneTorch.g.put(world, Lists.newArrayList());
|
||||
+ BlockRedstoneTorch.g.put(world, Lists.<BlockRedstoneTorch.RedstoneUpdateInfo>newArrayList()); // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
List list = (List) BlockRedstoneTorch.b.get(world);
|
||||
List list = (List) BlockRedstoneTorch.g.get(world);
|
||||
@@ -96,8 +98,25 @@
|
||||
list.remove(0);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
|||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, Blocks.UNLIT_REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
|
||||
if (this.a(world, blockposition, true)) {
|
||||
world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
||||
world.a((EntityHuman) null, blockposition, SoundEffects.eF, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
||||
@@ -114,6 +133,15 @@
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
public static final BlockStateEnum<BlockRedstoneWire.EnumRedstoneWireConnection> NORTH = BlockStateEnum.of("north", BlockRedstoneWire.EnumRedstoneWireConnection.class);
|
||||
@@ -124,6 +126,15 @@
|
||||
@@ -166,6 +168,15 @@
|
||||
j = k;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/BlockReed.java
|
||||
+++ b/net/minecraft/server/BlockReed.java
|
||||
@@ -29,8 +29,12 @@
|
||||
@@ -31,8 +31,12 @@
|
||||
int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue();
|
||||
|
||||
if (j == 15) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/BlockSapling.java
|
||||
+++ b/net/minecraft/server/BlockSapling.java
|
||||
@@ -2,10 +2,20 @@
|
||||
@@ -2,11 +2,21 @@
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -17,11 +17,12 @@
|
|||
|
||||
public static final BlockStateEnum<BlockWood.EnumLogVariant> TYPE = BlockStateEnum.of("type", BlockWood.EnumLogVariant.class);
|
||||
public static final BlockStateInteger STAGE = BlockStateInteger.of("stage", 0, 1);
|
||||
protected static final AxisAlignedBB d = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
|
||||
+ public static TreeType treeType; // CraftBukkit
|
||||
|
||||
protected BlockSapling() {
|
||||
this.j(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0)));
|
||||
@@ -23,7 +33,30 @@
|
||||
this.w(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0)));
|
||||
@@ -25,7 +35,30 @@
|
||||
if (!world.isClientSide) {
|
||||
super.b(world, blockposition, iblockdata, random);
|
||||
if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
|
||||
|
@ -52,10 +53,10 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +72,17 @@
|
||||
@@ -41,7 +74,17 @@
|
||||
}
|
||||
|
||||
public void e(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
public void d(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
- Object object = random.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
|
||||
+ // CraftBukkit start - Turn ternary operator into if statement to set treeType
|
||||
+ // Object object = random.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
|
||||
|
@ -71,7 +72,7 @@
|
|||
int i = 0;
|
||||
int j = 0;
|
||||
boolean flag = false;
|
||||
@@ -51,6 +94,7 @@
|
||||
@@ -53,6 +96,7 @@
|
||||
for (i = 0; i >= -1; --i) {
|
||||
for (j = 0; j >= -1; --j) {
|
||||
if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.SPRUCE)) {
|
||||
|
@ -79,7 +80,7 @@
|
|||
object = new WorldGenMegaTree(false, random.nextBoolean());
|
||||
flag = true;
|
||||
break label66;
|
||||
@@ -61,11 +105,13 @@
|
||||
@@ -63,11 +107,13 @@
|
||||
if (!flag) {
|
||||
j = 0;
|
||||
i = 0;
|
||||
|
@ -93,7 +94,7 @@
|
|||
object = new WorldGenForest(true, false);
|
||||
break;
|
||||
|
||||
@@ -77,6 +123,7 @@
|
||||
@@ -79,6 +125,7 @@
|
||||
for (i = 0; i >= -1; --i) {
|
||||
for (j = 0; j >= -1; --j) {
|
||||
if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.JUNGLE)) {
|
||||
|
@ -101,7 +102,7 @@
|
|||
object = new WorldGenJungleTree(true, 10, 20, iblockdata1, iblockdata2);
|
||||
flag = true;
|
||||
break label78;
|
||||
@@ -87,11 +134,13 @@
|
||||
@@ -89,11 +136,13 @@
|
||||
if (!flag) {
|
||||
j = 0;
|
||||
i = 0;
|
||||
|
@ -115,7 +116,7 @@
|
|||
object = new WorldGenAcaciaTree(true);
|
||||
break;
|
||||
|
||||
@@ -100,6 +149,7 @@
|
||||
@@ -102,6 +151,7 @@
|
||||
for (i = 0; i >= -1; --i) {
|
||||
for (j = 0; j >= -1; --j) {
|
||||
if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.DARK_OAK)) {
|
||||
|
|
|
@ -9,20 +9,20 @@
|
|||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockSkull extends BlockContainer {
|
||||
public class BlockSkull extends BlockTileEntity {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing");
|
||||
@@ -81,8 +86,26 @@
|
||||
|
||||
return tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).getSkullType() : super.getDropData(world, blockposition);
|
||||
public static final BlockStateDirection FACING = BlockDirectional.FACING;
|
||||
@@ -81,7 +86,25 @@
|
||||
return new ItemStack(Items.SKULL, 1, i);
|
||||
}
|
||||
+
|
||||
|
||||
- public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {}
|
||||
+ // CraftBukkit start - Special case dropping so we can get info from the tile entity
|
||||
+ @Override
|
||||
+ public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
|
||||
+ if (world.random.nextFloat() < f) {
|
||||
+ ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, blockposition));
|
||||
+ TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(blockposition);
|
||||
+ ItemStack itemstack = this.a(world, blockposition, iblockdata);
|
||||
+
|
||||
+ if (tileentityskull.getSkullType() == 3 && tileentityskull.getGameProfile() != null) {
|
||||
+ itemstack.setTag(new NBTTagCompound());
|
||||
|
@ -31,8 +31,7 @@
|
|||
+ GameProfileSerializer.serialize(nbttagcompound, tileentityskull.getGameProfile());
|
||||
+ itemstack.getTag().set("SkullOwner", nbttagcompound);
|
||||
+ }
|
||||
|
||||
- public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {}
|
||||
+
|
||||
+ a(world, blockposition, itemstack);
|
||||
+ }
|
||||
+ }
|
||||
|
@ -40,7 +39,7 @@
|
|||
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
if (entityhuman.abilities.canInstantlyBuild) {
|
||||
@@ -95,7 +118,10 @@
|
||||
@@ -94,7 +117,10 @@
|
||||
|
||||
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
if (!world.isClientSide) {
|
||||
|
@ -52,13 +51,13 @@
|
|||
TileEntity tileentity = world.getTileEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof TileEntitySkull) {
|
||||
@@ -127,24 +153,36 @@
|
||||
@@ -126,24 +152,36 @@
|
||||
}
|
||||
|
||||
public void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
|
||||
+ if (world.captureBlockStates) return; // CraftBukkit
|
||||
if (tileentityskull.getSkullType() == 1 && blockposition.getY() >= 2 && world.getDifficulty() != EnumDifficulty.PEACEFUL && !world.isClientSide) {
|
||||
ShapeDetector shapedetector = this.n();
|
||||
ShapeDetector shapedetector = this.g();
|
||||
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.a(world, blockposition);
|
||||
|
||||
if (shapedetector_shapedetectorcollection != null) {
|
||||
|
@ -91,14 +90,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -157,14 +195,16 @@
|
||||
entitywither.n();
|
||||
Iterator iterator = world.a(EntityHuman.class, entitywither.getBoundingBox().grow(50.0D, 50.0D, 50.0D)).iterator();
|
||||
@@ -156,14 +194,16 @@
|
||||
entitywither.o();
|
||||
Iterator iterator = world.a(EntityHuman.class, entitywither.getBoundingBox().g(50.0D)).iterator();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
+ blockList.updateList();
|
||||
+
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
|
@ -110,7 +109,7 @@
|
|||
int k;
|
||||
|
||||
for (k = 0; k < 120; ++k) {
|
||||
@@ -178,6 +218,7 @@
|
||||
@@ -177,6 +217,7 @@
|
||||
world.update(shapedetectorblock2.getPosition(), Blocks.AIR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/BlockSnow.java
|
||||
+++ b/net/minecraft/server/BlockSnow.java
|
||||
@@ -85,6 +85,11 @@
|
||||
@@ -79,6 +79,11 @@
|
||||
|
||||
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
||||
if (world.b(EnumSkyBlock.BLOCK, blockposition) > 11) {
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
public class BlockSoil extends Block {
|
||||
|
||||
public static final BlockStateInteger MOISTURE = BlockStateInteger.of("moisture", 0, 7);
|
||||
@@ -34,6 +39,12 @@
|
||||
@@ -38,6 +43,12 @@
|
||||
if (i > 0) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockSoil.MOISTURE, Integer.valueOf(i - 1)), 2);
|
||||
} else if (!this.e(world, blockposition)) {
|
||||
} else if (!this.b(world, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(block, Blocks.DIRT).isCancelled()) {
|
||||
|
@ -25,40 +25,36 @@
|
|||
world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
}
|
||||
} else if (i < 7) {
|
||||
@@ -43,16 +54,35 @@
|
||||
@@ -47,11 +58,31 @@
|
||||
}
|
||||
|
||||
public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) {
|
||||
+ super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
if (entity instanceof EntityLiving) {
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F) {
|
||||
if (!(entity instanceof EntityHuman) && !world.getGameRules().getBoolean("mobGriefing")) {
|
||||
return;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Interact soil
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean("mobGriefing")) && entity.width * entity.width * entity.length > 0.512F) {
|
||||
+
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit start - Interact soil
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.DIRT, 0).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
}
|
||||
|
||||
- super.fallOn(world, blockposition, entity, f);
|
||||
+ // super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved up
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.DIRT, 0).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData());
|
||||
}
|
||||
|
||||
- super.fallOn(world, blockposition, entity, f);
|
||||
+ // super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved up
|
||||
}
|
||||
|
||||
private boolean b(World world, BlockPosition blockposition) {
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
public class BlockStationary extends BlockFluids {
|
||||
|
||||
protected BlockStationary(Material material) {
|
||||
@@ -41,6 +43,13 @@
|
||||
@@ -45,6 +47,13 @@
|
||||
|
||||
if (block.material == Material.AIR) {
|
||||
if (this.f(world, blockposition1)) {
|
||||
if (this.c(world, blockposition1)) {
|
||||
+ // CraftBukkit start - Prevent lava putting something on fire
|
||||
+ if (world.getType(blockposition1) != Blocks.FIRE) {
|
||||
+ if (CraftEventFactory.callBlockIgniteEvent(world, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), blockposition.getX(), blockposition.getY(), blockposition.getZ()).isCancelled()) {
|
||||
|
@ -23,10 +23,12 @@
|
|||
world.setTypeUpdate(blockposition1, Blocks.FIRE.getBlockData());
|
||||
return;
|
||||
}
|
||||
@@ -53,6 +62,14 @@
|
||||
BlockPosition blockposition2 = blockposition.a(random.nextInt(3) - 1, 0, random.nextInt(3) - 1);
|
||||
@@ -60,7 +69,16 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.isEmpty(blockposition2.up()) && this.m(world, blockposition2)) {
|
||||
+ // PAIL: rename
|
||||
if (world.isEmpty(blockposition2.up()) && this.d(world, blockposition2)) {
|
||||
+ // CraftBukkit start - Prevent lava putting something on fire
|
||||
+ BlockPosition up = blockposition2.up();
|
||||
+ if (world.getType(up) != Blocks.FIRE) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/BlockStem.java
|
||||
+++ b/net/minecraft/server/BlockStem.java
|
||||
@@ -4,6 +4,8 @@
|
||||
@@ -3,6 +3,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 7);
|
||||
@@ -58,7 +60,8 @@
|
||||
@@ -53,7 +55,8 @@
|
||||
|
||||
if (i < 7) {
|
||||
iblockdata = iblockdata.set(BlockStem.AGE, Integer.valueOf(i + 1));
|
||||
|
@ -19,7 +19,7 @@
|
|||
} else {
|
||||
Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator();
|
||||
|
||||
@@ -74,7 +77,8 @@
|
||||
@@ -69,7 +72,8 @@
|
||||
Block block = world.getType(blockposition.down()).getBlock();
|
||||
|
||||
if (world.getType(blockposition).getBlock().material == Material.AIR && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.GRASS)) {
|
||||
|
@ -29,7 +29,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +89,8 @@
|
||||
@@ -80,7 +84,8 @@
|
||||
public void g(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue() + MathHelper.nextInt(world.random, 2, 5);
|
||||
|
||||
|
@ -38,4 +38,4 @@
|
|||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, Math.min(7, i)); // CraftBukkit
|
||||
}
|
||||
|
||||
public void j() {
|
||||
public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
--- a/net/minecraft/server/BlockTrapdoor.java
|
||||
+++ b/net/minecraft/server/BlockTrapdoor.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockTrapdoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL);
|
||||
@@ -101,6 +103,19 @@
|
||||
boolean flag = world.isBlockIndirectlyPowered(blockposition);
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -92,6 +94,19 @@
|
||||
boolean flag = world.isBlockIndirectlyPowered(blockposition);
|
||||
|
||||
if (flag || block.isPowerSource()) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
if (flag || block.getBlockData().m()) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+
|
||||
+ int power = bblock.getBlockPower();
|
||||
+ int oldPower = (Boolean) iblockdata.get(OPEN) ? 15 : 0;
|
||||
+ int power = bblock.getBlockPower();
|
||||
+ int oldPower = (Boolean) iblockdata.get(OPEN) ? 15 : 0;
|
||||
+
|
||||
+ if (oldPower == 0 ^ power == 0 || block.isPowerSource()) {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ flag = eventRedstone.getNewCurrent() > 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
boolean flag1 = ((Boolean) iblockdata.get(BlockTrapdoor.OPEN)).booleanValue();
|
||||
+ if (oldPower == 0 ^ power == 0 || block.getBlockData().n()) {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ flag = eventRedstone.getNewCurrent() > 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
boolean flag1 = ((Boolean) iblockdata.get(BlockTrapdoor.OPEN)).booleanValue();
|
||||
|
||||
if (flag1 != flag) {
|
||||
if (flag1 != flag) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
public class BlockTripwire extends Block {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
|
||||
@@ -155,6 +157,40 @@
|
||||
@@ -136,6 +138,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/BlockTripwireHook.java
|
||||
+++ b/net/minecraft/server/BlockTripwireHook.java
|
||||
@@ -5,6 +5,8 @@
|
||||
@@ -4,6 +4,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
|||
+
|
||||
public class BlockTripwireHook extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL);
|
||||
@@ -141,6 +143,17 @@
|
||||
this.a(world, blockposition1, flag5, flag6, flag2, flag3);
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -153,6 +155,17 @@
|
||||
this.a(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -24,6 +24,6 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.a(world, blockposition, flag5, flag6, flag2, flag3);
|
||||
this.a(world, blockposition, flag4, flag5, flag2, flag3);
|
||||
if (!flag) {
|
||||
world.setTypeAndData(blockposition, iblockdata3.set(BlockTripwireHook.FACING, enumdirection), 3);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
public class BlockVine extends Block {
|
||||
|
||||
public static final BlockStateBoolean UP = BlockStateBoolean.of("up");
|
||||
@@ -200,7 +202,13 @@
|
||||
@@ -172,7 +174,13 @@
|
||||
}
|
||||
|
||||
if (((Boolean) iblockdata1.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.WEST)).booleanValue()) {
|
||||
|
@ -24,42 +24,42 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -220,17 +228,29 @@
|
||||
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
|
||||
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
|
||||
@@ -194,17 +202,29 @@
|
||||
BlockPosition blockposition3 = blockposition2.shift(enumdirection2);
|
||||
BlockPosition blockposition4 = blockposition2.shift(enumdirection3);
|
||||
|
||||
+ // CraftBukkit start - Call BlockSpreadEvent
|
||||
+ org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ());
|
||||
+
|
||||
if (flag1 && this.c(world.getType(blockposition3).getBlock())) {
|
||||
- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(a(enumdirection1), Boolean.valueOf(true)), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true))));
|
||||
} else if (flag2 && this.c(world.getType(blockposition4).getBlock())) {
|
||||
if (flag1 && this.x(world.getType(blockposition3))) {
|
||||
- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(a(enumdirection2), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true))));
|
||||
} else if (flag1 && world.isEmpty(blockposition3) && this.c(world.getType(blockposition.shift(enumdirection1)).getBlock())) {
|
||||
} else if (flag2 && this.x(world.getType(blockposition4))) {
|
||||
- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true))));
|
||||
} else if (flag1 && world.isEmpty(blockposition3) && this.x(world.getType(blockposition.shift(enumdirection2)))) {
|
||||
- world.setTypeAndData(blockposition3, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition3, this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition3, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
|
||||
+ bukkitBlock = world.getWorld().getBlockAt(blockposition3.getX(), blockposition3.getY(), blockposition3.getZ());
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true))));
|
||||
} else if (flag2 && world.isEmpty(blockposition4) && this.c(world.getType(blockposition.shift(enumdirection2)).getBlock())) {
|
||||
} else if (flag2 && world.isEmpty(blockposition4) && this.x(world.getType(blockposition.shift(enumdirection3)))) {
|
||||
- world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition4, this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)), 2);
|
||||
+ // world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
|
||||
+ bukkitBlock = world.getWorld().getBlockAt(blockposition4.getX(), blockposition4.getY(), blockposition4.getZ());
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true))));
|
||||
} else if (this.c(world.getType(blockposition2.up()).getBlock())) {
|
||||
} else if (this.x(world.getType(blockposition2.up()))) {
|
||||
- world.setTypeAndData(blockposition2, this.getBlockData(), 2);
|
||||
+ // world.setTypeAndData(blockposition2, this.getBlockData(), 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData()));
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
} else if (block.material.k() && block.d()) {
|
||||
} else if (block.material.k() && iblockdata2.h()) {
|
||||
world.setTypeAndData(blockposition, iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2);
|
||||
}
|
||||
@@ -257,7 +277,12 @@
|
||||
@@ -231,7 +251,12 @@
|
||||
}
|
||||
|
||||
if (((Boolean) iblockdata3.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.WEST)).booleanValue()) {
|
||||
|
@ -71,5 +71,5 @@
|
|||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(iblockdata3));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (block1 == this) {
|
||||
} else if (block == this) {
|
||||
iblockdata3 = iblockdata2;
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
+
|
||||
public class Chunk {
|
||||
|
||||
private static final Logger c = LogManager.getLogger();
|
||||
@@ -40,6 +43,34 @@
|
||||
private int v;
|
||||
private ConcurrentLinkedQueue<BlockPosition> w;
|
||||
private static final Logger d = LogManager.getLogger();
|
||||
@@ -41,6 +44,34 @@
|
||||
private int w;
|
||||
private ConcurrentLinkedQueue<BlockPosition> x;
|
||||
|
||||
+ // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
|
||||
+ private int neighbors = 0x1 << 12;
|
||||
|
@ -44,16 +44,14 @@
|
|||
+
|
||||
public Chunk(World world, int i, int j) {
|
||||
this.sections = new ChunkSection[16];
|
||||
this.e = new byte[256];
|
||||
@@ -60,8 +91,17 @@
|
||||
this.f = new byte[256];
|
||||
@@ -61,8 +92,15 @@
|
||||
|
||||
Arrays.fill(this.f, -999);
|
||||
Arrays.fill(this.e, (byte) -1);
|
||||
Arrays.fill(this.g, -999);
|
||||
Arrays.fill(this.f, (byte) -1);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (!(this instanceof EmptyChunk)) {
|
||||
+ this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
+ }
|
||||
+ this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
}
|
||||
|
||||
+ public org.bukkit.Chunk bukkitChunk;
|
||||
|
@ -63,30 +61,30 @@
|
|||
public Chunk(World world, ChunkSnapshot chunksnapshot, int i, int j) {
|
||||
this(world, i, j);
|
||||
short short0 = 256;
|
||||
@@ -529,7 +569,8 @@
|
||||
@@ -463,7 +501,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.world.isClientSide && block1 != block) {
|
||||
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
|
||||
+ if (!this.world.isClientSide && block1 != block && (!this.world.captureBlockStates || block instanceof BlockContainer)) {
|
||||
+ if (!this.world.isClientSide && block1 != block && (!this.world.captureBlockStates || block instanceof BlockTileEntity)) {
|
||||
block.onPlace(this.world, blockposition, iblockdata);
|
||||
}
|
||||
|
||||
@@ -610,7 +651,11 @@
|
||||
@@ -544,7 +583,11 @@
|
||||
int j = MathHelper.floor(entity.locZ / 16.0D);
|
||||
|
||||
if (i != this.locX || j != this.locZ) {
|
||||
- Chunk.c.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
|
||||
- Chunk.d.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
|
||||
+ // CraftBukkit start
|
||||
+ Bukkit.getLogger().warning("Wrong location for " + entity + " in world '" + world.getWorld().getName() + "'!");
|
||||
+ // Chunk.c.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
|
||||
+ // Chunk.d.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity});
|
||||
+ Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.locX + "," + this.locZ);
|
||||
+ // CraftBukkit end
|
||||
entity.die();
|
||||
}
|
||||
|
||||
@@ -662,7 +707,15 @@
|
||||
@@ -597,7 +640,15 @@
|
||||
}
|
||||
|
||||
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
|
@ -103,21 +101,21 @@
|
|||
|
||||
if (tileentity == null) {
|
||||
if (chunk_enumtileentitystate == Chunk.EnumTileEntityState.IMMEDIATE) {
|
||||
@@ -697,6 +750,13 @@
|
||||
@@ -632,6 +683,13 @@
|
||||
|
||||
tileentity.D();
|
||||
tileentity.z();
|
||||
this.tileEntities.put(blockposition, tileentity);
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
|
||||
+ + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!");
|
||||
+ + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!");
|
||||
+ System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
|
||||
+ new Exception().printStackTrace();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,7 +800,21 @@
|
||||
@@ -675,7 +733,21 @@
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.entitySlices.length; ++i) {
|
||||
|
@ -140,7 +138,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -798,8 +872,8 @@
|
||||
@@ -733,8 +805,8 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
@ -151,3 +149,33 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -797,6 +869,29 @@
|
||||
} else {
|
||||
this.o();
|
||||
chunkgenerator.recreateStructures(this.locX, this.locZ);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ BlockSand.instaFall = true;
|
||||
+ Random random = new Random();
|
||||
+ random.setSeed(world.getSeed());
|
||||
+ long xRand = random.nextLong() / 2L * 2L + 1L;
|
||||
+ long zRand = random.nextLong() / 2L * 2L + 1L;
|
||||
+ random.setSeed((long) locX * xRand + (long) locZ * zRand ^ world.getSeed());
|
||||
+
|
||||
+ org.bukkit.World world = this.world.getWorld();
|
||||
+ if (world != null) {
|
||||
+ this.world.populating = true;
|
||||
+ try {
|
||||
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
+ populator.populate(world, random, bukkitChunk);
|
||||
+ }
|
||||
+ } finally {
|
||||
+ this.world.populating = false;
|
||||
+ }
|
||||
+ }
|
||||
+ BlockSand.instaFall = false;
|
||||
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
||||
+ // CraftBukkit end
|
||||
this.e();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
--- a/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -11,16 +11,27 @@
|
||||
@@ -1,24 +1,31 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
-import com.google.common.collect.Lists;
|
||||
import java.io.IOException;
|
||||
-import java.util.ArrayList;
|
||||
-import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
-import java.util.Set;
|
||||
-import java.util.concurrent.ConcurrentHashMap;
|
||||
+
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.Random;
|
||||
+import java.util.logging.Level;
|
||||
+
|
||||
+import org.bukkit.Server;
|
||||
+import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
|
||||
|
@ -18,30 +27,30 @@
|
|||
+
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
private static final Logger b = LogManager.getLogger();
|
||||
- private Set<Long> unloadQueue = Collections.newSetFromMap(new ConcurrentHashMap());
|
||||
+ public LongHashSet unloadQueue = new LongHashSet(); // CraftBukkit - LongHashSet
|
||||
public Chunk emptyChunk;
|
||||
public IChunkProvider chunkProvider;
|
||||
private IChunkLoader chunkLoader;
|
||||
- public boolean forceChunkLoad = true;
|
||||
- private LongHashMap<Chunk> chunks = new LongHashMap();
|
||||
- private List<Chunk> chunkList = Lists.newArrayList();
|
||||
+ public boolean forceChunkLoad = false; // CraftBukkit - true -> false
|
||||
+ public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
|
||||
public WorldServer world;
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
- private final Set<Long> unloadQueue = Collections.newSetFromMap(new ConcurrentHashMap());
|
||||
- private final ChunkGenerator chunkGenerator;
|
||||
+ public final LongHashSet unloadQueue = new LongHashSet(); // CraftBukkit - LongHashSet
|
||||
+ public final ChunkGenerator chunkGenerator; // CraftBukkit - public
|
||||
private final IChunkLoader chunkLoader;
|
||||
- private final LongHashMap<Chunk> chunks = new LongHashMap();
|
||||
- private final List<Chunk> chunkList = Lists.newArrayList();
|
||||
+ public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>(); // CraftBukkit
|
||||
+ // private final LongHashMap<Chunk> chunks = new LongHashMap();
|
||||
+ // private final List<Chunk> chunkList = Lists.newArrayList();
|
||||
public final WorldServer world;
|
||||
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
|
||||
@@ -31,26 +42,43 @@
|
||||
}
|
||||
|
||||
public boolean isChunkLoaded(int i, int j) {
|
||||
- return this.chunks.contains(ChunkCoordIntPair.a(i, j));
|
||||
+ return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, ChunkGenerator chunkgenerator) {
|
||||
@@ -27,19 +34,33 @@
|
||||
this.chunkGenerator = chunkgenerator;
|
||||
}
|
||||
|
||||
- public List<Chunk> a() {
|
||||
- return this.chunkList;
|
||||
+ public boolean isChunkLoaded(int i, int j) {
|
||||
+ return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - Change return type to Collection and return the values of our chunk map
|
||||
+ public java.util.Collection a() {
|
||||
+ // return this.chunkList;
|
||||
|
@ -50,19 +59,7 @@
|
|||
}
|
||||
|
||||
public void queueUnload(int i, int j) {
|
||||
if (this.world.worldProvider.e()) {
|
||||
if (!this.world.c(i, j)) {
|
||||
- this.unloadQueue.add(Long.valueOf(ChunkCoordIntPair.a(i, j)));
|
||||
+ // CraftBukkit start
|
||||
+ this.unloadQueue.add(i, j);
|
||||
+
|
||||
+ Chunk c = chunks.get(LongHash.toLong(i, j));
|
||||
+ if (c != null) {
|
||||
+ c.mustSave = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
if (this.world.worldProvider.c(i, j)) {
|
||||
- this.unloadQueue.add(Long.valueOf(ChunkCoordIntPair.a(i, j)));
|
||||
+ // CraftBukkit start
|
||||
+ this.unloadQueue.add(i, j);
|
||||
|
@ -78,11 +75,11 @@
|
|||
|
||||
public void b() {
|
||||
- Iterator iterator = this.chunkList.iterator();
|
||||
+ Iterator iterator = this.chunks.values().iterator();
|
||||
+ Iterator iterator = this.chunks.values().iterator(); // CraftBukkit
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) iterator.next();
|
||||
@@ -60,11 +88,48 @@
|
||||
@@ -49,11 +70,15 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -91,8 +88,45 @@
|
|||
+ return chunks.get(LongHash.toLong(x, z));
|
||||
+ }
|
||||
+
|
||||
public Chunk getChunkAt(int i, int j) {
|
||||
public Chunk getLoadedChunkAt(int i, int j) {
|
||||
- long k = ChunkCoordIntPair.a(i, j);
|
||||
- Chunk chunk = (Chunk) this.chunks.getEntry(k);
|
||||
+ Chunk chunk = chunks.get(LongHash.toLong(i, j)); // CraftBukkit
|
||||
|
||||
- this.unloadQueue.remove(Long.valueOf(k));
|
||||
+ this.unloadQueue.remove(i, j); // CraftBukkit
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@@ -61,20 +86,66 @@
|
||||
Chunk chunk = this.getLoadedChunkAt(i, j);
|
||||
|
||||
if (chunk == null) {
|
||||
- chunk = this.loadChunk(i, j);
|
||||
+ // CraftBukkit start
|
||||
+ ChunkRegionLoader loader = null;
|
||||
+
|
||||
+ if (this.chunkLoader instanceof ChunkRegionLoader) {
|
||||
+ loader = (ChunkRegionLoader) this.chunkLoader;
|
||||
+ }
|
||||
+ if (loader != null && loader.chunkExists(world, i, j)) {
|
||||
+ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
|
||||
+ }
|
||||
+ /* chunk = this.loadChunk(i, j);
|
||||
if (chunk != null) {
|
||||
this.chunks.put(ChunkCoordIntPair.a(i, j), chunk);
|
||||
this.chunkList.add(chunk);
|
||||
chunk.addEntities();
|
||||
chunk.loadNearby(this, this.chunkGenerator);
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int i, int j) {
|
||||
+ return getChunkAt(i, j, null);
|
||||
+ }
|
||||
+
|
||||
|
@ -103,9 +137,7 @@
|
|||
+
|
||||
+ if (this.chunkLoader instanceof ChunkRegionLoader) {
|
||||
+ loader = (ChunkRegionLoader) this.chunkLoader;
|
||||
|
||||
- this.unloadQueue.remove(Long.valueOf(k));
|
||||
- Chunk chunk = (Chunk) this.chunks.getEntry(k);
|
||||
+
|
||||
+ }
|
||||
+ // We can only use the queue for already generated chunks
|
||||
+ if (chunk == null && loader != null && loader.chunkExists(world, i, j)) {
|
||||
|
@ -126,33 +158,26 @@
|
|||
+
|
||||
+ return chunk;
|
||||
+ }
|
||||
+
|
||||
+ public Chunk originalGetChunkAt(int i, int j) {
|
||||
+ this.unloadQueue.remove(i, j);
|
||||
+ Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));
|
||||
Chunk chunk = this.getOrLoadChunkAt(i, j);
|
||||
+ boolean newChunk = false;
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (chunk == null) {
|
||||
chunk = this.loadChunk(i, j);
|
||||
@@ -79,16 +144,44 @@
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated");
|
||||
|
||||
crashreportsystemdetails.a("Location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
|
||||
- crashreportsystemdetails.a("Position hash", (Object) Long.valueOf(k));
|
||||
+ crashreportsystemdetails.a("Position hash", (Object) Long.valueOf(LongHash.toLong(i, j))); // CraftBukkit - Use LongHash
|
||||
crashreportsystemdetails.a("Generator", (Object) this.chunkProvider.getName());
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
long k = ChunkCoordIntPair.a(i, j);
|
||||
@@ -92,11 +163,38 @@
|
||||
crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator);
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
+ newChunk = true; // CraftBukkit
|
||||
}
|
||||
|
||||
- this.chunks.put(k, chunk);
|
||||
- this.chunkList.add(chunk);
|
||||
+ this.chunks.put(LongHash.toLong(i, j), chunk);
|
||||
+
|
||||
+ this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit
|
||||
chunk.addEntities();
|
||||
+
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ Server server = world.getServer();
|
||||
+ if (server != null) {
|
||||
|
@ -179,68 +204,12 @@
|
|||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
chunk.loadNearby(this, this, i, j);
|
||||
chunk.loadNearby(this, this.chunkGenerator);
|
||||
}
|
||||
|
||||
@@ -96,9 +189,22 @@
|
||||
}
|
||||
@@ -142,10 +240,12 @@
|
||||
|
||||
public Chunk getOrCreateChunk(int i, int j) {
|
||||
- Chunk chunk = (Chunk) this.chunks.getEntry(ChunkCoordIntPair.a(i, j));
|
||||
+ // CraftBukkit start
|
||||
+ Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));
|
||||
+
|
||||
+ chunk = chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
+
|
||||
+ if (chunk == emptyChunk) return chunk;
|
||||
+ if (i != chunk.locX || j != chunk.locZ) {
|
||||
+ b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
|
||||
+ b.error(chunk.getClass().getName());
|
||||
+ Throwable ex = new Throwable();
|
||||
+ ex.fillInStackTrace();
|
||||
+ ex.printStackTrace();
|
||||
+ }
|
||||
|
||||
- return chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
+ return chunk;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public Chunk loadChunk(int i, int j) {
|
||||
@@ -155,6 +261,30 @@
|
||||
chunk.n();
|
||||
if (this.chunkProvider != null) {
|
||||
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ BlockSand.instaFall = true;
|
||||
+ Random random = new Random();
|
||||
+ random.setSeed(world.getSeed());
|
||||
+ long xRand = random.nextLong() / 2L * 2L + 1L;
|
||||
+ long zRand = random.nextLong() / 2L * 2L + 1L;
|
||||
+ random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed());
|
||||
+
|
||||
+ org.bukkit.World world = this.world.getWorld();
|
||||
+ if (world != null) {
|
||||
+ this.world.populating = true;
|
||||
+ try {
|
||||
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
+ populator.populate(world, random, chunk.bukkitChunk);
|
||||
+ }
|
||||
+ } finally {
|
||||
+ this.world.populating = false;
|
||||
+ }
|
||||
+ }
|
||||
+ BlockSand.instaFall = false;
|
||||
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(chunk.bukkitChunk));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
chunk.e();
|
||||
}
|
||||
}
|
||||
@@ -174,10 +304,12 @@
|
||||
|
||||
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
|
||||
public boolean a(boolean flag) {
|
||||
int i = 0;
|
||||
- ArrayList arraylist = Lists.newArrayList(this.chunkList);
|
||||
|
||||
|
@ -254,7 +223,7 @@
|
|||
|
||||
if (flag) {
|
||||
this.saveChunkNOP(chunk);
|
||||
@@ -205,22 +337,43 @@
|
||||
@@ -170,22 +270,43 @@
|
||||
|
||||
public boolean unloadChunks() {
|
||||
if (!this.world.savingDisabled) {
|
||||
|
@ -303,9 +272,9 @@
|
|||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (this.chunkLoader != null) {
|
||||
this.chunkLoader.a();
|
||||
@@ -235,7 +388,8 @@
|
||||
this.chunkLoader.a();
|
||||
}
|
||||
@@ -198,7 +319,8 @@
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -314,14 +283,18 @@
|
|||
+ return "ServerChunkCache: " + this.chunks.size() + " Drop: " + this.unloadQueue.size();
|
||||
}
|
||||
|
||||
public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
|
||||
@@ -247,7 +401,8 @@
|
||||
public List<BiomeBase.BiomeMeta> a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
|
||||
@@ -210,10 +332,11 @@
|
||||
}
|
||||
|
||||
public int getLoadedChunks() {
|
||||
public int g() {
|
||||
- return this.chunks.count();
|
||||
+ // CraftBukkit - this.chunks.count() -> this.chunks.size()
|
||||
+ return this.chunks.size();
|
||||
}
|
||||
|
||||
public void recreateStructures(Chunk chunk, int i, int j) {}
|
||||
public boolean e(int i, int j) {
|
||||
- return this.chunks.contains(ChunkCoordIntPair.a(i, j));
|
||||
+ return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -26,7 +26,35 @@
|
||||
this.d = file;
|
||||
@@ -28,7 +28,35 @@
|
||||
this.e = dataconvertermanager;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -36,7 +36,7 @@
|
|||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair);
|
||||
|
||||
@@ -43,7 +71,7 @@
|
||||
@@ -45,7 +73,7 @@
|
||||
return this.a(world, i, j, nbttagcompound);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
if (!nbttagcompound.hasKeyOfType("Level", 10)) {
|
||||
ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is missing level data, skipping");
|
||||
return null;
|
||||
@@ -60,10 +88,28 @@
|
||||
@@ -62,10 +90,28 @@
|
||||
ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")");
|
||||
nbttagcompound1.setInt("xPos", i);
|
||||
nbttagcompound1.setInt("zPos", j);
|
||||
|
@ -75,35 +75,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -303,7 +349,26 @@
|
||||
int k1 = l >> 4 & 15;
|
||||
int l1 = nibblearray1 != null ? nibblearray1.a(i1, j1, k1) : 0;
|
||||
|
||||
- achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1));
|
||||
+ // CraftBukkit start - fix broken blocks
|
||||
+ // achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1));
|
||||
+
|
||||
+ int ex = l1;
|
||||
+ int id = (abyte[l] & 255);
|
||||
+ int data = nibblearray.a(i1, j1, k1);
|
||||
+ int packed = ex << 12 | id << 4 | data;
|
||||
+ if (Block.d.a(packed) == null) {
|
||||
+ Block block = Block.getById(ex << 8 | id);
|
||||
+ if (block != null) {
|
||||
+ try {
|
||||
+ data = block.toLegacyData(block.fromLegacyData(data));
|
||||
+ } catch (Exception ignored) {
|
||||
+ data = block.toLegacyData(block.getBlockData());
|
||||
+ }
|
||||
+ packed = ex << 12 | id << 4 | data;
|
||||
+ }
|
||||
+ }
|
||||
+ achar[l] = (char) packed;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
chunksection.a(achar);
|
||||
@@ -321,6 +386,13 @@
|
||||
@@ -295,6 +341,13 @@
|
||||
chunk.a(nbttagcompound.getByteArray("Biomes"));
|
||||
}
|
||||
|
||||
|
@ -117,11 +89,28 @@
|
|||
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
|
||||
|
||||
if (nbttaglist1 != null) {
|
||||
@@ -379,6 +451,6 @@
|
||||
@@ -338,7 +391,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- return chunk;
|
||||
+ // return chunk; // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
public static Entity a(NBTTagCompound nbttagcompound, World world, Chunk chunk) {
|
||||
@@ -399,8 +452,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
public static void a(Entity entity, World world) {
|
||||
- if (world.addEntity(entity) && entity.isVehicle()) {
|
||||
+ a(entity, world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public static void a(Entity entity, World world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ if (world.addEntity(entity, reason) && entity.isVehicle()) {
|
||||
+ // CraftBukkit end
|
||||
Iterator iterator = entity.bu().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
--- a/net/minecraft/server/ChunkSection.java
|
||||
+++ b/net/minecraft/server/ChunkSection.java
|
||||
@@ -19,6 +19,18 @@
|
||||
@@ -19,6 +19,24 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public ChunkSection(int y, boolean flag, char[] blockIds) {
|
||||
+ this.yPos = y;
|
||||
+ this.blockIds = blockIds;
|
||||
+ this.blockIds = new DataPaletteBlock();
|
||||
+ for (int i = 0; i < blockIds.length; i++) {
|
||||
+ int xx = i & 15;
|
||||
+ int yy = (i >> 8) & 15;
|
||||
+ int zz = (i >> 4) & 15;
|
||||
+ this.blockIds.setBlock(xx, yy, zz, Block.REGISTRY_ID.fromId(blockIds[i]));
|
||||
+ }
|
||||
+ this.emittedLight = new NibbleArray();
|
||||
+ if (flag) {
|
||||
+ this.skyLight = new NibbleArray();
|
||||
|
@ -17,5 +23,5 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
public IBlockData getType(int i, int j, int k) {
|
||||
IBlockData iblockdata = (IBlockData) Block.d.a(this.blockIds[j << 8 | k << 4 | i]);
|
||||
|
||||
return this.blockIds.a(i, j, k);
|
||||
}
|
||||
|
|
|
@ -22,20 +22,19 @@
|
|||
|
||||
public CommandBlockListenerAbstract() {}
|
||||
|
||||
@@ -79,7 +87,10 @@
|
||||
|
||||
try {
|
||||
this.d = null;
|
||||
- this.b = icommandhandler.a(this, this.e);
|
||||
+ // this.b = icommandhandler.a(this, this.e);
|
||||
+ // CraftBukkit start - Handle command block commands using Bukkit dispatcher
|
||||
+ this.b = executeCommand(this, sender, this.e);
|
||||
+ // CraftBukkit end
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
|
||||
@@ -110,6 +121,130 @@
|
||||
@@ -91,7 +99,9 @@
|
||||
|
||||
try {
|
||||
this.d = null;
|
||||
- this.b = icommandhandler.a(this, this.e);
|
||||
+ // CraftBukkit start - Handle command block commands using Bukkit dispatcher
|
||||
+ this.b = executeCommand(this, sender, this.e);
|
||||
+ // CraftBukkit end
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
|
||||
@@ -123,6 +133,130 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/server/CommandExecute.java
|
||||
+++ b/net/minecraft/server/CommandExecute.java
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.command.ProxiedNativeCommandSender;
|
||||
|
@ -11,8 +11,8 @@
|
|||
|
||||
public class CommandExecute extends CommandAbstract {
|
||||
|
||||
@@ -94,12 +98,31 @@
|
||||
ICommandHandler icommandhandler = MinecraftServer.getServer().getCommandHandler();
|
||||
@@ -97,22 +101,48 @@
|
||||
ICommandHandler icommandhandler = minecraftserver.getCommandHandler();
|
||||
|
||||
try {
|
||||
- int j = icommandhandler.a(icommandlistener1, s);
|
||||
|
@ -44,7 +44,13 @@
|
|||
throw new CommandException("commands.execute.failed", new Object[] { s, entity.getName()});
|
||||
}
|
||||
}
|
||||
@@ -112,4 +135,11 @@
|
||||
}
|
||||
|
||||
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
|
||||
- return astring.length == 1 ? a(astring, minecraftserver.getPlayers()) : (astring.length > 1 && astring.length <= 4 ? a(astring, 1, blockposition) : (astring.length > 5 && astring.length <= 8 && "detect".equals(astring[4]) ? a(astring, 5, blockposition) : (astring.length == 9 && "detect".equals(astring[4]) ? a(astring, (Collection) Block.REGISTRY.keySet()) : Collections.emptyList())));
|
||||
+ return astring.length == 1 ? a(astring, minecraftserver.getPlayers()) : (astring.length > 1 && astring.length <= 4 ? a(astring, 1, blockposition) : (astring.length > 5 && astring.length <= 8 && "detect".equals(astring[4]) ? a(astring, 5, blockposition) : (astring.length == 9 && "detect".equals(astring[4]) ? a(astring, (Collection) Block.REGISTRY.keySet()) : Collections.<String>emptyList()))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public boolean isListStart(String[] astring, int i) {
|
||||
return i == 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/CommandGamemode.java
|
||||
+++ b/net/minecraft/server/CommandGamemode.java
|
||||
@@ -26,6 +26,13 @@
|
||||
EntityPlayer entityplayer = astring.length >= 2 ? a(icommandlistener, astring[1]) : b(icommandlistener);
|
||||
@@ -27,6 +27,12 @@
|
||||
EntityPlayer entityplayer = astring.length >= 2 ? a(minecraftserver, icommandlistener, astring[1]) : a(icommandlistener);
|
||||
|
||||
entityplayer.a(worldsettings_enumgamemode);
|
||||
+ // CraftBukkit start - handle event cancelling the change
|
||||
|
@ -10,11 +10,17 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
entityplayer.fallDistance = 0.0F;
|
||||
ChatMessage chatmessage = new ChatMessage("gameMode." + worldsettings_enumgamemode.b(), new Object[0]);
|
||||
|
||||
if (icommandlistener.getWorld().getGameRules().getBoolean("sendCommandFeedback")) {
|
||||
entityplayer.sendMessage(new ChatMessage("gameMode.changed", new Object[0]));
|
||||
@@ -57,4 +64,11 @@
|
||||
@@ -49,10 +55,17 @@
|
||||
}
|
||||
|
||||
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
|
||||
- return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.emptyList());
|
||||
+ return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.<String>emptyList()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public boolean isListStart(String[] astring, int i) {
|
||||
return i == 1;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--- a/net/minecraft/server/CommandGamerule.java
|
||||
+++ b/net/minecraft/server/CommandGamerule.java
|
||||
@@ -20,7 +20,7 @@
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException {
|
||||
- GameRules gamerules = this.d();
|
||||
public void execute(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring) throws CommandException {
|
||||
- GameRules gamerules = this.a(minecraftserver);
|
||||
+ GameRules gamerules = icommandlistener.getWorld().getGameRules(); // CraftBukkit - Use current world
|
||||
String s = astring.length > 0 ? astring[0] : "";
|
||||
String s1 = astring.length > 1 ? a(astring, 1) : "";
|
||||
|
||||
@@ -85,4 +85,11 @@
|
||||
private GameRules d() {
|
||||
return MinecraftServer.getServer().getWorldServer(0).getGameRules();
|
||||
@@ -86,4 +86,11 @@
|
||||
private GameRules a(MinecraftServer minecraftserver) {
|
||||
return minecraftserver.getWorldServer(0).getGameRules();
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - fix decompile error
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
--- a/net/minecraft/server/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/CommandSpreadPlayers.java
|
||||
@@ -237,6 +237,13 @@
|
||||
return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : null;
|
||||
@@ -235,9 +235,16 @@
|
||||
}
|
||||
|
||||
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
|
||||
- return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.emptyList();
|
||||
+ return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.<String>emptyList(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - fix decompile error
|
||||
|
@ -14,25 +18,25 @@
|
|||
static class Location2D {
|
||||
|
||||
double a;
|
||||
@@ -303,7 +310,7 @@
|
||||
@@ -304,7 +311,7 @@
|
||||
}
|
||||
|
||||
blockposition = blockposition.down();
|
||||
- } while (world.getType(blockposition).getBlock().getMaterial() == Material.AIR);
|
||||
+ } while (getType(world, blockposition).getBlock().getMaterial() == Material.AIR); // CraftBukkit
|
||||
- } while (world.getType(blockposition).getMaterial() == Material.AIR);
|
||||
+ } while (getType(world, blockposition).getMaterial() == Material.AIR); // CraftBukkit
|
||||
|
||||
return blockposition.getY() + 1;
|
||||
}
|
||||
@@ -319,7 +326,7 @@
|
||||
@@ -320,7 +327,7 @@
|
||||
}
|
||||
|
||||
blockposition = blockposition.down();
|
||||
- material = world.getType(blockposition).getBlock().getMaterial();
|
||||
+ material = getType(world, blockposition).getBlock().getMaterial(); // CraftBukkit
|
||||
- material = world.getType(blockposition).getMaterial();
|
||||
+ material = getType(world, blockposition).getMaterial(); // CraftBukkit
|
||||
} while (material == Material.AIR);
|
||||
|
||||
return !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -329,5 +336,12 @@
|
||||
@@ -330,5 +337,12 @@
|
||||
this.a = MathHelper.a(random, d0, d2);
|
||||
this.b = MathHelper.a(random, d1, d3);
|
||||
}
|
||||
|
|
|
@ -1,29 +1,34 @@
|
|||
--- a/net/minecraft/server/CommandTp.java
|
||||
+++ b/net/minecraft/server/CommandTp.java
|
||||
@@ -105,17 +105,11 @@
|
||||
@@ -97,27 +97,28 @@
|
||||
} else {
|
||||
Entity entity = b(icommandlistener, astring[astring.length - 1]);
|
||||
Entity entity = b(minecraftserver, icommandlistener, astring[astring.length - 1]);
|
||||
|
||||
- if (entity.world != ((Entity) object).world) {
|
||||
- throw new CommandException("commands.tp.notSameDimension", new Object[0]);
|
||||
- } else {
|
||||
- ((Entity) object).mount((Entity) null);
|
||||
- ((Entity) object).stopRiding();
|
||||
- if (object instanceof EntityPlayer) {
|
||||
- ((EntityPlayer) object).playerConnection.a(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
|
||||
- } else {
|
||||
- ((Entity) object).setPositionRotation(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
|
||||
- }
|
||||
-
|
||||
- a(icommandlistener, this, "commands.tp.success", new Object[] { ((Entity) object).getName(), entity.getName()});
|
||||
+ // CraftBukkit Start
|
||||
+ // Use Bukkit teleport method in all cases. It has cross dimensional handling, events
|
||||
+ if (((Entity) object).getBukkitEntity().teleport(entity.getBukkitEntity(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND)) {
|
||||
+ a(icommandlistener, this, "commands.tp.success", new Object[]{((Entity) object).getName(), entity.getName()});
|
||||
a(icommandlistener, (ICommand) this, "commands.tp.success", new Object[] { ((Entity) object).getName(), entity.getName()});
|
||||
+ // CraftBukkit End
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,4 +122,11 @@
|
||||
}
|
||||
|
||||
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
|
||||
- return astring.length != 1 && astring.length != 2 ? Collections.emptyList() : a(astring, minecraftserver.getPlayers());
|
||||
+ return astring.length != 1 && astring.length != 2 ? Collections.<String>emptyList() : a(astring, minecraftserver.getPlayers()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public boolean isListStart(String[] astring, int i) {
|
||||
return i == 0;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
|
||||
@@ -124,6 +147,7 @@
|
||||
l = playerinventory.getCarried().count;
|
||||
k = playerinventory.getCarried().count;
|
||||
Iterator iterator = this.h.iterator();
|
||||
|
||||
+ Map<Integer, ItemStack> draggedSlots = new HashMap<Integer, ItemStack>(); // CraftBukkit - Store slots from drag in map (raw slot id -> new stack)
|
||||
|
@ -55,20 +55,20 @@
|
|||
@@ -141,16 +165,48 @@
|
||||
}
|
||||
|
||||
l -= itemstack2.count - j1;
|
||||
k -= itemstack2.count - i1;
|
||||
- slot1.set(itemstack2);
|
||||
+ // slot1.set(itemstack2);
|
||||
+ draggedSlots.put(slot1.rawSlotIndex, itemstack2); // CraftBukkit - Put in map instead of setting
|
||||
}
|
||||
}
|
||||
|
||||
- itemstack1.count = l;
|
||||
- itemstack1.count = k;
|
||||
- if (itemstack1.count <= 0) {
|
||||
- itemstack1 = null;
|
||||
+ // CraftBukkit start - InventoryDragEvent
|
||||
+ InventoryView view = getBukkitView();
|
||||
+ org.bukkit.inventory.ItemStack newcursor = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+ newcursor.setAmount(l);
|
||||
+ newcursor.setAmount(k);
|
||||
+ Map<Integer, org.bukkit.inventory.ItemStack> eventmap = new HashMap<Integer, org.bukkit.inventory.ItemStack>();
|
||||
+ for (Map.Entry<Integer, ItemStack> ditem : draggedSlots.entrySet()) {
|
||||
+ eventmap.put(ditem.getKey(), CraftItemStack.asBukkitCopy(ditem.getValue()));
|
||||
|
@ -112,20 +112,20 @@
|
|||
if (j == 1) {
|
||||
- entityhuman.drop(playerinventory.getCarried().cloneAndSubtract(1), true);
|
||||
- if (playerinventory.getCarried().count == 0) {
|
||||
+ // CraftBukkit start - Store a reference
|
||||
+ ItemStack itemstack4 = playerinventory.getCarried();
|
||||
+ if (itemstack4.count > 0) {
|
||||
+ entityhuman.drop(itemstack4.cloneAndSubtract(1), true);
|
||||
+ // CraftBukkit start - Store a reference, don't drop unless > 0
|
||||
+ ItemStack carried = playerinventory.getCarried();
|
||||
+ if (carried.count > 0) {
|
||||
+ entityhuman.drop(carried.cloneAndSubtract(1), true);
|
||||
+ }
|
||||
+
|
||||
+ if (itemstack4.count == 0) {
|
||||
+ if (carried.count == 0) {
|
||||
+ // CraftBukkit end
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
}
|
||||
@@ -223,7 +285,11 @@
|
||||
|
||||
if (itemstack4.count == 0) {
|
||||
@@ -225,7 +287,11 @@
|
||||
slot2.set(itemstack3.cloneAndSubtract(j1));
|
||||
if (itemstack3.count == 0) {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
+ // CraftBukkit start - Update client cursor if we didn't empty it
|
||||
+ } else if (entityhuman instanceof EntityPlayer) {
|
||||
|
@ -134,10 +134,10 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (slot2.isAllowed(entityhuman)) {
|
||||
if (itemstack4 == null) {
|
||||
@@ -249,7 +315,11 @@
|
||||
itemstack4.cloneAndSubtract(k1);
|
||||
if (itemstack4.count == 0) {
|
||||
if (itemstack3 == null) {
|
||||
@@ -255,7 +321,11 @@
|
||||
itemstack3.cloneAndSubtract(j1);
|
||||
if (itemstack3.count == 0) {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
+ // CraftBukkit start - Update client cursor if we didn't empty it
|
||||
+ } else if (entityhuman instanceof EntityPlayer) {
|
||||
|
@ -145,20 +145,21 @@
|
|||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack1.count += k1;
|
||||
} else if (itemstack4.count <= slot2.getMaxStackSize(itemstack4)) {
|
||||
@@ -258,7 +328,9 @@
|
||||
itemstack1.count += j1;
|
||||
} else if (itemstack3.count <= slot2.getMaxStackSize(itemstack3)) {
|
||||
@@ -264,7 +334,10 @@
|
||||
}
|
||||
} else if (itemstack1.getItem() == itemstack4.getItem() && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) {
|
||||
k1 = itemstack1.count;
|
||||
- if (k1 > 0 && k1 + itemstack4.count <= itemstack4.getMaxStackSize()) {
|
||||
+ // CraftBukkit start - itemstack4.getMaxStackSize() -> maxStack
|
||||
+ int maxStack = Math.min(itemstack4.getMaxStackSize(), slot2.getMaxStackSize());
|
||||
+ if (k1 > 0 && k1 + itemstack4.count <= maxStack) {
|
||||
itemstack4.count += k1;
|
||||
itemstack1 = slot2.a(k1);
|
||||
} else if (itemstack1.getItem() == itemstack3.getItem() && itemstack3.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) {
|
||||
j1 = itemstack1.count;
|
||||
- if (j1 > 0 && j1 + itemstack3.count <= itemstack3.getMaxStackSize()) {
|
||||
+ // CraftBukkit start - itemstack3.getMaxStackSize() -> maxStack
|
||||
+ int maxStack = Math.min(itemstack3.getMaxStackSize(), slot2.getMaxStackSize());
|
||||
+ if (j1 > 0 && j1 + itemstack3.count <= maxStack) {
|
||||
+ // CraftBukkit end
|
||||
itemstack3.count += j1;
|
||||
itemstack1 = slot2.a(j1);
|
||||
if (itemstack1.count == 0) {
|
||||
@@ -266,11 +338,24 @@
|
||||
@@ -272,11 +345,24 @@
|
||||
}
|
||||
|
||||
slot2.a(entityhuman, playerinventory.getCarried());
|
||||
|
@ -182,9 +183,9 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
} else if (k == 2 && j >= 0 && j < 9) {
|
||||
@@ -411,17 +496,20 @@
|
||||
if (itemstack1 != null && itemstack1.getItem() == itemstack.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
|
||||
} else if (inventoryclicktype == InventoryClickType.SWAP && j >= 0 && j < 9) {
|
||||
@@ -430,14 +516,17 @@
|
||||
if (itemstack1 != null && a(itemstack, itemstack1)) {
|
||||
int l = itemstack1.count + itemstack.count;
|
||||
|
||||
- if (l <= itemstack.getMaxStackSize()) {
|
||||
|
@ -201,10 +202,7 @@
|
|||
+ } else if (itemstack1.count < maxStack) {
|
||||
+ itemstack.count -= maxStack - itemstack1.count;
|
||||
+ itemstack1.count = maxStack;
|
||||
+ // CraftBukkit end
|
||||
slot.f();
|
||||
flag1 = true;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
--- a/net/minecraft/server/ContainerAnvil.java
|
||||
+++ b/net/minecraft/server/ContainerAnvil.java
|
||||
@@ -6,6 +6,8 @@
|
||||
@@ -6,6 +6,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.inventory.PrepareAnvilEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ContainerAnvil extends Container {
|
||||
|
||||
private static final Logger f = LogManager.getLogger();
|
||||
@@ -22,8 +24,13 @@
|
||||
@@ -22,8 +28,13 @@
|
||||
private int k;
|
||||
private String l;
|
||||
private final EntityHuman m;
|
||||
|
@ -23,7 +27,43 @@
|
|||
this.j = blockposition;
|
||||
this.i = world;
|
||||
this.m = entityhuman;
|
||||
@@ -317,6 +324,7 @@
|
||||
@@ -109,7 +120,7 @@
|
||||
byte b1 = 0;
|
||||
|
||||
if (itemstack == null) {
|
||||
- this.g.setItem(0, (ItemStack) null);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), null); // CraftBukkit
|
||||
this.a = 0;
|
||||
} else {
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
@@ -127,7 +138,7 @@
|
||||
if (itemstack1.e() && itemstack1.getItem().a(itemstack, itemstack2)) {
|
||||
k = Math.min(itemstack1.h(), itemstack1.j() / 4);
|
||||
if (k <= 0) {
|
||||
- this.g.setItem(0, (ItemStack) null);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), null); // CraftBukkit
|
||||
this.a = 0;
|
||||
return;
|
||||
}
|
||||
@@ -142,7 +153,7 @@
|
||||
this.k = l;
|
||||
} else {
|
||||
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.e())) {
|
||||
- this.g.setItem(0, (ItemStack) null);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), null); // CraftBukkit
|
||||
this.a = 0;
|
||||
return;
|
||||
}
|
||||
@@ -269,7 +280,7 @@
|
||||
EnchantmentManager.a(map, itemstack1);
|
||||
}
|
||||
|
||||
- this.g.setItem(0, itemstack1);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), itemstack1); // CraftBukkit
|
||||
this.b();
|
||||
}
|
||||
}
|
||||
@@ -294,6 +305,7 @@
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
|
@ -31,11 +71,10 @@
|
|||
return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.e((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
@@ -372,4 +380,17 @@
|
||||
|
||||
@@ -350,6 +362,20 @@
|
||||
this.e();
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public CraftInventoryView getBukkitView() {
|
||||
|
@ -43,9 +82,13 @@
|
|||
+ return bukkitEntity;
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.h, this.g);
|
||||
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(
|
||||
+ new org.bukkit.Location(i.getWorld(), j.getX(), j.getY(), j.getZ()), this.h, this.g);
|
||||
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+
|
||||
static class SyntheticClass_1 {
|
||||
|
||||
static final int[] a = new int[Enchantment.Rarity.values().length];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/ContainerBrewingStand.java
|
||||
+++ b/net/minecraft/server/ContainerBrewingStand.java
|
||||
@@ -1,12 +1,23 @@
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -11,8 +11,9 @@
|
|||
public class ContainerBrewingStand extends Container {
|
||||
|
||||
private IInventory brewingStand;
|
||||
private final Slot f;
|
||||
@@ -7,7 +12,13 @@
|
||||
private int g;
|
||||
private int h;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
|
@ -22,9 +23,9 @@
|
|||
public ContainerBrewingStand(PlayerInventory playerinventory, IInventory iinventory) {
|
||||
+ player = playerinventory; // CraftBukkit
|
||||
this.brewingStand = iinventory;
|
||||
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 46)));
|
||||
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 53)));
|
||||
@@ -47,6 +58,7 @@
|
||||
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 51)));
|
||||
this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 58)));
|
||||
@@ -54,6 +65,7 @@
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
|
@ -32,8 +33,8 @@
|
|||
return this.brewingStand.a(entityhuman);
|
||||
}
|
||||
|
||||
@@ -146,4 +158,17 @@
|
||||
return itemstack != null && (itemstack.getItem() == Items.POTION || itemstack.getItem() == Items.GLASS_BOTTLE);
|
||||
@@ -182,4 +194,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
--- a/net/minecraft/server/ContainerEnchantTable.java
|
||||
+++ b/net/minecraft/server/ContainerEnchantTable.java
|
||||
@@ -3,9 +3,21 @@
|
||||
@@ -3,9 +3,22 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.Map;
|
||||
+import org.bukkit.Location;
|
||||
+
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryEnchanting;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
@ -23,10 +24,22 @@
|
|||
public int getMaxStackSize() {
|
||||
return 64;
|
||||
}
|
||||
@@ -21,6 +33,10 @@
|
||||
public int f;
|
||||
@@ -14,6 +27,11 @@
|
||||
super.update();
|
||||
ContainerEnchantTable.this.a((IInventory) this);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ return new org.bukkit.Location(world.getWorld(), position.getX(), position.getY(), position.getZ());
|
||||
+ }
|
||||
};
|
||||
private World world;
|
||||
private BlockPosition position;
|
||||
@@ -22,6 +40,10 @@
|
||||
public int[] costs = new int[3];
|
||||
public int[] h = new int[] { -1, -1, -1};
|
||||
public int[] i = new int[] { -1, -1, -1};
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private Player player;
|
||||
|
@ -34,7 +47,7 @@
|
|||
|
||||
public ContainerEnchantTable(PlayerInventory playerinventory, World world, BlockPosition blockposition) {
|
||||
this.world = world;
|
||||
@@ -53,6 +69,9 @@
|
||||
@@ -54,6 +76,9 @@
|
||||
this.a(new Slot(playerinventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
|
@ -43,8 +56,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
@@ -88,7 +107,7 @@
|
||||
protected void c(ICrafting icrafting) {
|
||||
@@ -90,7 +115,7 @@
|
||||
ItemStack itemstack = iinventory.getItem(0);
|
||||
int i;
|
||||
|
||||
|
@ -53,7 +66,7 @@
|
|||
if (!this.world.isClientSide) {
|
||||
i = 0;
|
||||
|
||||
@@ -136,6 +155,20 @@
|
||||
@@ -139,6 +164,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +87,7 @@
|
|||
for (j = 0; j < 3; ++j) {
|
||||
if (this.costs[j] > 0) {
|
||||
List list = this.a(itemstack, j, this.costs[j]);
|
||||
@@ -170,24 +203,55 @@
|
||||
@@ -175,24 +214,55 @@
|
||||
} else if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= j && entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) {
|
||||
if (!this.world.isClientSide) {
|
||||
List list = this.a(itemstack, i, this.costs[i]);
|
||||
|
@ -91,7 +104,7 @@
|
|||
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
|
||||
+ for (Object obj : list) {
|
||||
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
|
||||
+ enchants.put(org.bukkit.enchantments.Enchantment.getById(instance.enchantment.id), instance.level);
|
||||
+ enchants.put(org.bukkit.enchantments.Enchantment.getById(Enchantment.getId(instance.enchantment)), instance.level);
|
||||
+ }
|
||||
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
|
@ -112,7 +125,7 @@
|
|||
+ try {
|
||||
+ if (flag) {
|
||||
+ int enchantId = entry.getKey().getId();
|
||||
+ if (Enchantment.getById(enchantId) == null) {
|
||||
+ if (Enchantment.c(enchantId) == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
|
@ -120,8 +133,8 @@
|
|||
- Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant);
|
||||
- } else {
|
||||
- itemstack.addEnchantment(weightedrandomenchant.enchantment, weightedrandomenchant.level);
|
||||
+ WeightedRandomEnchant enchantment = new WeightedRandomEnchant(Enchantment.getById(enchantId), entry.getValue());
|
||||
+ Items.ENCHANTED_BOOK.a(itemstack, enchantment);
|
||||
+ WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(Enchantment.c(enchantId), entry.getValue());
|
||||
+ Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant);
|
||||
+ } else {
|
||||
+ item.addUnsafeEnchantment(entry.getKey(), entry.getValue());
|
||||
+ }
|
||||
|
@ -137,7 +150,7 @@
|
|||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack1.count -= j;
|
||||
if (itemstack1.count <= 0) {
|
||||
@@ -221,6 +285,11 @@
|
||||
@@ -226,6 +296,11 @@
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
super.b(entityhuman);
|
||||
|
@ -149,7 +162,7 @@
|
|||
if (!this.world.isClientSide) {
|
||||
for (int i = 0; i < this.enchantSlots.getSize(); ++i) {
|
||||
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(i);
|
||||
@@ -234,6 +303,7 @@
|
||||
@@ -239,6 +314,7 @@
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
|
@ -157,7 +170,7 @@
|
|||
return this.world.getType(this.position).getBlock() != Blocks.ENCHANTING_TABLE ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
@@ -286,4 +356,17 @@
|
||||
@@ -291,4 +367,17 @@
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/ContainerPlayer.java
|
||||
+++ b/net/minecraft/server/ContainerPlayer.java
|
||||
@@ -1,28 +1,42 @@
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -10,10 +10,11 @@
|
|||
+
|
||||
public class ContainerPlayer extends Container {
|
||||
|
||||
public InventoryCrafting craftInventory = new InventoryCrafting(this, 2, 2);
|
||||
private static final EnumItemSlot[] h = new EnumItemSlot[] { EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
|
||||
@@ -7,10 +12,20 @@
|
||||
public IInventory resultInventory = new InventoryCraftResult();
|
||||
public boolean g;
|
||||
private final EntityHuman h;
|
||||
private final EntityHuman owner;
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private PlayerInventory player;
|
||||
|
@ -21,58 +22,39 @@
|
|||
|
||||
public ContainerPlayer(final PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) {
|
||||
this.g = flag;
|
||||
this.h = entityhuman;
|
||||
this.owner = entityhuman;
|
||||
+ // CraftBukkit start
|
||||
+ this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
|
||||
+ this.craftInventory = new InventoryCrafting(this, 2, 2, playerinventory.player); // CraftBukkit - pass player
|
||||
+ this.craftInventory.resultInventory = this.resultInventory; // CraftBukkit - let InventoryCrafting know about its result slot
|
||||
+ this.player = playerinventory; // CraftBukkit - save player
|
||||
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 144, 36)));
|
||||
+ // CraftBukkit end
|
||||
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28)));
|
||||
|
||||
- final int i;
|
||||
+ // CraftBukkit - fixed multiple decompiler errors below, good luck
|
||||
int j;
|
||||
|
||||
- for (i = 0; i < 2; ++i) {
|
||||
+ for (int i = 0; i < 2; ++i) {
|
||||
for (j = 0; j < 2; ++j) {
|
||||
this.a(new Slot(this.craftInventory, j + i * 2, 88 + j * 18, 26 + i * 18));
|
||||
}
|
||||
int i;
|
||||
@@ -23,7 +38,7 @@
|
||||
}
|
||||
|
||||
- for (i = 0; i < 4; ++i) {
|
||||
- this.a(new Slot(playerinventory, playerinventory.getSize() - 1 - i, 8, 8 + i * 18) {
|
||||
+ for (int ii = 0; ii < 4; ++ii) {
|
||||
+ final int i = ii;
|
||||
+ this.a(new Slot(playerinventory, playerinventory.getSize() - 1 - ii, 8, 8 + ii * 18) {
|
||||
for (i = 0; i < 4; ++i) {
|
||||
- final EnumItemSlot enumitemslot = ContainerPlayer.h[i];
|
||||
+ final EnumItemSlot enumitemslot1 = ContainerPlayer.h[i];
|
||||
|
||||
this.a(new Slot(playerinventory, 36 + (3 - i), 8, 8 + i * 18) {
|
||||
public int getMaxStackSize() {
|
||||
return 1;
|
||||
}
|
||||
@@ -33,21 +47,32 @@
|
||||
});
|
||||
}
|
||||
|
||||
- for (i = 0; i < 3; ++i) {
|
||||
+ for (int i = 0; i < 3; ++i) {
|
||||
for (j = 0; j < 9; ++j) {
|
||||
this.a(new Slot(playerinventory, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18));
|
||||
@@ -57,11 +72,22 @@
|
||||
return super.isAllowed(itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
- for (i = 0; i < 9; ++i) {
|
||||
+ for (int i = 0; i < 9; ++i) {
|
||||
this.a(new Slot(playerinventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
});
|
||||
- this.a((IInventory) this.craftInventory);
|
||||
+ // this.a((IInventory) this.craftInventory); // CraftBukkit - unneeded since it just sets result slot to empty
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
- this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.h.world));
|
||||
+ // this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.h.world));
|
||||
- this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.owner.world));
|
||||
+ // this.resultInventory.setItem(0, CraftingManager.getInstance().craft(this.craftInventory, this.owner.world));
|
||||
+ // CraftBukkit start (Note: the following line would cause an error if called during construction)
|
||||
+ CraftingManager.getInstance().lastCraftView = getBukkitView();
|
||||
+ ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory, this.h.world);
|
||||
+ ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory, this.owner.world);
|
||||
+ this.resultInventory.setItem(0, craftResult);
|
||||
+ if (super.listeners.size() < 1) {
|
||||
+ return;
|
||||
|
@ -84,7 +66,7 @@
|
|||
}
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
@@ -127,4 +152,17 @@
|
||||
@@ -143,4 +169,17 @@
|
||||
public boolean a(ItemStack itemstack, Slot slot) {
|
||||
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
|
||||
}
|
||||
|
|
|
@ -17,10 +17,19 @@
|
|||
|
||||
public static CraftingManager getInstance() {
|
||||
return CraftingManager.a;
|
||||
@@ -167,7 +173,12 @@
|
||||
this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOODEN_SLAB});
|
||||
@@ -32,7 +38,7 @@
|
||||
this.recipes.add(new RecipeMapExtend());
|
||||
this.recipes.add(new RecipeFireworks());
|
||||
this.recipes.add(new RecipeRepair());
|
||||
- this.recipes.add(new RecipeTippedArrow());
|
||||
+ // this.recipes.add(new RecipeTippedArrow());
|
||||
(new RecipesBanner()).a(this);
|
||||
(new RecipiesShield()).a(this);
|
||||
this.registerShapedRecipe(new ItemStack(Items.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Items.REEDS});
|
||||
@@ -176,7 +182,12 @@
|
||||
this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST});
|
||||
this.registerShapedRecipe(new ItemStack(Items.ARMOR_STAND, 1), new Object[] { "///", " / ", "/_/", Character.valueOf('/'), Items.STICK, Character.valueOf('_'), new ItemStack(Blocks.STONE_SLAB, 1, BlockDoubleStepAbstract.EnumStoneSlabVariant.STONE.a())});
|
||||
this.registerShapedRecipe(new ItemStack(Blocks.END_ROD, 4), new Object[] { "/", "#", Character.valueOf('/'), Items.BLAZE_ROD, Character.valueOf('#'), Items.CHORUS_FRUIT_POPPED});
|
||||
- Collections.sort(this.recipes, new Comparator() {
|
||||
+ sort();
|
||||
+ }
|
||||
|
@ -31,7 +40,7 @@
|
|||
public int a(IRecipe irecipe, IRecipe irecipe1) {
|
||||
return irecipe instanceof ShapelessRecipes && irecipe1 instanceof ShapedRecipes ? 1 : (irecipe1 instanceof ShapelessRecipes && irecipe instanceof ShapedRecipes ? -1 : (irecipe1.a() < irecipe.a() ? -1 : (irecipe1.a() > irecipe.a() ? 1 : 0)));
|
||||
}
|
||||
@@ -274,13 +285,18 @@
|
||||
@@ -283,13 +294,18 @@
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
|
|
25
nms-patches/DataPaletteBlock.patch
Normal file
25
nms-patches/DataPaletteBlock.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
--- a/net/minecraft/server/DataPaletteBlock.java
|
||||
+++ b/net/minecraft/server/DataPaletteBlock.java
|
||||
@@ -109,7 +109,21 @@
|
||||
int i1 = nibblearray1 == null ? 0 : nibblearray1.a(j, k, l);
|
||||
int j1 = i1 << 12 | (abyte[i] & 255) << 4 | nibblearray.a(j, k, l);
|
||||
|
||||
- this.setBlockIndex(i, (IBlockData) Block.REGISTRY_ID.fromId(j1));
|
||||
+ // CraftBukkit start - fix blocks with random data values (caused by plugins)
|
||||
+ IBlockData data = Block.REGISTRY_ID.fromId(j1);
|
||||
+ if (data == null) {
|
||||
+ Block block = Block.getById(j1 >> 4);
|
||||
+ if (block != null) {
|
||||
+ try {
|
||||
+ data = block.fromLegacyData(j1 & 0xF);
|
||||
+ } catch (Exception ignored) {
|
||||
+ data = block.getBlockData();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ this.setBlockIndex(i, data);
|
||||
+ // this.setBlockIndex(i, (IBlockData) Block.REGISTRY_ID.fromId(j1));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
20
nms-patches/DataWatcher.patch
Normal file
20
nms-patches/DataWatcher.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/server/DataWatcher.java
|
||||
+++ b/net/minecraft/server/DataWatcher.java
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- public <T> void register(DataWatcherObject<T> datawatcherobject, T t0) {
|
||||
+ public <T> void register(DataWatcherObject<T> datawatcherobject, Object t0) { // CraftBukkit T -> Object
|
||||
int i = datawatcherobject.a();
|
||||
|
||||
if (i > 254) {
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private <T> void registerObject(DataWatcherObject<T> datawatcherobject, T t0) {
|
||||
+ private <T> void registerObject(DataWatcherObject<T> datawatcherobject, Object t0) { // CraftBukkit Object
|
||||
DataWatcher.Item datawatcher_item = new DataWatcher.Item(datawatcherobject, t0);
|
||||
|
||||
this.d.writeLock().lock();
|
|
@ -1,6 +1,18 @@
|
|||
--- a/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/DedicatedServer.java
|
||||
@@ -15,10 +15,20 @@
|
||||
@@ -4,10 +4,9 @@
|
||||
import com.mojang.authlib.GameProfileRepository;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
-import java.io.BufferedReader;
|
||||
+
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
-import java.io.InputStreamReader;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Proxy;
|
||||
import java.util.Collections;
|
||||
@@ -18,10 +17,20 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
@ -17,25 +29,25 @@
|
|||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
- private final List<ServerCommand> l = Collections.synchronizedList(Lists.newArrayList());
|
||||
+ private final List<ServerCommand> l = Collections.synchronizedList(Lists.<ServerCommand>newArrayList()); // CraftBukkit - fix decompile error
|
||||
- private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.newArrayList());
|
||||
+ private final List<ServerCommand> serverCommandQueue = Collections.synchronizedList(Lists.<ServerCommand>newArrayList()); // CraftBukkit - fix decompile error
|
||||
private RemoteStatusListener m;
|
||||
private RemoteControlListener n;
|
||||
public PropertyManager propertyManager;
|
||||
@@ -27,8 +37,10 @@
|
||||
private WorldSettings.EnumGamemode r;
|
||||
private boolean s;
|
||||
public final RemoteControlCommandListener remoteControlCommandListener = new RemoteControlCommandListener(this);
|
||||
private RemoteControlListener o;
|
||||
@@ -31,8 +40,10 @@
|
||||
private WorldSettings.EnumGamemode s;
|
||||
private boolean t;
|
||||
|
||||
- public DedicatedServer(File file) {
|
||||
- super(file, Proxy.NO_PROXY, DedicatedServer.a);
|
||||
- public DedicatedServer(File file, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
|
||||
- super(file, Proxy.NO_PROXY, dataconvertermanager, yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache);
|
||||
+ // CraftBukkit start - Signature changed
|
||||
+ public DedicatedServer(joptsimple.OptionSet options) {
|
||||
+ super(options, Proxy.NO_PROXY, DedicatedServer.a);
|
||||
+ public DedicatedServer(joptsimple.OptionSet options, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
|
||||
+ super(options, Proxy.NO_PROXY, dataconvertermanager, yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache);
|
||||
+ // CraftBukkit end
|
||||
Thread thread = new Thread("Server Infinisleeper") {
|
||||
{
|
||||
this.setDaemon(true);
|
||||
@@ -50,13 +62,27 @@
|
||||
@@ -54,13 +65,27 @@
|
||||
protected boolean init() throws IOException {
|
||||
Thread thread = new Thread("Server console handler") {
|
||||
public void run() {
|
||||
|
@ -66,7 +78,7 @@
|
|||
}
|
||||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
|
||||
@@ -65,6 +91,27 @@
|
||||
@@ -69,6 +94,27 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -93,17 +105,17 @@
|
|||
+
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
DedicatedServer.LOGGER.info("Starting minecraft server version 1.8.8");
|
||||
@@ -73,7 +120,7 @@
|
||||
DedicatedServer.LOGGER.info("Starting minecraft server version 1.9");
|
||||
@@ -77,7 +123,7 @@
|
||||
}
|
||||
|
||||
DedicatedServer.LOGGER.info("Loading properties");
|
||||
- this.propertyManager = new PropertyManager(new File("server.properties"));
|
||||
+ this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
|
||||
this.p = new EULA(new File("eula.txt"));
|
||||
if (!this.p.a()) {
|
||||
this.q = new EULA(new File("eula.txt"));
|
||||
if (!this.q.a()) {
|
||||
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
||||
@@ -129,6 +176,8 @@
|
||||
@@ -133,6 +179,8 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -112,20 +124,20 @@
|
|||
if (!this.getOnlineMode()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -143,7 +192,7 @@
|
||||
@@ -147,7 +195,7 @@
|
||||
if (!NameReferencingFileConverter.a(this.propertyManager)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.a((PlayerList) (new DedicatedPlayerList(this)));
|
||||
+ this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
|
||||
+ this.convertable = new WorldLoaderServer(server.getWorldContainer(), this.getDataConverterManager()); // CraftBukkit - moved from MinecraftServer constructor
|
||||
long j = System.nanoTime();
|
||||
|
||||
if (this.U() == null) {
|
||||
@@ -198,7 +247,18 @@
|
||||
if (this.S() == null) {
|
||||
@@ -205,7 +253,18 @@
|
||||
DedicatedServer.LOGGER.info("Starting remote control listener");
|
||||
this.n = new RemoteControlListener(this);
|
||||
this.n.a();
|
||||
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
|
||||
this.o = new RemoteControlListener(this);
|
||||
this.o.a();
|
||||
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.remoteControlCommandListener); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -138,39 +150,25 @@
|
|||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (this.aS() > 0L) {
|
||||
if (this.aP() > 0L) {
|
||||
Thread thread1 = new Thread(new ThreadWatchdog(this));
|
||||
@@ -213,6 +273,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public PropertyManager getPropertyManager() {
|
||||
+ return this.propertyManager;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
|
||||
super.setGamemode(worldsettings_enumgamemode);
|
||||
this.r = worldsettings_enumgamemode;
|
||||
@@ -265,7 +331,7 @@
|
||||
@@ -298,7 +357,7 @@
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
- protected void B() {
|
||||
+ public void B() { // CraftBukkit - fix decompile error
|
||||
super.B();
|
||||
this.aO();
|
||||
- protected void D() {
|
||||
+ public void D() { // CraftBukkit - fix decompile error
|
||||
super.D();
|
||||
this.aL();
|
||||
}
|
||||
@@ -296,7 +362,15 @@
|
||||
while (!this.l.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
|
||||
@@ -329,7 +388,14 @@
|
||||
while (!this.serverCommandQueue.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
|
||||
|
||||
- this.getCommandHandler().a(servercommand.source, servercommand.command);
|
||||
+ // CraftBukkit start - ServerCommand for preprocessing
|
||||
+ ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) continue;
|
||||
+ servercommand = new ServerCommand(event.getCommand(), servercommand.source);
|
||||
+
|
||||
+ // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
|
||||
|
@ -179,7 +177,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -491,13 +565,60 @@
|
||||
@@ -536,16 +602,70 @@
|
||||
}
|
||||
|
||||
public String getPlugins() {
|
||||
|
@ -200,17 +198,17 @@
|
|||
+ if (i > 0) {
|
||||
+ result.append("; ");
|
||||
+ }
|
||||
|
||||
- public String executeRemoteCommand(String s) {
|
||||
- RemoteControlCommandListener.getInstance().i();
|
||||
- this.b.a(RemoteControlCommandListener.getInstance(), s);
|
||||
- return RemoteControlCommandListener.getInstance().j();
|
||||
+
|
||||
+ result.append(plugins[i].getDescription().getName());
|
||||
+ result.append(" ");
|
||||
+ result.append(plugins[i].getDescription().getVersion().replaceAll(";", ","));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
- public String executeRemoteCommand(String s) {
|
||||
- this.remoteControlCommandListener.clearMessages();
|
||||
- this.b.a(this.remoteControlCommandListener, s);
|
||||
- return this.remoteControlCommandListener.getMessages();
|
||||
+ return result.toString();
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
|
@ -220,7 +218,7 @@
|
|||
+ Waitable<String> waitable = new Waitable<String>() {
|
||||
+ @Override
|
||||
+ protected String evaluate() {
|
||||
+ RemoteControlCommandListener.getInstance().i();
|
||||
+ remoteControlCommandListener.clearMessages();
|
||||
+ // Event changes start
|
||||
+ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
|
@ -228,9 +226,9 @@
|
|||
+ return "";
|
||||
+ }
|
||||
+ // Event change end
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.getInstance());
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener);
|
||||
+ server.dispatchServerCommand(remoteConsole, serverCommand);
|
||||
+ return RemoteControlCommandListener.getInstance().j();
|
||||
+ return remoteControlCommandListener.getMessages();
|
||||
+ }
|
||||
+ };
|
||||
+ processQueue.add(waitable);
|
||||
|
@ -246,3 +244,13 @@
|
|||
}
|
||||
|
||||
public PlayerList getPlayerList() {
|
||||
return this.aM();
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public PropertyManager getPropertyManager() {
|
||||
+ return this.propertyManager;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
public DispenseBehaviorProjectile() {}
|
||||
@@ -10,9 +15,38 @@
|
||||
EnumDirection enumdirection = BlockDispenser.b(isourceblock.f());
|
||||
IProjectile iprojectile = this.a(world, iposition);
|
||||
EnumDirection enumdirection = BlockDispenser.e(isourceblock.f());
|
||||
IProjectile iprojectile = this.a(world, iposition, itemstack);
|
||||
|
||||
- iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a());
|
||||
+ // iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.b(), this.a());
|
||||
|
|
|
@ -11,13 +11,31 @@
|
|||
+
|
||||
public class DispenserRegistry {
|
||||
|
||||
private static final PrintStream a = System.out;
|
||||
@@ -74,13 +79,45 @@
|
||||
public static final PrintStream a = System.out;
|
||||
@@ -69,7 +74,7 @@
|
||||
BlockDispenser.REGISTRY.a(Items.SPLASH_POTION, new IDispenseBehavior() {
|
||||
public ItemStack a(ISourceBlock isourceblock, final ItemStack itemstack) {
|
||||
return (new DispenseBehaviorProjectile() {
|
||||
- protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
+ protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) { // CraftBukkit - decompile issue
|
||||
return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack());
|
||||
}
|
||||
|
||||
@@ -86,7 +91,7 @@
|
||||
BlockDispenser.REGISTRY.a(Items.LINGERING_POTION, new IDispenseBehavior() {
|
||||
public ItemStack a(ISourceBlock isourceblock, final ItemStack itemstack) {
|
||||
return (new DispenseBehaviorProjectile() {
|
||||
- protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
+ protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) { // CraftBukkit - decompile issue
|
||||
return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack());
|
||||
}
|
||||
|
||||
@@ -106,14 +111,46 @@
|
||||
double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX();
|
||||
double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F);
|
||||
double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ();
|
||||
- Entity entity = ItemMonsterEgg.a(isourceblock.getWorld(), itemstack.getData(), d0, d1, d2);
|
||||
+ // Entity entity = ItemMonsterEgg.a(isourceblock.getWorld(), itemstack.getData(), d0, d1, d2);
|
||||
- Entity entity = ItemMonsterEgg.a(isourceblock.getWorld(), ItemMonsterEgg.h(itemstack), d0, d1, d2);
|
||||
+ // Entity entity = ItemMonsterEgg.a(isourceblock.getWorld(), ItemMonsterEgg.h(itemstack), d0, d1, d2);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ World world = isourceblock.getWorld();
|
||||
|
@ -48,19 +66,20 @@
|
|||
+
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+
|
||||
+ Entity entity = ItemMonsterEgg.spawnCreature(isourceblock.getWorld(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG);
|
||||
+ Entity entity = ItemMonsterEgg.spawnCreature(isourceblock.getWorld(), ItemMonsterEgg.h(itemstack), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG);
|
||||
|
||||
if (entity instanceof EntityLiving && itemstack.hasName()) {
|
||||
((EntityInsentient) entity).setCustomName(itemstack.getName());
|
||||
entity.setCustomName(itemstack.getName());
|
||||
}
|
||||
|
||||
ItemMonsterEgg.a(isourceblock.getWorld(), (EntityHuman) null, itemstack, entity);
|
||||
- itemstack.cloneAndSubtract(1);
|
||||
+ // itemstack.a(1); // Handled during event processing
|
||||
+ // itemstack.cloneAndSubtract(1);// Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -90,10 +127,39 @@
|
||||
@@ -123,10 +160,39 @@
|
||||
double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX();
|
||||
double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F);
|
||||
double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ();
|
||||
|
@ -97,12 +116,12 @@
|
|||
|
||||
isourceblock.getWorld().addEntity(entityfireworks);
|
||||
- itemstack.cloneAndSubtract(1);
|
||||
+ // itemstack.a(1); // Handled during event processing
|
||||
+ // itemstack.cloneAndSubtract(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -114,8 +180,38 @@
|
||||
@@ -147,13 +213,44 @@
|
||||
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
|
||||
|
||||
|
@ -134,66 +153,31 @@
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
|
||||
+ EntitySmallFireball fireball = new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ fireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
|
||||
+
|
||||
+ world.addEntity(entitysmallfireball);
|
||||
+ world.addEntity(fireball);
|
||||
+ // itemstack.a(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -146,10 +242,38 @@
|
||||
d3 = 0.0D;
|
||||
}
|
||||
|
||||
- EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
+ // EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
isourceblock.getWorld().triggerEffect(1018, isourceblock.getBlockPosition(), 0);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ // CraftBukkit end
|
||||
|
||||
world.addEntity(entityboat);
|
||||
- itemstack.cloneAndSubtract(1);
|
||||
+ // itemstack.a(1); // CraftBukkit - handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -164,9 +288,48 @@
|
||||
});
|
||||
BlockDispenser.REGISTRY.a(Items.aG, new DispenserRegistry.a(EntityBoat.EnumBoatType.OAK));
|
||||
@@ -169,9 +266,48 @@
|
||||
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ World world = isourceblock.getWorld();
|
||||
+ int x = blockposition.getX();
|
||||
+ int y = blockposition.getY();
|
||||
+ int z = blockposition.getZ();
|
||||
+ if (world.isEmpty(blockposition) || !world.getType(blockposition).getBlock().getMaterial().isBuildable()) {
|
||||
+ if (world.isEmpty(blockposition) || !world.getType(blockposition).getMaterial().isBuildable()) {
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
|
@ -218,9 +202,9 @@
|
|||
+
|
||||
+ itembucket = (ItemBucket) CraftItemStack.asNMSCopy(event.getItem()).getItem();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (itembucket.a(isourceblock.getWorld(), blockposition)) {
|
||||
if (itembucket.a((EntityHuman) null, isourceblock.getWorld(), blockposition)) {
|
||||
- itemstack.setItem(Items.BUCKET);
|
||||
- itemstack.count = 1;
|
||||
+ // CraftBukkit start - Handle stacked buckets
|
||||
|
@ -235,7 +219,7 @@
|
|||
return itemstack;
|
||||
} else {
|
||||
return this.b.a(isourceblock, itemstack);
|
||||
@@ -197,6 +360,30 @@
|
||||
@@ -202,6 +338,30 @@
|
||||
item = Items.LAVA_BUCKET;
|
||||
}
|
||||
|
||||
|
@ -266,9 +250,9 @@
|
|||
world.setAir(blockposition);
|
||||
if (--itemstack.count == 0) {
|
||||
itemstack.setItem(item);
|
||||
@@ -215,11 +402,39 @@
|
||||
@@ -220,11 +380,39 @@
|
||||
World world = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
|
@ -309,9 +293,9 @@
|
|||
} else if (world.getType(blockposition).getBlock() == Blocks.TNT) {
|
||||
Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true)));
|
||||
world.setAir(blockposition);
|
||||
@@ -247,6 +462,30 @@
|
||||
@@ -252,6 +440,30 @@
|
||||
World world = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
|
@ -340,10 +324,10 @@
|
|||
if (ItemDye.a(itemstack, world, blockposition)) {
|
||||
if (!world.isClientSide) {
|
||||
world.triggerEffect(2005, blockposition, 0);
|
||||
@@ -274,11 +513,40 @@
|
||||
@@ -279,11 +491,40 @@
|
||||
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
World world = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f()));
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.e(isourceblock.f()));
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
|
||||
+ // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
|
||||
+
|
||||
|
@ -352,7 +336,7 @@
|
|||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX() + 0.5, blockposition.getY() + 0.5, blockposition.getZ() + 0.5));
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
@ -377,9 +361,52 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
world.addEntity(entitytntprimed);
|
||||
world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
|
||||
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
- --itemstack.count;
|
||||
+ // --itemstack.count; // CraftBukkit - handled above
|
||||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -437,12 +678,40 @@
|
||||
d3 = 0.0D;
|
||||
}
|
||||
|
||||
- EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
+ // EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.count++;
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.count++;
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ idispensebehavior.a(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityboat.a(this.c);
|
||||
entityboat.yaw = enumdirection.opposite().l();
|
||||
world.addEntity(entityboat);
|
||||
- itemstack.cloneAndSubtract(1);
|
||||
+ // itemstack.cloneAndSubtract(1); // CraftBukkit - handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
--- a/net/minecraft/server/Enchantment.java
|
||||
+++ b/net/minecraft/server/Enchantment.java
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
public abstract class Enchantment {
|
||||
|
||||
+ // CraftBukkit - update CraftEnchant.getName(i) if this changes
|
||||
private static final Enchantment[] byId = new Enchantment[256];
|
||||
public static final Enchantment[] b;
|
||||
private static final Map<MinecraftKey, Enchantment> E = Maps.newHashMap();
|
||||
@@ -55,6 +56,8 @@
|
||||
Enchantment.byId[i] = this;
|
||||
Enchantment.E.put(minecraftkey, this);
|
||||
}
|
||||
+
|
||||
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment(this)); // CraftBukkit
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
public static Enchantment getByName(String s) {
|
||||
public static int getId(Enchantment enchantment) {
|
||||
- return Enchantment.enchantments.a((Object) enchantment);
|
||||
+ return Enchantment.enchantments.a(enchantment); // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
public static Enchantment b(String s) {
|
||||
@@ -135,6 +135,11 @@
|
||||
Enchantment.enchantments.a(61, new MinecraftKey("luck_of_the_sea"), new EnchantmentLootBonus(Enchantment.Rarity.RARE, EnchantmentSlotType.FISHING_ROD, new EnumItemSlot[] { EnumItemSlot.MAINHAND}));
|
||||
Enchantment.enchantments.a(62, new MinecraftKey("lure"), new EnchantmentLure(Enchantment.Rarity.RARE, EnchantmentSlotType.FISHING_ROD, new EnumItemSlot[] { EnumItemSlot.MAINHAND}));
|
||||
Enchantment.enchantments.a(70, new MinecraftKey("mending"), new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
|
||||
+ // CraftBukkit start
|
||||
+ for (Enchantment enchantment : Enchantment.enchantments) {
|
||||
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment(enchantment));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static enum Rarity {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/server/EnchantmentThorns.java
|
||||
+++ b/net/minecraft/server/EnchantmentThorns.java
|
||||
@@ -29,7 +29,7 @@
|
||||
Random random = entityliving.bc();
|
||||
ItemStack itemstack = EnchantmentManager.a(Enchantment.THORNS, entityliving);
|
||||
Random random = entityliving.getRandom();
|
||||
ItemStack itemstack = 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));
|
||||
entity.makeSound("damage.thorns", 0.5F, 1.0F);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/server/Entity.java
|
||||
+++ b/net/minecraft/server/Entity.java
|
||||
@@ -6,8 +6,40 @@
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -15,8 +15,47 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
|
@ -12,11 +12,9 @@
|
|||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Painting;
|
||||
+import org.bukkit.entity.Vehicle;
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
+import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||
+import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||
+import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
+import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
|
@ -36,22 +34,31 @@
|
|||
+ static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
|
||||
+ return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
+ }
|
||||
+
|
||||
+ protected CraftEntity bukkitEntity;
|
||||
+
|
||||
+ public CraftEntity getBukkitEntity() {
|
||||
+ if (bukkitEntity == null) {
|
||||
+ bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
|
||||
+ }
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukikt end
|
||||
+
|
||||
private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
private static int entityCount;
|
||||
private int id;
|
||||
@@ -79,6 +111,9 @@
|
||||
private boolean invulnerable;
|
||||
protected UUID uniqueID;
|
||||
private final CommandObjectiveExecutor au;
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
private static final AxisAlignedBB b = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
private static double c = 1.0D;
|
||||
@@ -97,6 +136,9 @@
|
||||
public boolean glowing;
|
||||
private final Set<String> aF;
|
||||
private boolean aG;
|
||||
+ public boolean valid; // CraftBukkit
|
||||
+ public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
||||
+ public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
@@ -152,6 +187,33 @@
|
||||
public Entity(World world) {
|
||||
this.id = Entity.entityCount++;
|
||||
@@ -193,6 +235,33 @@
|
||||
}
|
||||
|
||||
protected void setYawPitch(float f, float f1) {
|
||||
|
@ -85,16 +92,16 @@
|
|||
this.yaw = f % 360.0F;
|
||||
this.pitch = f1 % 360.0F;
|
||||
}
|
||||
@@ -188,7 +250,7 @@
|
||||
int i = this.L();
|
||||
|
||||
@@ -236,7 +305,7 @@
|
||||
if (this.ak) {
|
||||
MinecraftServer minecraftserver = this.world.getMinecraftServer();
|
||||
|
||||
- if (minecraftserver.getAllowNether()) {
|
||||
+ if (true || minecraftserver.getAllowNether()) { // CraftBukkit
|
||||
if (this.vehicle == null && this.al++ >= i) {
|
||||
this.al = i;
|
||||
this.portalCooldown = this.aq();
|
||||
@@ -265,6 +327,27 @@
|
||||
if (!this.isPassenger()) {
|
||||
int i = this.V();
|
||||
|
||||
@@ -321,6 +390,27 @@
|
||||
protected void burnFromLava() {
|
||||
if (!this.fireProof) {
|
||||
this.damageEntity(DamageSource.LAVA, 4.0F);
|
||||
|
@ -122,7 +129,7 @@
|
|||
this.setOnFire(15);
|
||||
}
|
||||
}
|
||||
@@ -302,6 +385,22 @@
|
||||
@@ -361,6 +451,22 @@
|
||||
this.a(this.getBoundingBox().c(d0, d1, d2));
|
||||
this.recalcPosition();
|
||||
} else {
|
||||
|
@ -138,15 +145,15 @@
|
|||
+ throw new ReportedException(crashreport);
|
||||
+ }
|
||||
+ // Check if we're moving
|
||||
+ if (d0 == 0 && d1 == 0 && d2 == 0 && this.vehicle == null && this.passenger == null) {
|
||||
+ if (d0 == 0 && d1 == 0 && d2 == 0 && this.isVehicle() && this.isPassenger()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.methodProfiler.a("move");
|
||||
double d3 = this.locX;
|
||||
double d4 = this.locY;
|
||||
@@ -522,6 +621,26 @@
|
||||
block.a(this.world, this);
|
||||
@@ -585,6 +691,26 @@
|
||||
block1.a(this.world, this);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -169,23 +176,23 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.s_() && !flag && this.vehicle == null) {
|
||||
if (this.playStepSound() && !flag && !this.isPassenger()) {
|
||||
double d21 = this.locX - d3;
|
||||
double d22 = this.locY - d4;
|
||||
@@ -532,7 +651,7 @@
|
||||
@@ -595,7 +721,7 @@
|
||||
}
|
||||
|
||||
if (block != null && this.onGround) {
|
||||
- block.a(this.world, blockposition, this);
|
||||
+ // block.a(this.world, blockposition, this); // CraftBukkit moved down
|
||||
if (block1 != null && this.onGround) {
|
||||
- block1.stepOn(this.world, blockposition, this);
|
||||
+ // block1.stepOn(this.world, blockposition, this); // CraftBukkit moved down
|
||||
}
|
||||
|
||||
this.M = (float) ((double) this.M + (double) MathHelper.sqrt(d21 * d21 + d23 * d23) * 0.6D);
|
||||
@@ -550,9 +669,12 @@
|
||||
this.J = (float) ((double) this.J + (double) MathHelper.sqrt(d21 * d21 + d10 * d10) * 0.6D);
|
||||
@@ -613,9 +739,12 @@
|
||||
}
|
||||
|
||||
this.a(blockposition, block);
|
||||
+ block.a(this.world, blockposition, this); // CraftBukkit moved from above
|
||||
this.a(blockposition, block1);
|
||||
+ block1.stepOn(this.world, blockposition, this); // CraftBukkit moved from above
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,16 +201,16 @@
|
|||
try {
|
||||
this.checkBlockCollisions();
|
||||
} catch (Throwable throwable) {
|
||||
@@ -562,6 +684,8 @@
|
||||
@@ -625,6 +754,8 @@
|
||||
this.appendEntityCrashDetails(crashreportsystemdetails);
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
boolean flag2 = this.U();
|
||||
boolean flag2 = this.ah();
|
||||
|
||||
@@ -569,7 +693,16 @@
|
||||
@@ -632,7 +763,16 @@
|
||||
this.burn(1);
|
||||
if (!flag2) {
|
||||
++this.fireTicks;
|
||||
|
@ -221,7 +228,7 @@
|
|||
this.setOnFire(8);
|
||||
}
|
||||
}
|
||||
@@ -675,7 +808,7 @@
|
||||
@@ -745,7 +885,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -230,7 +237,7 @@
|
|||
if (!this.fireProof) {
|
||||
this.damageEntity(DamageSource.FIRE, (float) i);
|
||||
}
|
||||
@@ -818,6 +951,13 @@
|
||||
@@ -911,6 +1051,13 @@
|
||||
}
|
||||
|
||||
public void spawnIn(World world) {
|
||||
|
@ -244,7 +251,7 @@
|
|||
this.world = world;
|
||||
}
|
||||
|
||||
@@ -1010,6 +1150,18 @@
|
||||
@@ -1104,6 +1251,18 @@
|
||||
try {
|
||||
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ}));
|
||||
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
|
||||
|
@ -263,36 +270,37 @@
|
|||
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
|
||||
nbttagcompound.setFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.setShort("Fire", (short) this.fireTicks);
|
||||
@@ -1020,6 +1172,11 @@
|
||||
@@ -1113,6 +1272,12 @@
|
||||
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
|
||||
nbttagcompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
|
||||
nbttagcompound.a("UUID", this.getUniqueID());
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: Check above UUID reads 1.8 properly, ie: UUIDMost / UUIDLeast
|
||||
+ nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
|
||||
+ nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
|
||||
+ nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL);
|
||||
+ // CraftBukkit end
|
||||
if (this.getCustomName() != null && this.getCustomName().length() > 0) {
|
||||
if (this.getCustomName() != null && !this.getCustomName().isEmpty()) {
|
||||
nbttagcompound.setString("CustomName", this.getCustomName());
|
||||
nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
|
||||
@@ -1057,6 +1214,8 @@
|
||||
this.motX = nbttaglist1.d(0);
|
||||
this.motY = nbttaglist1.d(1);
|
||||
this.motZ = nbttaglist1.d(2);
|
||||
}
|
||||
@@ -1183,6 +1348,8 @@
|
||||
this.motX = nbttaglist1.e(0);
|
||||
this.motY = nbttaglist1.e(1);
|
||||
this.motZ = nbttaglist1.e(2);
|
||||
+
|
||||
+ /* CraftBukkit start - Moved section down
|
||||
if (Math.abs(this.motX) > 10.0D) {
|
||||
this.motX = 0.0D;
|
||||
}
|
||||
@@ -1068,6 +1227,7 @@
|
||||
@@ -1194,6 +1361,7 @@
|
||||
if (Math.abs(this.motZ) > 10.0D) {
|
||||
this.motZ = 0.0D;
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.lastX = this.P = this.locX = nbttaglist.d(0);
|
||||
this.lastY = this.Q = this.locY = nbttaglist.d(1);
|
||||
@@ -1103,6 +1263,58 @@
|
||||
this.lastX = this.M = this.locX = nbttaglist.e(0);
|
||||
this.lastY = this.N = this.locY = nbttaglist.e(1);
|
||||
@@ -1241,6 +1409,58 @@
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
|
@ -351,7 +359,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -1164,6 +1376,12 @@
|
||||
@@ -1302,6 +1522,12 @@
|
||||
|
||||
public EntityItem a(ItemStack itemstack, float f) {
|
||||
if (itemstack.count != 0 && itemstack.getItem() != null) {
|
||||
|
@ -363,79 +371,54 @@
|
|||
+ // CraftBukkit end
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
|
||||
|
||||
entityitem.p();
|
||||
@@ -1277,17 +1495,70 @@
|
||||
return (double) this.length * 0.75D;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ protected CraftEntity bukkitEntity;
|
||||
+
|
||||
+ public CraftEntity getBukkitEntity() {
|
||||
+ if (bukkitEntity == null) {
|
||||
+ bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
|
||||
+ }
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+
|
||||
public void mount(Entity entity) {
|
||||
+ Entity originalVehicle = this.vehicle;
|
||||
+ Entity originalPassenger = this.vehicle == null ? null : this.vehicle.passenger;
|
||||
+ PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
+ getBukkitEntity(); // make sure bukkitEntity is initialised
|
||||
+ // CraftBukkit end
|
||||
this.ar = 0.0D;
|
||||
this.as = 0.0D;
|
||||
if (entity == null) {
|
||||
if (this.vehicle != null) {
|
||||
+ // CraftBukkit start
|
||||
+ if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||
+ VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
+ pluginManager.callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled() || vehicle != originalVehicle) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
this.vehicle.passenger = null;
|
||||
}
|
||||
|
||||
this.vehicle = null;
|
||||
entityitem.q();
|
||||
@@ -1422,6 +1648,22 @@
|
||||
if (entity.by() != this) {
|
||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
|
||||
+ // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are.
|
||||
+ VehicleExitEvent exitEvent = null;
|
||||
+ if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) {
|
||||
+ exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
+ pluginManager.callEvent(exitEvent);
|
||||
+
|
||||
+ if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
|
||||
+ pluginManager.callEvent(event);
|
||||
+
|
||||
+ // If a plugin messes with the vehicle or the vehicle's passenger
|
||||
+ if (event.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
+ // If we only cancelled the enterevent then we need to put the player in a decent position.
|
||||
+ if (exitEvent != null && this.vehicle == originalVehicle && this.vehicle != null && this.vehicle.passenger == originalPassenger) {
|
||||
+ this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
+ this.vehicle.passenger = null;
|
||||
+ this.vehicle = null;
|
||||
+ }
|
||||
+ CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
||||
+ Entity orig = craft == null ? null : craft.getHandle();
|
||||
+ if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
||||
+ VehicleEnterEvent event = new VehicleEnterEvent(
|
||||
+ (Vehicle) getBukkitEntity(),
|
||||
+ entity.getBukkitEntity()
|
||||
+ );
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
||||
+ Entity n = craftn == null ? null : craftn.getHandle();
|
||||
+ if (event.isCancelled() || n != orig) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.vehicle != null) {
|
||||
this.vehicle.passenger = null;
|
||||
}
|
||||
@@ -1406,10 +1677,49 @@
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) {
|
||||
this.passengers.add(0, entity);
|
||||
} else {
|
||||
@@ -1435,6 +1677,22 @@
|
||||
if (entity.by() == this) {
|
||||
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
||||
+ Entity orig = craft == null ? null : craft.getHandle();
|
||||
+ if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
||||
+ VehicleExitEvent event = new VehicleExitEvent(
|
||||
+ (Vehicle) getBukkitEntity(),
|
||||
+ (LivingEntity) entity.getBukkitEntity()
|
||||
+ );
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle();
|
||||
+ Entity n = craftn == null ? null : craftn.getHandle();
|
||||
+ if (event.isCancelled() || n != orig) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.passengers.remove(entity);
|
||||
entity.j = 60;
|
||||
}
|
||||
@@ -1577,10 +1835,38 @@
|
||||
}
|
||||
|
||||
public void onLightningStrike(EntityLightning entitylightning) {
|
||||
|
@ -447,20 +430,9 @@
|
|||
+
|
||||
+ if (thisBukkitEntity instanceof Hanging) {
|
||||
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
|
||||
+ PaintingBreakByEntityEvent paintingEvent = null;
|
||||
+
|
||||
+ if (thisBukkitEntity instanceof Painting) {
|
||||
+ paintingEvent = new PaintingBreakByEntityEvent((Painting) thisBukkitEntity, stormBukkitEntity);
|
||||
+ }
|
||||
+
|
||||
+ pluginManager.callEvent(hangingEvent);
|
||||
+
|
||||
+ if (paintingEvent != null) {
|
||||
+ paintingEvent.setCancelled(hangingEvent.isCancelled());
|
||||
+ pluginManager.callEvent(paintingEvent);
|
||||
+ }
|
||||
+
|
||||
+ if (hangingEvent.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
|
||||
+ if (hangingEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
|
@ -487,14 +459,14 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1550,32 +1860,83 @@
|
||||
@@ -1715,19 +2001,67 @@
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
this.world.methodProfiler.a("changeDimension");
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
MinecraftServer minecraftserver = this.h();
|
||||
- int j = this.dimension;
|
||||
- WorldServer worldserver = minecraftserver.getWorldServer(j);
|
||||
- WorldServer worldserver1 = minecraftserver.getWorldServer(i);
|
||||
+ // CraftBukkit start - Move logic into new function "teleportToLocation"
|
||||
+ // CraftBukkit start - Move logic into new function "teleportTo(Location,boolean)"
|
||||
+ // int j = this.dimension;
|
||||
+ // WorldServer worldserver = minecraftserver.getWorldServer(j);
|
||||
+ // WorldServer worldserver1 = minecraftserver.getWorldServer(i);
|
||||
|
@ -508,8 +480,19 @@
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ BlockPosition blockposition = null; // PAIL: CHECK
|
||||
+ Location enter = this.getBukkitEntity().getLocation();
|
||||
+ Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null;
|
||||
+ Location exit;
|
||||
+ if (exitWorld != null) {
|
||||
+ if (blockposition != null) {
|
||||
+ exit = new Location(exitWorld.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ } else {
|
||||
+ exit = minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i));
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ exit = null;
|
||||
+ }
|
||||
+ boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END
|
||||
+
|
||||
+ TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
|
||||
|
@ -517,14 +500,15 @@
|
|||
+ event.useTravelAgent(useTravelAgent);
|
||||
+ event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !this.isAlive()) {
|
||||
+ return;
|
||||
+ return null;
|
||||
+ }
|
||||
+ exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo();
|
||||
+ this.teleportTo(exit, true);
|
||||
+ return this.teleportTo(exit, true);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ public void teleportTo(Location exit, boolean portal) {
|
||||
+ public Entity teleportTo(Location exit, boolean portal) {
|
||||
+ if (true) {
|
||||
+ WorldServer worldserver = ((CraftWorld) getBukkitEntity().getLocation().getWorld()).getHandle();
|
||||
+ WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
|
||||
|
@ -542,28 +526,42 @@
|
|||
this.world.kill(this);
|
||||
this.dead = false;
|
||||
this.world.methodProfiler.a("reposition");
|
||||
- minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
|
||||
+ /* CraftBukkit start - Handled in calculateTarget
|
||||
BlockPosition blockposition;
|
||||
|
||||
if (i == 1) {
|
||||
@@ -1756,12 +2090,18 @@
|
||||
blockposition = new BlockPosition(this);
|
||||
}
|
||||
|
||||
- worldserver.entityJoinedWorld(this, false);
|
||||
+ // CraftBukkit end */
|
||||
+ // CraftBukkit start - Ensure chunks are loaded in case TravelAgent is not used which would initially cause chunks to load during find/create
|
||||
+ // minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
|
||||
+ boolean before = worldserver1.chunkProviderServer.forceChunkLoad;
|
||||
+ worldserver1.chunkProviderServer.forceChunkLoad = true;
|
||||
+ worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal);
|
||||
+ worldserver1.chunkProviderServer.forceChunkLoad = before;
|
||||
+ // worldserver.entityJoinedWorld(this, false); // Handled in repositionEntity
|
||||
+ // CraftBukkit end
|
||||
this.world.methodProfiler.c("reloading");
|
||||
Entity entity = EntityTypes.createEntityByName(EntityTypes.b(this), worldserver1);
|
||||
|
||||
if (entity != null) {
|
||||
entity.n(this);
|
||||
entity.a(this);
|
||||
+ /* CraftBukkit start - We need to do this...
|
||||
if (j == 1 && i == 1) {
|
||||
BlockPosition blockposition = this.world.r(worldserver1.getSpawn());
|
||||
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
|
||||
|
||||
@@ -1769,6 +2109,7 @@
|
||||
} else {
|
||||
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
boolean flag = entity.attachedToPlayer;
|
||||
|
||||
@@ -1776,6 +2117,14 @@
|
||||
worldserver1.addEntity(entity);
|
||||
entity.attachedToPlayer = flag;
|
||||
worldserver1.entityJoinedWorld(entity, false);
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity);
|
||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||
|
@ -575,7 +573,7 @@
|
|||
}
|
||||
|
||||
this.dead = true;
|
||||
@@ -1670,6 +2031,11 @@
|
||||
@@ -1881,6 +2230,11 @@
|
||||
}
|
||||
|
||||
public void setCustomName(String s) {
|
||||
|
@ -584,10 +582,10 @@
|
|||
+ s = s.substring(0, 256);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.datawatcher.watch(2, s);
|
||||
this.datawatcher.set(Entity.az, s);
|
||||
}
|
||||
|
||||
@@ -1721,7 +2087,26 @@
|
||||
@@ -1938,7 +2292,26 @@
|
||||
}
|
||||
|
||||
public void a(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -615,3 +613,12 @@
|
|||
}
|
||||
|
||||
public float getHeadHeight() {
|
||||
@@ -2110,7 +2483,7 @@
|
||||
for (Iterator iterator = this.bu().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
|
||||
entity = (Entity) iterator.next();
|
||||
if (oclass.isAssignableFrom(entity.getClass())) {
|
||||
- set.add(entity);
|
||||
+ set.add((T) entity); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
--- a/net/minecraft/server/EntityAgeable.java
|
||||
+++ b/net/minecraft/server/EntityAgeable.java
|
||||
@@ -7,6 +7,7 @@
|
||||
@@ -8,6 +8,7 @@
|
||||
protected int c;
|
||||
private float bm = -1.0F;
|
||||
private float bn;
|
||||
+ public boolean ageLocked = false; // CraftBukkit
|
||||
private float bw = -1.0F;
|
||||
private float bx;
|
||||
+ public boolean ageLocked; // CraftBukkit
|
||||
|
||||
public EntityAgeable(World world) {
|
||||
super(world);
|
||||
@@ -27,14 +28,14 @@
|
||||
@@ -26,13 +27,16 @@
|
||||
if (entityageable != null) {
|
||||
entityageable.setAgeRaw(-24000);
|
||||
entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
|
||||
|
@ -20,12 +20,13 @@
|
|||
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
--itemstack.count;
|
||||
- if (itemstack.count <= 0) {
|
||||
+ if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite"
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
||||
}
|
||||
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
||||
+ }
|
||||
}
|
||||
@@ -99,17 +100,19 @@
|
||||
}
|
||||
}
|
||||
@@ -95,12 +99,14 @@
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setInt("Age", this.getAge());
|
||||
nbttagcompound.setInt("ForcedAge", this.b);
|
||||
|
@ -39,19 +40,13 @@
|
|||
+ this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
|
||||
}
|
||||
|
||||
public void m() {
|
||||
super.m();
|
||||
public void a(DataWatcherObject<?> datawatcherobject) {
|
||||
@@ -113,7 +119,7 @@
|
||||
|
||||
public void n() {
|
||||
super.n();
|
||||
- if (this.world.isClientSide) {
|
||||
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit
|
||||
if (this.c > 0) {
|
||||
if (this.c % 4 == 0) {
|
||||
this.world.addParticle(EnumParticle.VILLAGER_HAPPY, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
@@ -146,7 +149,7 @@
|
||||
this.a(flag ? 0.5F : 1.0F);
|
||||
}
|
||||
|
||||
- protected final void setSize(float f, float f1) {
|
||||
+ public final void setSize(float f, float f1) { // CraftBukkit - protected to public
|
||||
boolean flag = this.bm > 0.0F;
|
||||
|
||||
this.bm = f;
|
||||
|
|
|
@ -17,4 +17,4 @@
|
|||
+ // CraftBukkit end */
|
||||
|
||||
public float a(BlockPosition blockposition) {
|
||||
return this.world.getType(blockposition.down()).getBlock() == Blocks.GRASS ? 10.0F : this.world.o(blockposition) - 0.5F;
|
||||
return this.world.getType(blockposition.down()).getBlock() == Blocks.GRASS ? 10.0F : this.world.n(blockposition) - 0.5F;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/EntityArmorStand.java
|
||||
+++ b/net/minecraft/server/EntityArmorStand.java
|
||||
@@ -2,6 +2,15 @@
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -15,19 +15,19 @@
|
|||
+
|
||||
public class EntityArmorStand extends EntityLiving {
|
||||
|
||||
private static final Vector3f a = new Vector3f(0.0F, 0.0F, 0.0F);
|
||||
@@ -332,6 +341,22 @@
|
||||
ItemStack itemstack1 = entityhuman.inventory.getItem(j);
|
||||
private static final Vector3f bp = new Vector3f(0.0F, 0.0F, 0.0F);
|
||||
@@ -360,6 +369,21 @@
|
||||
if (itemstack1 == null || (this.bz & 1 << enumitemslot.c() + 8) == 0) {
|
||||
if (itemstack1 != null || (this.bz & 1 << enumitemslot.c() + 16) == 0) {
|
||||
ItemStack itemstack2;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+ 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();
|
||||
+
|
||||
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(i);
|
||||
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
|
||||
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot);
|
||||
+ this.world.getServer().getPluginManager().callEvent(armorStandManipulateEvent);
|
||||
+
|
||||
|
@ -35,11 +35,10 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (entityhuman.abilities.canInstantlyBuild && (itemstack == null || itemstack.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack1 != null) {
|
||||
itemstack2 = itemstack1.cloneItemStack();
|
||||
itemstack2.count = 1;
|
||||
@@ -352,6 +377,11 @@
|
||||
|
||||
if (entityhuman.abilities.canInstantlyBuild && (itemstack1 == null || itemstack1.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack != null) {
|
||||
itemstack2 = itemstack.cloneItemStack();
|
||||
@@ -381,6 +405,11 @@
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
|
@ -48,24 +47,6 @@
|
|||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.world.isClientSide) {
|
||||
return false;
|
||||
} else if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
|
||||
@@ -616,7 +646,8 @@
|
||||
return (this.datawatcher.getByte(10) & 8) != 0;
|
||||
}
|
||||
|
||||
- private void n(boolean flag) {
|
||||
+ // PAIL
|
||||
+ public void n(boolean flag) { // CraftBukkit - public
|
||||
byte b0 = this.datawatcher.getByte(10);
|
||||
|
||||
if (flag) {
|
||||
@@ -628,6 +659,7 @@
|
||||
this.datawatcher.watch(10, Byte.valueOf(b0));
|
||||
}
|
||||
|
||||
+ // PAIL
|
||||
public boolean s() {
|
||||
return (this.datawatcher.getByte(10) & 16) != 0;
|
||||
}
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) {
|
||||
this.die();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/EntityArrow.java
|
||||
+++ b/net/minecraft/server/EntityArrow.java
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
import com.google.common.base.Predicates;
|
||||
import java.util.List;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -10,62 +10,54 @@
|
|||
+import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityArrow extends Entity implements IProjectile {
|
||||
public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
|
||||
private int d = -1;
|
||||
@@ -35,6 +41,7 @@
|
||||
super(world);
|
||||
this.j = 10.0D;
|
||||
private static final Predicate<Entity> f = Predicates.and(new Predicate[] { IEntitySelector.e, IEntitySelector.a, new Predicate() {
|
||||
@@ -49,6 +55,7 @@
|
||||
public EntityArrow(World world, EntityLiving entityliving) {
|
||||
this(world, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ);
|
||||
this.shooter = entityliving;
|
||||
+ this.projectileSource = (LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
this.fromPlayer = 1;
|
||||
this.fromPlayer = EntityArrow.PickupStatus.ALLOWED;
|
||||
}
|
||||
@@ -62,6 +69,7 @@
|
||||
super(world);
|
||||
this.j = 10.0D;
|
||||
this.shooter = entityliving;
|
||||
+ this.projectileSource = (LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
this.fromPlayer = 1;
|
||||
}
|
||||
@@ -201,6 +209,7 @@
|
||||
float f3;
|
||||
@@ -228,7 +235,7 @@
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
|
||||
if (movingobjectposition.entity != null) {
|
||||
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
int k = MathHelper.f((double) f2 * this.damage);
|
||||
@@ -217,11 +226,18 @@
|
||||
damagesource = DamageSource.arrow(this, this.shooter);
|
||||
}
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
Entity entity = movingobjectposition.entity;
|
||||
-
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
|
||||
if (entity != null) {
|
||||
float f = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
int i = MathHelper.f((double) f * this.damage);
|
||||
@@ -245,11 +252,18 @@
|
||||
damagesource = DamageSource.arrow(this, this.shooter);
|
||||
}
|
||||
|
||||
- if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman)) {
|
||||
- movingobjectposition.entity.setOnFire(5);
|
||||
+ // CraftBukkit start - Moved damage call
|
||||
+ if (movingobjectposition.entity.damageEntity(damagesource, (float) k)) {
|
||||
+ if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ movingobjectposition.entity.setOnFire(combustEvent.getDuration());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ // CraftBukkit start - Moved damage call
|
||||
+ if (movingobjectposition.entity.damageEntity(damagesource, (float) i)) {
|
||||
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
|
||||
- entity.setOnFire(5);
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.setOnFire(combustEvent.getDuration());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- if (movingobjectposition.entity.damageEntity(damagesource, (float) k)) {
|
||||
+ // if (movingobjectposition.entity.damageEntity(damagesource, (float) k)) { // CraftBukkit - moved up
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
|
||||
- if (entity.damageEntity(damagesource, (float) i)) {
|
||||
+ // if (entity.damageEntity(damagesource, (float) i)) { // CraftBukkit - moved up
|
||||
if (entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
@@ -383,6 +399,20 @@
|
||||
@@ -395,6 +409,20 @@
|
||||
|
||||
public void d(EntityHuman entityhuman) {
|
||||
if (!this.world.isClientSide && this.inGround && this.shake <= 0) {
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack = new ItemStack(Items.ARROW);
|
||||
+ if (this.fromPlayer == 1 && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||
+ if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||
+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||
+
|
||||
+ PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), 0);
|
||||
|
@ -77,17 +69,19 @@
|
|||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
boolean flag = this.fromPlayer == 1 || this.fromPlayer == 2 && entityhuman.abilities.canInstantlyBuild;
|
||||
|
||||
if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Items.ARROW, 1))) {
|
||||
@@ -438,4 +468,10 @@
|
||||
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild;
|
||||
|
||||
if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.j())) {
|
||||
@@ -453,6 +481,12 @@
|
||||
return (b0 & 1) != 0;
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean isInGround() {
|
||||
+ return inGround;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+
|
||||
public static enum PickupStatus {
|
||||
|
||||
DISALLOWED, ALLOWED, CREATIVE_ONLY;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
--- a/net/minecraft/server/EntityBoat.java
|
||||
+++ b/net/minecraft/server/EntityBoat.java
|
||||
@@ -2,6 +2,16 @@
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.entity.Vehicle;
|
||||
+import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
|
@ -16,46 +15,32 @@
|
|||
+
|
||||
public class EntityBoat extends Entity {
|
||||
|
||||
private boolean a;
|
||||
@@ -13,6 +23,27 @@
|
||||
private double g;
|
||||
private double h;
|
||||
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityBoat.class, DataWatcherRegistry.b);
|
||||
@@ -31,6 +40,14 @@
|
||||
private EntityBoat.EnumStatus aG;
|
||||
private double aH;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable.
|
||||
+ public double maxSpeed = 0.4D;
|
||||
+ public double occupiedDeceleration = 0.2D;
|
||||
+ public double unoccupiedDeceleration = -1;
|
||||
+ public boolean landBoats = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public void collide(Entity entity) {
|
||||
+ org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
|
||||
+
|
||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), hitEntity);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ super.collide(entity);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public EntityBoat(World world) {
|
||||
super(world);
|
||||
this.a = true;
|
||||
@@ -52,6 +83,8 @@
|
||||
this.f = new float[2];
|
||||
@@ -47,6 +64,7 @@
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
+
|
||||
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
|
||||
}
|
||||
|
||||
public double an() {
|
||||
@@ -65,6 +98,19 @@
|
||||
if (this.passenger != null && this.passenger == damagesource.getEntity() && damagesource instanceof EntityDamageSourceIndirect) {
|
||||
protected boolean playStepSound() {
|
||||
@@ -88,6 +106,19 @@
|
||||
if (damagesource instanceof EntityDamageSourceIndirect && damagesource.getEntity() != null && this.w(damagesource.getEntity())) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
|
@ -71,13 +56,13 @@
|
|||
+ // f = event.getDamage(); // TODO Why don't we do this?
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.b(-this.m());
|
||||
this.a(10);
|
||||
this.setDamage(this.j() + f * 10.0F);
|
||||
@@ -72,6 +118,15 @@
|
||||
this.d(-this.q());
|
||||
this.b(10);
|
||||
this.setDamage(this.n() + f * 10.0F);
|
||||
@@ -95,6 +126,15 @@
|
||||
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
|
||||
|
||||
if (flag || this.j() > 40.0F) {
|
||||
if (flag || this.n() > 40.0F) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
|
@ -87,101 +72,56 @@
|
|||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.passenger != null) {
|
||||
this.passenger.mount(this);
|
||||
if (!flag && this.world.getGameRules().getBoolean("doEntityDrops")) {
|
||||
this.a(this.j(), 1, 0.0F);
|
||||
}
|
||||
@@ -95,6 +150,13 @@
|
||||
}
|
||||
@@ -112,9 +152,25 @@
|
||||
public void collide(Entity entity) {
|
||||
if (entity instanceof EntityBoat) {
|
||||
if (entity.getBoundingBox().b < this.getBoundingBox().e) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.collide(entity);
|
||||
}
|
||||
} else if (entity.getBoundingBox().b <= this.getBoundingBox().b) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.collide(entity);
|
||||
}
|
||||
|
||||
@@ -172,6 +228,10 @@
|
||||
this.setDamage(this.n() - 1.0F);
|
||||
}
|
||||
|
||||
public void t_() {
|
||||
+ // CraftBukkit start
|
||||
+ double prevX = this.locX;
|
||||
+ double prevY = this.locY;
|
||||
+ double prevZ = this.locZ;
|
||||
+ float prevYaw = this.yaw;
|
||||
+ float prevPitch = this.pitch;
|
||||
+ // CraftBukkit end
|
||||
super.t_();
|
||||
if (this.l() > 0) {
|
||||
this.a(this.l() - 1);
|
||||
@@ -196,6 +258,19 @@
|
||||
this.motX += -Math.sin((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.ba * 0.05000000074505806D;
|
||||
this.motZ += Math.cos((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.ba * 0.05000000074505806D;
|
||||
}
|
||||
+ // CraftBukkit start - Support unoccupied deceleration
|
||||
+ else if (unoccupiedDeceleration >= 0) {
|
||||
+ this.motX *= unoccupiedDeceleration;
|
||||
+ this.motZ *= unoccupiedDeceleration;
|
||||
+ // Kill lingering speed
|
||||
+ if (motX <= 0.00001) {
|
||||
+ motX = 0;
|
||||
+ }
|
||||
+ if (motZ <= 0.00001) {
|
||||
+ motZ = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
d4 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d4 > 0.35D) {
|
||||
@@ -230,16 +305,26 @@
|
||||
Block block = this.world.getType(blockposition).getBlock();
|
||||
|
||||
if (block == Blocks.SNOW_LAYER) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, l, j1, j, Blocks.AIR, 0).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.setAir(blockposition);
|
||||
this.positionChanged = false;
|
||||
} else if (block == Blocks.WATERLILY) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, l, j1, j, Blocks.AIR, 0).isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.setAir(blockposition, true);
|
||||
this.positionChanged = false;
|
||||
}
|
||||
}
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
@@ -189,6 +249,22 @@
|
||||
}
|
||||
|
||||
- if (this.onGround) {
|
||||
+ if (this.onGround && !this.landBoats) { // CraftBukkit
|
||||
this.motX *= 0.5D;
|
||||
this.motY *= 0.5D;
|
||||
this.motZ *= 0.5D;
|
||||
@@ -248,6 +333,11 @@
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
if (this.positionChanged && d3 > 0.2975D) {
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
+ // CraftBukkit start
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
|
||||
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
+ if (!destroyEvent.isCancelled()) {
|
||||
this.die();
|
||||
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
|
||||
for (k = 0; k < 3; ++k) {
|
||||
@@ -258,6 +348,7 @@
|
||||
this.a(Items.STICK, 1, 0.0F);
|
||||
}
|
||||
}
|
||||
+ } // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
this.motX *= 0.9900000095367432D;
|
||||
@@ -285,6 +376,22 @@
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d12);
|
||||
this.setYawPitch(this.yaw, this.pitch);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: CHECK ME
|
||||
+ org.bukkit.Server server = this.world.getServer();
|
||||
+ org.bukkit.World bworld = this.world.getWorld();
|
||||
+
|
||||
+ Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
+ Location from = new Location(bworld, this.lastX, this.lastY, this.lastZ, prevYaw, prevPitch);
|
||||
+ Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+
|
||||
|
@ -192,31 +132,23 @@
|
|||
+ server.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.world.isClientSide) {
|
||||
List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
} else {
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
@@ -591,6 +667,11 @@
|
||||
|
||||
@@ -299,6 +406,7 @@
|
||||
}
|
||||
|
||||
if (this.passenger != null && this.passenger.dead) {
|
||||
+ this.passenger.vehicle = null; // CraftBukkit
|
||||
this.passenger = null;
|
||||
}
|
||||
|
||||
@@ -336,6 +444,11 @@
|
||||
if (this.fallDistance > 3.0F) {
|
||||
this.e(this.fallDistance, 1.0F);
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
this.e(this.fallDistance, 1.0F);
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
+ // CraftBukkit start
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
|
||||
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
+ if (!destroyEvent.isCancelled()) {
|
||||
this.die();
|
||||
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
|
||||
int i;
|
||||
@@ -348,6 +461,7 @@
|
||||
this.a(Items.STICK, 1, 0.0F);
|
||||
this.die();
|
||||
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
|
||||
int i;
|
||||
@@ -604,6 +685,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } // CraftBukkit end
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
--- a/net/minecraft/server/EntityChicken.java
|
||||
+++ b/net/minecraft/server/EntityChicken.java
|
||||
@@ -35,6 +35,11 @@
|
||||
@@ -43,6 +43,11 @@
|
||||
}
|
||||
|
||||
public void m() {
|
||||
public void n() {
|
||||
+ // CraftBukkit start
|
||||
+ if (this.isChickenJockey()) {
|
||||
+ this.persistent = !this.isTypeNotPersistent();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.m();
|
||||
this.bq = this.bm;
|
||||
this.bp = this.bo;
|
||||
super.n();
|
||||
this.bz = this.bv;
|
||||
this.bx = this.bw;
|
||||
|
|
|
@ -11,14 +11,10 @@
|
|||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
public EntityCow(World world) {
|
||||
@@ -71,11 +76,21 @@
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
@@ -50,12 +55,22 @@
|
||||
|
||||
public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
|
||||
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||
- if (itemstack.count-- == 1) {
|
||||
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Items.MILK_BUCKET));
|
||||
- } else if (!entityhuman.inventory.pickup(new ItemStack(Items.MILK_BUCKET))) {
|
||||
- entityhuman.drop(new ItemStack(Items.MILK_BUCKET, 1, 0), false);
|
||||
+ // CraftBukkit start - Got milk?
|
||||
+ org.bukkit.Location loc = this.getBukkitEntity().getLocation();
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), null, itemstack, Items.MILK_BUCKET);
|
||||
|
@ -28,8 +24,13 @@
|
|||
+ }
|
||||
+
|
||||
+ ItemStack result = CraftItemStack.asNMSCopy(event.getItemStack());
|
||||
entityhuman.a(SoundEffects.ap, 1.0F, 1.0F);
|
||||
- if (--itemstack.count == 0) {
|
||||
- entityhuman.a(enumhand, new ItemStack(Items.MILK_BUCKET));
|
||||
- } else if (!entityhuman.inventory.pickup(new ItemStack(Items.MILK_BUCKET))) {
|
||||
- entityhuman.drop(new ItemStack(Items.MILK_BUCKET), false);
|
||||
+ if (--itemstack.count <= 0) {
|
||||
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, result);
|
||||
+ entityhuman.a(enumhand, result);
|
||||
+ } else if (!entityhuman.inventory.pickup(result)) {
|
||||
+ entityhuman.drop(result, false);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
+
|
||||
public abstract class EntityCreature extends EntityInsentient {
|
||||
|
||||
public static final UUID bk = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
|
||||
@@ -69,6 +73,7 @@
|
||||
public static final UUID bt = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
|
||||
@@ -71,6 +75,7 @@
|
||||
|
||||
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
|
||||
if (f > 10.0F) {
|
||||
|
@ -19,11 +19,11 @@
|
|||
this.unleash(true, true);
|
||||
}
|
||||
|
||||
@@ -100,6 +105,7 @@
|
||||
@@ -103,6 +108,7 @@
|
||||
}
|
||||
|
||||
if (f > 10.0F) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
}
|
||||
} else if (!this.cc() && this.bm) {
|
||||
} else if (!this.isLeashed() && this.bv) {
|
||||
|
|
|
@ -10,40 +10,42 @@
|
|||
+
|
||||
public class EntityCreeper extends EntityMonster {
|
||||
|
||||
private int a;
|
||||
@@ -7,6 +12,7 @@
|
||||
private static final DataWatcherObject<Integer> a = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.b);
|
||||
@@ -10,6 +15,7 @@
|
||||
private int maxFuseTicks = 30;
|
||||
private int explosionRadius = 3;
|
||||
private int bn = 0;
|
||||
private int bz = 0;
|
||||
+ private int record = -1; // CraftBukkit
|
||||
|
||||
public EntityCreeper(World world) {
|
||||
super(world);
|
||||
@@ -110,19 +116,39 @@
|
||||
@@ -117,21 +123,41 @@
|
||||
}
|
||||
|
||||
public void die(DamageSource damagesource) {
|
||||
- super.die(damagesource);
|
||||
+ // super.die(damagesource); // CraftBukkit - Moved to end
|
||||
if (damagesource.getEntity() instanceof EntitySkeleton) {
|
||||
int i = Item.getId(Items.RECORD_13);
|
||||
int j = Item.getId(Items.RECORD_WAIT);
|
||||
int k = i + this.random.nextInt(j - i + 1);
|
||||
if (this.world.getGameRules().getBoolean("doMobLoot")) {
|
||||
if (damagesource.getEntity() instanceof EntitySkeleton) {
|
||||
int i = Item.getId(Items.RECORD_13);
|
||||
int j = Item.getId(Items.RECORD_WAIT);
|
||||
int k = i + this.random.nextInt(j - i + 1);
|
||||
|
||||
- this.a(Item.getById(k), 1);
|
||||
+ // CraftBukkit start - Store record for now, drop in dropDeathLoot
|
||||
+ // this.a(Item.getById(k), 1);
|
||||
+ this.record = k;
|
||||
+ // CraftBukkit end
|
||||
} else if (damagesource.getEntity() instanceof EntityCreeper && damagesource.getEntity() != this && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).cp()) {
|
||||
((EntityCreeper) damagesource.getEntity()).cq();
|
||||
- this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
||||
+ // CraftBukkit start
|
||||
+ // this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
||||
+ headDrop = new ItemStack(Items.SKULL, 1, 4);
|
||||
+ // CraftBukkit end
|
||||
- this.a(Item.getById(k), 1);
|
||||
+ // CraftBukkit start - Store record for now, drop in dropDeathLoot
|
||||
+ // this.a(Item.getById(k), 1);
|
||||
+ this.record = k;
|
||||
+ // CraftBukkit end
|
||||
} else if (damagesource.getEntity() instanceof EntityCreeper && damagesource.getEntity() != this && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).canCauseHeadDrop()) {
|
||||
((EntityCreeper) damagesource.getEntity()).setCausedHeadDrop();
|
||||
- this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
||||
+ // CraftBukkit start
|
||||
+ // this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
|
||||
+ headDrop = new ItemStack(Items.SKULL, 1, 4);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ super.die(damagesource); // CraftBukkit - Moved from above
|
||||
+ }
|
||||
+
|
||||
|
@ -51,7 +53,7 @@
|
|||
+ @Override
|
||||
+ protected void dropDeathLoot(boolean flag, int i) {
|
||||
+ super.dropDeathLoot(flag, i);
|
||||
|
||||
+
|
||||
+ // Drop a music disc?
|
||||
+ if (this.record != -1) {
|
||||
+ this.a(Item.getById(this.record), 1);
|
||||
|
@ -60,13 +62,12 @@
|
|||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public boolean r(Entity entity) {
|
||||
public boolean B(Entity entity) {
|
||||
return true;
|
||||
@@ -146,7 +172,21 @@
|
||||
@@ -155,8 +181,18 @@
|
||||
|
||||
public void onLightningStrike(EntityLightning entitylightning) {
|
||||
super.onLightningStrike(entitylightning);
|
||||
- this.datawatcher.watch(17, Byte.valueOf((byte) 1));
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
||||
+ return;
|
||||
|
@ -76,24 +77,24 @@
|
|||
+ }
|
||||
+
|
||||
+ public void setPowered(boolean powered) {
|
||||
+ if (!powered) {
|
||||
+ this.datawatcher.watch(17, Byte.valueOf((byte) 0));
|
||||
+ } else {
|
||||
+ this.datawatcher.watch(17, Byte.valueOf((byte) 1));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.datawatcher.set(EntityCreeper.b, Boolean.valueOf(true));
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected boolean a(EntityHuman entityhuman) {
|
||||
@@ -170,8 +210,15 @@
|
||||
protected boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
|
||||
if (itemstack != null && itemstack.getItem() == Items.FLINT_AND_STEEL) {
|
||||
@@ -177,9 +213,17 @@
|
||||
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.aT = true;
|
||||
- this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag);
|
||||
- this.die();
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.aT = true;
|
||||
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
|
||||
+ this.die();
|
||||
+ } else {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
+++ b/net/minecraft/server/EntityDamageSourceIndirect.java
|
||||
@@ -25,4 +25,10 @@
|
||||
|
||||
return itemstack != null && itemstack.hasName() && LocaleI18n.c(s1) ? new ChatMessage(s1, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.C()}) : new ChatMessage(s, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent});
|
||||
return itemstack != null && itemstack.hasName() && LocaleI18n.c(s1) ? new ChatMessage(s1, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.B()}) : new ChatMessage(s, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent});
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
--- a/net/minecraft/server/EntityEnderCrystal.java
|
||||
+++ b/net/minecraft/server/EntityEnderCrystal.java
|
||||
@@ -1,5 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
@ -10,21 +11,21 @@
|
|||
+
|
||||
public class EntityEnderCrystal extends Entity {
|
||||
|
||||
public int a;
|
||||
@@ -32,7 +37,11 @@
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
private static final DataWatcherObject<Optional<BlockPosition>> b = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.k);
|
||||
@@ -38,7 +43,11 @@
|
||||
BlockPosition blockposition = new BlockPosition(this);
|
||||
|
||||
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(new BlockPosition(i, j, k)).getBlock() != Blocks.FIRE) {
|
||||
- this.world.setTypeUpdate(new BlockPosition(i, j, k), Blocks.FIRE.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
|
||||
+ this.world.setTypeUpdate(new BlockPosition(i, j, k), Blocks.FIRE.getBlockData());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(blockposition).getBlock() != Blocks.FIRE) {
|
||||
- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callBlockIgniteEvent(this.world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) {
|
||||
+ this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,11 +59,24 @@
|
||||
@@ -74,9 +83,22 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.dead && !this.world.isClientSide) {
|
||||
|
@ -33,20 +34,18 @@
|
|||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.b = 0;
|
||||
if (this.b <= 0) {
|
||||
this.die();
|
||||
if (!this.world.isClientSide) {
|
||||
- this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, true);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.dead = false;
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
this.die();
|
||||
if (!this.world.isClientSide) {
|
||||
- this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, true);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, true);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.dead = false;
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.world.explode(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
+ // CraftBukkit end
|
||||
this.a(damagesource);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,277 +1,10 @@
|
|||
--- a/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -5,6 +5,17 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -5,6 +5,7 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
||||
+import org.bukkit.event.entity.EntityCreatePortalEvent;
|
||||
+import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
+import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+import org.bukkit.Bukkit;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
+// PAIL: Fixme
|
||||
public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster {
|
||||
|
||||
public double a;
|
||||
@@ -27,6 +38,7 @@
|
||||
public Entity target;
|
||||
public int by;
|
||||
public EntityEnderCrystal bz;
|
||||
+ private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, true); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
||||
|
||||
public EntityEnderDragon(World world) {
|
||||
super(world);
|
||||
@@ -294,12 +306,21 @@
|
||||
if (this.bz != null) {
|
||||
if (this.bz.dead) {
|
||||
if (!this.world.isClientSide) {
|
||||
+ CraftEventFactory.entityDamage = this.bz; // CraftBukkit
|
||||
this.a(this.bn, DamageSource.explosion((Explosion) null), 10.0F);
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
this.bz = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
||||
- this.setHealth(this.getHealth() + 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0D, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.setHealth((float) (this.getHealth() + event.getAmount()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,7 +389,19 @@
|
||||
}
|
||||
|
||||
if (this.random.nextInt(2) == 0 && !arraylist.isEmpty()) {
|
||||
- this.target = (Entity) arraylist.get(this.random.nextInt(arraylist.size()));
|
||||
+ // CraftBukkit start
|
||||
+ Entity target = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ if (event.getTarget() == null) {
|
||||
+ this.target = null;
|
||||
+ } else {
|
||||
+ this.target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
boolean flag;
|
||||
|
||||
@@ -404,6 +437,11 @@
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
|
||||
+ // CraftBukkit start - Create a list to hold all the destroyed blocks
|
||||
+ List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
|
||||
+ org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
for (int i2 = k; i2 <= j1; ++i2) {
|
||||
@@ -412,7 +450,11 @@
|
||||
|
||||
if (block.getMaterial() != Material.AIR) {
|
||||
if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.COMMAND_BLOCK && this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
- flag1 = this.world.setAir(blockposition) || flag1;
|
||||
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
||||
+ // flag1 = this.world.setAir(new BlockPosition(blockposition)) || flag1;
|
||||
+ flag1 = true;
|
||||
+ destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
@@ -422,6 +464,40 @@
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
+ // CraftBukkit start - Set off an EntityExplodeEvent for the dragon exploding all these blocks
|
||||
+ org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity();
|
||||
+ EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F);
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ // This flag literally means 'Dragon hit something hard' (Obsidian, White Stone or Bedrock) and will cause the dragon to slow down.
|
||||
+ // We should consider adding an event extension for it, or perhaps returning true if the event is cancelled.
|
||||
+ return flag;
|
||||
+ } else if (event.getYield() == 0F) {
|
||||
+ // Yield zero ==> no drops
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
+ this.world.setAir(new BlockPosition(block.getX(), block.getY(), block.getZ()));
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
+ org.bukkit.Material blockId = block.getType();
|
||||
+ if (blockId == org.bukkit.Material.AIR) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ int blockX = block.getX();
|
||||
+ int blockY = block.getY();
|
||||
+ int blockZ = block.getZ();
|
||||
+
|
||||
+ Block nmsBlock = org.bukkit.craftbukkit.util.CraftMagicNumbers.getBlock(blockId);
|
||||
+ if (nmsBlock.a(explosionSource)) {
|
||||
+ nmsBlock.dropNaturally(this.world, new BlockPosition(blockX, blockY, blockZ), nmsBlock.fromLegacyData(block.getData()), event.getYield(), 0);
|
||||
+ }
|
||||
+ nmsBlock.wasExploded(world, new BlockPosition(blockX, blockY, blockZ), explosionSource);
|
||||
+
|
||||
+ this.world.setAir(new BlockPosition(blockX, blockY, blockZ));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
double d0 = axisalignedbb.a + (axisalignedbb.d - axisalignedbb.a) * (double) this.random.nextFloat();
|
||||
double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat();
|
||||
double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat();
|
||||
@@ -469,6 +545,7 @@
|
||||
}
|
||||
|
||||
protected void aZ() {
|
||||
+ if (this.dead) return; // CraftBukkit - can't kill what's already dead
|
||||
++this.by;
|
||||
if (this.by >= 180 && this.by <= 200) {
|
||||
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
@@ -484,7 +561,7 @@
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
if (this.by > 150 && this.by % 5 == 0 && flag) {
|
||||
- i = 1000;
|
||||
+ i = this.expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
@@ -494,7 +571,23 @@
|
||||
}
|
||||
|
||||
if (this.by == 1) {
|
||||
- this.world.a(1018, new BlockPosition(this), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.world.a(1018, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ double deltaX = this.locX - player.locX;
|
||||
+ double deltaZ = this.locZ - player.locZ;
|
||||
+ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
+ if (distanceSquared > viewDistance * viewDistance) {
|
||||
+ double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
|
||||
+ double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance;
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1018, new BlockPosition((int) relativeX, (int) this.locY, (int) relativeZ), 0, true));
|
||||
+ } else {
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1018, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0, true));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,7 +595,7 @@
|
||||
this.aI = this.yaw += 20.0F;
|
||||
if (this.by == 200 && !this.world.isClientSide) {
|
||||
if (flag) {
|
||||
- i = 2000;
|
||||
+ i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
@@ -522,6 +615,9 @@
|
||||
double d0 = 12.25D;
|
||||
double d1 = 6.25D;
|
||||
|
||||
+ // CraftBukkit start - Replace any "this.world" in the following with just "world"!
|
||||
+ BlockStateListPopulator world = new BlockStateListPopulator(this.world.getWorld());
|
||||
+
|
||||
for (int i = -1; i <= 32; ++i) {
|
||||
for (int j = -4; j <= 4; ++j) {
|
||||
for (int k = -4; k <= 4; ++k) {
|
||||
@@ -532,31 +628,51 @@
|
||||
|
||||
if (i < 0) {
|
||||
if (d2 <= 6.25D) {
|
||||
- this.world.setTypeUpdate(blockposition1, Blocks.BEDROCK.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition1, Blocks.BEDROCK.getBlockData());
|
||||
}
|
||||
} else if (i > 0) {
|
||||
- this.world.setTypeUpdate(blockposition1, Blocks.AIR.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition1, Blocks.AIR.getBlockData());
|
||||
} else if (d2 > 6.25D) {
|
||||
- this.world.setTypeUpdate(blockposition1, Blocks.BEDROCK.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition1, Blocks.BEDROCK.getBlockData());
|
||||
} else {
|
||||
- this.world.setTypeUpdate(blockposition1, Blocks.END_PORTAL.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition1, Blocks.END_PORTAL.getBlockData());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- this.world.setTypeUpdate(blockposition, Blocks.BEDROCK.getBlockData());
|
||||
- this.world.setTypeUpdate(blockposition.up(), Blocks.BEDROCK.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition, Blocks.BEDROCK.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition.up(), Blocks.BEDROCK.getBlockData());
|
||||
BlockPosition blockposition2 = blockposition.up(2);
|
||||
|
||||
- this.world.setTypeUpdate(blockposition2, Blocks.BEDROCK.getBlockData());
|
||||
- this.world.setTypeUpdate(blockposition2.west(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.EAST));
|
||||
- this.world.setTypeUpdate(blockposition2.east(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.WEST));
|
||||
- this.world.setTypeUpdate(blockposition2.north(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH));
|
||||
- this.world.setTypeUpdate(blockposition2.south(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH));
|
||||
- this.world.setTypeUpdate(blockposition.up(3), Blocks.BEDROCK.getBlockData());
|
||||
- this.world.setTypeUpdate(blockposition.up(4), Blocks.DRAGON_EGG.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition2, Blocks.BEDROCK.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition2.west(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.EAST));
|
||||
+ world.setTypeUpdate(blockposition2.east(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.WEST));
|
||||
+ world.setTypeUpdate(blockposition2.north(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.SOUTH));
|
||||
+ world.setTypeUpdate(blockposition2.south(), Blocks.TORCH.getBlockData().set(BlockTorch.FACING, EnumDirection.NORTH));
|
||||
+ world.setTypeUpdate(blockposition.up(3), Blocks.BEDROCK.getBlockData());
|
||||
+ world.setTypeUpdate(blockposition.up(4), Blocks.DRAGON_EGG.getBlockData());
|
||||
+
|
||||
+ EntityCreatePortalEvent event = new EntityCreatePortalEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), java.util.Collections.unmodifiableList(world.getList()), org.bukkit.PortalType.ENDER);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ for (BlockState state : event.getBlocks()) {
|
||||
+ state.update(true);
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (BlockState state : event.getBlocks()) {
|
||||
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(this.world, new BlockPosition(state.getX(), state.getY(), state.getZ()));
|
||||
+ for (Iterator it = this.world.players.iterator(); it.hasNext();) {
|
||||
+ EntityHuman entity = (EntityHuman) it.next();
|
||||
+ if (entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entity).playerConnection.sendPacket(packet);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void D() {}
|
||||
@@ -584,4 +700,12 @@
|
||||
protected float bB() {
|
||||
return 5.0F;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public int getExpReward() {
|
||||
+ // This value is equal to the amount of experience dropped while falling from the sky (10 * 1000)
|
||||
+ // plus what is dropped when the dragon hits the ground (2000)
|
||||
+ return 12000;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
private static final Logger bH = LogManager.getLogger();
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
+
|
||||
public class EntityEnderPearl extends EntityProjectile {
|
||||
|
||||
private EntityLiving c;
|
||||
@@ -33,21 +39,35 @@
|
||||
private EntityLiving d;
|
||||
@@ -51,13 +57,35 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entityliving;
|
||||
|
||||
if (entityplayer.playerConnection.a().g() && entityplayer.world == this.world && !entityplayer.isSleeping()) {
|
||||
if (entityplayer.playerConnection.a().isConnected() && entityplayer.world == this.world && !entityplayer.isSleeping()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
|
||||
- EntityEndermite entityendermite = new EntityEndermite(this.world);
|
||||
-
|
||||
|
@ -40,8 +40,8 @@
|
|||
+ this.world.addEntity(entityendermite);
|
||||
+ }
|
||||
+
|
||||
+ if (entityliving.au()) {
|
||||
+ entityliving.mount((Entity) null);
|
||||
+ if (entityliving.isPassenger()) {
|
||||
+ entityliving.stopRiding();
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.playerConnection.teleport(teleEvent.getTo());
|
||||
|
@ -50,15 +50,7 @@
|
|||
+ entityliving.damageEntity(DamageSource.FALL, 5.0F);
|
||||
+ CraftEventFactory.entityDamage = null;
|
||||
}
|
||||
-
|
||||
- if (entityliving.au()) {
|
||||
- entityliving.mount((Entity) null);
|
||||
- }
|
||||
-
|
||||
- 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);
|
||||
|
||||
if (entityliving.isPassenger()) {
|
||||
this.stopRiding();
|
||||
|
|
|
@ -1,60 +1,28 @@
|
|||
--- a/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/net/minecraft/server/EntityEnderman.java
|
||||
@@ -8,6 +8,12 @@
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@@ -306,8 +306,12 @@
|
||||
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEnderman extends EntityMonster {
|
||||
|
||||
private static final UUID a = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
|
||||
@@ -177,7 +183,17 @@
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
- super.enderTeleportTo(this.locX, this.locY, this.locZ);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ // super.enderTeleportTo(this.locX, this.locY, this.locZ);
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ));
|
||||
+ this.world.getServer().getPluginManager().callEvent(teleport);
|
||||
+ if (teleport.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ Location to = teleport.getTo();
|
||||
+ this.enderTeleportTo(to.getX(), to.getY(), to.getZ());
|
||||
+ // CraftBukkit end
|
||||
if (this.world.getCubes(this, this.getBoundingBox()).isEmpty() && !this.world.containsLiquid(this.getBoundingBox())) {
|
||||
flag = true;
|
||||
}
|
||||
@@ -333,8 +349,12 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (EntityEnderman.c.contains(block)) {
|
||||
if (EntityEnderman.c.contains(block) && flag) {
|
||||
- this.enderman.setCarried(iblockdata);
|
||||
- world.setTypeUpdate(blockposition, Blocks.AIR.getBlockData());
|
||||
- world.setAir(blockposition);
|
||||
+ // CraftBukkit start - Pickup event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, this.enderman.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), org.bukkit.Material.AIR).isCancelled()) {
|
||||
+ this.enderman.setCarried(iblockdata);
|
||||
+ world.setTypeUpdate(blockposition, Blocks.AIR.getBlockData());
|
||||
+ world.setAir(blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -363,8 +383,12 @@
|
||||
Block block1 = world.getType(blockposition.down()).getBlock();
|
||||
@@ -337,8 +341,12 @@
|
||||
IBlockData iblockdata2 = this.a.getCarried();
|
||||
|
||||
if (this.a(world, blockposition, this.a.getCarried().getBlock(), block, block1)) {
|
||||
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
|
||||
+ // CraftBukkit start - Place event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a.getCarried().getBlock(), this.a.getCarried().getBlock().toLegacyData(this.a.getCarried())).isCancelled()) {
|
||||
world.setTypeAndData(blockposition, this.a.getCarried(), 3);
|
||||
this.a.setCarried(Blocks.AIR.getBlockData());
|
||||
world.setTypeAndData(blockposition, iblockdata2, 3);
|
||||
this.a.setCarried((IBlockData) null);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
public int a;
|
||||
@@ -34,6 +40,7 @@
|
||||
|
||||
public void t_() {
|
||||
super.t_();
|
||||
public void m() {
|
||||
super.m();
|
||||
+ EntityHuman prevTarget = this.targetPlayer;// CraftBukkit - store old target
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
|
@ -35,7 +35,7 @@
|
|||
+
|
||||
+ if (!cancelled && targetPlayer != null) {
|
||||
double d1 = (this.targetPlayer.locX - this.locX) / d0;
|
||||
double d2 = (this.targetPlayer.locY + (double) this.targetPlayer.getHeadHeight() - this.locY) / d0;
|
||||
double d2 = (this.targetPlayer.locY + (double) this.targetPlayer.getHeadHeight() / 2.0D - this.locY) / d0;
|
||||
double d3 = (this.targetPlayer.locZ - this.locZ) / d0;
|
||||
@@ -77,6 +94,8 @@
|
||||
this.motY += d2 / d4 * d5 * 0.1D;
|
||||
|
@ -46,16 +46,16 @@
|
|||
}
|
||||
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
@@ -141,7 +160,7 @@
|
||||
entityhuman.bp = 2;
|
||||
this.world.makeSound(entityhuman, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
|
||||
entityhuman.receive(this, 1);
|
||||
- entityhuman.giveExp(this.value);
|
||||
+ entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
||||
this.die();
|
||||
}
|
||||
@@ -151,7 +170,7 @@
|
||||
}
|
||||
|
||||
@@ -153,6 +172,24 @@
|
||||
if (this.value > 0) {
|
||||
- entityhuman.giveExp(this.value);
|
||||
+ entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
||||
}
|
||||
|
||||
this.die();
|
||||
@@ -173,6 +192,24 @@
|
||||
}
|
||||
|
||||
public static int getOrbValue(int i) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -4,13 +4,15 @@
|
||||
@@ -4,6 +4,8 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
@ -9,15 +9,7 @@
|
|||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
private IBlockData block;
|
||||
public int ticksLived;
|
||||
public boolean dropItem = true;
|
||||
private boolean e;
|
||||
- private boolean hurtEntities;
|
||||
+ public boolean hurtEntities; // PAIL: private -> public
|
||||
private int fallHurtMax = 40;
|
||||
private float fallHurtAmount = 2.0F;
|
||||
public NBTTagCompound tileEntityData;
|
||||
@@ -56,7 +58,7 @@
|
||||
@@ -64,7 +66,7 @@
|
||||
|
||||
if (this.ticksLived++ == 0) {
|
||||
blockposition = new BlockPosition(this);
|
||||
|
@ -26,12 +18,11 @@
|
|||
this.world.setAir(blockposition);
|
||||
} else if (!this.world.isClientSide) {
|
||||
this.die();
|
||||
@@ -78,7 +80,12 @@
|
||||
if (this.world.getType(blockposition).getBlock() != Blocks.PISTON_EXTENSION) {
|
||||
@@ -94,6 +96,12 @@
|
||||
this.die();
|
||||
if (!this.e) {
|
||||
- if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, blockposition.down()) && this.world.setTypeAndData(blockposition, this.block, 3)) {
|
||||
+ if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, blockposition.down()) /* mimic the false conditions of setTypeIdAndData */ && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000 && blockposition.getY() >= 0 && blockposition.getY() < 256 && this.world.getType(blockposition) != this.block) {
|
||||
if (!this.f) {
|
||||
if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.i(this.world.getType(blockposition.down())) && this.world.setTypeAndData(blockposition, this.block, 3)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
|
@ -40,7 +31,7 @@
|
|||
if (block instanceof BlockFalling) {
|
||||
((BlockFalling) block).a_(this.world, blockposition);
|
||||
}
|
||||
@@ -137,7 +144,9 @@
|
||||
@@ -152,7 +160,9 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
--- a/net/minecraft/server/EntityFireball.java
|
||||
+++ b/net/minecraft/server/EntityFireball.java
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public abstract class EntityFireball extends Entity {
|
||||
|
||||
private int e = -1;
|
||||
@@ -15,6 +17,8 @@
|
||||
@@ -13,6 +15,8 @@
|
||||
public double dirX;
|
||||
public double dirY;
|
||||
public double dirZ;
|
||||
|
@ -18,7 +17,7 @@
|
|||
|
||||
public EntityFireball(World world) {
|
||||
super(world);
|
||||
@@ -38,10 +42,17 @@
|
||||
@@ -36,10 +40,17 @@
|
||||
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
|
@ -36,7 +35,7 @@
|
|||
d0 += this.random.nextGaussian() * 0.4D;
|
||||
d1 += this.random.nextGaussian() * 0.4D;
|
||||
d2 += this.random.nextGaussian() * 0.4D;
|
||||
@@ -117,6 +128,12 @@
|
||||
@@ -83,6 +94,12 @@
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
this.a(movingobjectposition);
|
||||
|
@ -49,50 +48,19 @@
|
|||
}
|
||||
|
||||
this.locX += this.motX;
|
||||
@@ -181,6 +198,8 @@
|
||||
|
||||
nbttagcompound.setString("inTile", minecraftkey == null ? "" : minecraftkey.toString());
|
||||
nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
|
||||
+ // CraftBukkit - Fix direction being mismapped to invalid variables
|
||||
+ nbttagcompound.set("power", this.a(new double[] { this.dirX, this.dirY, this.dirZ}));
|
||||
nbttagcompound.set("direction", this.a(new double[] { this.motX, this.motY, this.motZ}));
|
||||
}
|
||||
|
||||
@@ -195,12 +214,20 @@
|
||||
}
|
||||
|
||||
this.i = nbttagcompound.getByte("inGround") == 1;
|
||||
- if (nbttagcompound.hasKeyOfType("direction", 9)) {
|
||||
+ // CraftBukkit start - direction -> power
|
||||
+ if (nbttagcompound.hasKeyOfType("power", 9)) {
|
||||
+ NBTTagList nbttaglist = nbttagcompound.getList("power", 6);
|
||||
+
|
||||
+ this.dirX = nbttaglist.d(0);
|
||||
+ this.dirY = nbttaglist.d(1);
|
||||
+ this.dirZ = nbttaglist.d(2);
|
||||
+ } else if (nbttagcompound.hasKeyOfType("direction", 9)) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getList("direction", 6);
|
||||
|
||||
this.motX = nbttaglist.d(0);
|
||||
this.motY = nbttaglist.d(1);
|
||||
this.motZ = nbttaglist.d(2);
|
||||
+ // CraftBukkit end
|
||||
@@ -187,6 +204,11 @@
|
||||
} else {
|
||||
this.die();
|
||||
}
|
||||
@@ -221,6 +248,11 @@
|
||||
} else {
|
||||
this.ac();
|
||||
this.ao();
|
||||
if (damagesource.getEntity() != null) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Vec3D vec3d = damagesource.getEntity().ap();
|
||||
Vec3D vec3d = damagesource.getEntity().aB();
|
||||
|
||||
if (vec3d != null) {
|
||||
@@ -234,6 +266,7 @@
|
||||
@@ -200,6 +222,7 @@
|
||||
|
||||
if (damagesource.getEntity() instanceof EntityLiving) {
|
||||
this.shooter = (EntityLiving) damagesource.getEntity();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/server/EntityFireworks.java
|
||||
+++ b/net/minecraft/server/EntityFireworks.java
|
||||
@@ -78,7 +78,7 @@
|
||||
@@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
|
||||
- this.world.broadcastEntityEffect(this, (byte) 17);
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) this.world.broadcastEntityEffect(this, (byte) 17);
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this).isCancelled()) this.world.broadcastEntityEffect(this, (byte) 17); // CraftBukkit
|
||||
this.die();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -3,6 +3,12 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -12,19 +12,44 @@
|
|||
+
|
||||
public class EntityFishingHook extends Entity {
|
||||
|
||||
private static final List<PossibleFishingResult> d = Arrays.asList(new PossibleFishingResult[] { (new PossibleFishingResult(new ItemStack(Items.LEATHER_BOOTS), 10)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.LEATHER), 10), new PossibleFishingResult(new ItemStack(Items.BONE), 10), new PossibleFishingResult(new ItemStack(Items.POTION), 10), new PossibleFishingResult(new ItemStack(Items.STRING), 5), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 2)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.BOWL), 10), new PossibleFishingResult(new ItemStack(Items.STICK), 5), new PossibleFishingResult(new ItemStack(Items.DYE, 10, EnumColor.BLACK.getInvColorIndex()), 1), new PossibleFishingResult(new ItemStack(Blocks.TRIPWIRE_HOOK), 10), new PossibleFishingResult(new ItemStack(Items.ROTTEN_FLESH), 10)});
|
||||
@@ -182,6 +188,7 @@
|
||||
}
|
||||
private static final DataWatcherObject<Integer> c = DataWatcher.a(EntityFishingHook.class, DataWatcherRegistry.b);
|
||||
@@ -193,6 +199,7 @@
|
||||
}
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
|
||||
if (movingobjectposition.entity != null) {
|
||||
if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0.0F)) {
|
||||
if (movingobjectposition != null) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
|
||||
if (movingobjectposition.entity != null) {
|
||||
this.hooked = movingobjectposition.entity;
|
||||
@@ -381,6 +388,15 @@
|
||||
byte b0 = 0;
|
||||
|
||||
if (this.hooked != null) {
|
||||
this.getDataWatcher().set(EntityFishingHook.c, Integer.valueOf(this.hooked.getId() + 1));
|
||||
@@ -266,6 +273,10 @@
|
||||
if (this.au <= 0) {
|
||||
this.av = 0;
|
||||
this.aw = 0;
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
double d10;
|
||||
@@ -278,6 +289,13 @@
|
||||
if (this.aw > 0) {
|
||||
this.aw -= l;
|
||||
if (this.aw <= 0) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.BITE);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.motY -= 0.20000000298023224D;
|
||||
this.a(SoundEffects.G, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
f2 = (float) MathHelper.floor(this.getBoundingBox().b);
|
||||
@@ -391,6 +409,14 @@
|
||||
this.k();
|
||||
this.world.broadcastEntityEffect(this, (byte) 31);
|
||||
i = this.hooked instanceof EntityItem ? 3 : 5;
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
@ -33,39 +58,41 @@
|
|||
+ 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;
|
||||
@@ -393,6 +409,15 @@
|
||||
b0 = 3;
|
||||
} else if (this.av > 0) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, this.m());
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||
+ playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
} else if (this.au > 0) {
|
||||
LootTableInfo.a loottableinfo_a = new LootTableInfo.a((WorldServer) this.world);
|
||||
|
||||
@@ -400,6 +426,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||
+ playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
double d5 = this.owner.locX - this.locX;
|
||||
double d6 = this.owner.locY - this.locY;
|
||||
double d7 = this.owner.locZ - this.locZ;
|
||||
@@ -403,14 +428,35 @@
|
||||
entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
|
||||
entityitem.motZ = d7 * d9;
|
||||
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));
|
||||
+ // 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()));
|
||||
+ } // CraftBukkit end
|
||||
b0 = 1;
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ 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;
|
||||
@@ -410,13 +445,25 @@
|
||||
entityitem.motY = d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
|
||||
entityitem.motZ = d2 * d4;
|
||||
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));
|
||||
+ // 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()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
i = 1;
|
||||
}
|
||||
|
||||
if (this.as) {
|
||||
if (this.isInGround) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
@ -74,19 +101,6 @@
|
|||
+ return 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
b0 = 2;
|
||||
i = 2;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (b0 == 0) {
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+ if (playerFishEvent.isCancelled()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
return b0;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
--- a/net/minecraft/server/EntityGhast.java
|
||||
+++ b/net/minecraft/server/EntityGhast.java
|
||||
@@ -162,7 +162,9 @@
|
||||
world.a((EntityHuman) null, 1008, new BlockPosition(this.b), 0);
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.b, d2, d3, d4);
|
||||
@@ -153,7 +153,8 @@
|
||||
world.a((EntityHuman) null, 1016, new BlockPosition(this.ghast), 0);
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4);
|
||||
|
||||
- entitylargefireball.yield = this.b.cf();
|
||||
+
|
||||
- entitylargefireball.yield = this.ghast.getPower();
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.yield = this.b.cf();
|
||||
entitylargefireball.locX = this.b.locX + vec3d.a * d1;
|
||||
entitylargefireball.locY = this.b.locY + (double) (this.b.length / 2.0F) + 0.5D;
|
||||
entitylargefireball.locZ = this.b.locZ + vec3d.c * d1;
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.yield = this.ghast.getPower();
|
||||
entitylargefireball.locX = this.ghast.locX + vec3d.x * d1;
|
||||
entitylargefireball.locY = this.ghast.locY + (double) (this.ghast.length / 2.0F) + 0.5D;
|
||||
entitylargefireball.locZ = this.ghast.locZ + vec3d.z * d1;
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
--- a/net/minecraft/server/EntityHanging.java
|
||||
+++ b/net/minecraft/server/EntityHanging.java
|
||||
@@ -4,6 +4,13 @@
|
||||
import java.util.List;
|
||||
@@ -3,6 +3,11 @@
|
||||
import com.google.common.base.Predicate;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.entity.Painting;
|
||||
+import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
+import org.bukkit.event.painting.PaintingBreakEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityHanging extends Entity {
|
||||
|
||||
private int c;
|
||||
@@ -30,30 +37,34 @@
|
||||
private static final Predicate<Entity> c = new Predicate() {
|
||||
@@ -38,30 +43,39 @@
|
||||
this.updateBoundingBox();
|
||||
}
|
||||
|
||||
- private void updateBoundingBox() {
|
||||
- protected void updateBoundingBox() {
|
||||
- if (this.direction != null) {
|
||||
- double d0 = (double) this.blockPosition.getX() + 0.5D;
|
||||
- double d1 = (double) this.blockPosition.getY() + 0.5D;
|
||||
|
@ -31,15 +29,15 @@
|
|||
+ Placing here as it's more likely to be noticed as something which needs to be updated
|
||||
+ then something in a CraftBukkit file.
|
||||
+ */
|
||||
+ public static AxisAlignedBB calculateBoundingBox(BlockPosition blockPosition, EnumDirection direction, int width, int height) {
|
||||
+ public static AxisAlignedBB calculateBoundingBox(Entity entity, BlockPosition blockPosition, EnumDirection direction, int width, int height) {
|
||||
+ double d0 = (double) blockPosition.getX() + 0.5D;
|
||||
+ double d1 = (double) blockPosition.getY() + 0.5D;
|
||||
+ double d2 = (double) blockPosition.getZ() + 0.5D;
|
||||
double d3 = 0.46875D;
|
||||
- double d4 = this.a(this.l());
|
||||
- double d5 = this.a(this.m());
|
||||
+ double d4 = width % 32 == 0 ? 0.5D : 0.0D;
|
||||
+ double d5 = height % 32 == 0 ? 0.5D : 0.0D;
|
||||
- double d4 = this.a(this.getWidth());
|
||||
- double d5 = this.a(this.getHeight());
|
||||
+ double d4 = a(width);
|
||||
+ double d5 = a(height);
|
||||
|
||||
- d0 -= (double) this.direction.getAdjacentX() * 0.46875D;
|
||||
- d2 -= (double) this.direction.getAdjacentZ() * 0.46875D;
|
||||
|
@ -54,9 +52,14 @@
|
|||
- this.locX = d0;
|
||||
- this.locY = d1;
|
||||
- this.locZ = d2;
|
||||
- double d6 = (double) this.l();
|
||||
- double d7 = (double) this.m();
|
||||
- double d8 = (double) this.l();
|
||||
- double d6 = (double) this.getWidth();
|
||||
- double d7 = (double) this.getHeight();
|
||||
- double d8 = (double) this.getWidth();
|
||||
+ if (entity != null) {
|
||||
+ entity.locX = d0;
|
||||
+ entity.locY = d1;
|
||||
+ entity.locZ = d2;
|
||||
+ }
|
||||
+ double d6 = (double) width;
|
||||
+ double d7 = (double) height;
|
||||
+ double d8 = (double) width;
|
||||
|
@ -66,7 +69,7 @@
|
|||
d8 = 1.0D;
|
||||
} else {
|
||||
d6 = 1.0D;
|
||||
@@ -62,7 +73,18 @@
|
||||
@@ -70,11 +84,18 @@
|
||||
d6 /= 32.0D;
|
||||
d7 /= 32.0D;
|
||||
d8 /= 32.0D;
|
||||
|
@ -74,24 +77,25 @@
|
|||
+ return new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8);
|
||||
+ }
|
||||
+
|
||||
+ private void updateBoundingBox() {
|
||||
+ protected void updateBoundingBox() {
|
||||
+ if (this.direction != null) {
|
||||
+ // CraftBukkit start code moved in to calculateBoundingBox
|
||||
+ AxisAlignedBB bb = calculateBoundingBox(this.blockPosition, this.direction, this.l(), this.m());
|
||||
+ this.locX = (bb.a + bb.d) / 2.0D;
|
||||
+ this.locY = (bb.b + bb.e) / 2.0D;
|
||||
+ this.locZ = (bb.c + bb.f) / 2.0D;
|
||||
+ this.a(bb);
|
||||
+ this.a(calculateBoundingBox(this, this.blockPosition, this.direction, this.getWidth(), this.getHeight()));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +99,32 @@
|
||||
if (this.c++ == 100 && !this.world.isClientSide) {
|
||||
this.c = 0;
|
||||
- private double a(int i) {
|
||||
+ private static double a(int i) {
|
||||
return i % 32 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
||||
@@ -85,6 +106,24 @@
|
||||
if (this.d++ == 100 && !this.world.isClientSide) {
|
||||
this.d = 0;
|
||||
if (!this.dead && !this.survives()) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ Material material = this.world.getType(new BlockPosition(this)).getBlock().getMaterial();
|
||||
+ Material material = this.world.getType(new BlockPosition(this)).getMaterial();
|
||||
+ HangingBreakEvent.RemoveCause cause;
|
||||
+
|
||||
+ if (!material.equals(Material.AIR)) {
|
||||
|
@ -104,55 +108,36 @@
|
|||
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), cause);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ PaintingBreakEvent paintingEvent = null;
|
||||
+ if (this instanceof EntityPainting) {
|
||||
+ // Fire old painting event until it can be removed
|
||||
+ paintingEvent = new PaintingBreakEvent((Painting) this.getBukkitEntity(), PaintingBreakEvent.RemoveCause.valueOf(cause.name()));
|
||||
+ paintingEvent.setCancelled(event.isCancelled());
|
||||
+ this.world.getServer().getPluginManager().callEvent(paintingEvent);
|
||||
+ }
|
||||
+
|
||||
+ if (dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
|
||||
+ if (dead || event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
this.b((Entity) null);
|
||||
this.a((Entity) null);
|
||||
}
|
||||
@@ -138,6 +186,32 @@
|
||||
@@ -135,6 +174,21 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.dead && !this.world.isClientSide) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
|
||||
+ PaintingBreakEvent paintingEvent = null;
|
||||
+ if (damagesource.getEntity() != null) {
|
||||
+ event = new org.bukkit.event.hanging.HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
||||
+
|
||||
+ if (this instanceof EntityPainting) {
|
||||
+ // Fire old painting event until it can be removed
|
||||
+ paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
||||
+ }
|
||||
+ } else if (damagesource.isExplosion()) {
|
||||
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
|
||||
+ }
|
||||
+
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (paintingEvent != null) {
|
||||
+ paintingEvent.setCancelled(event.isCancelled());
|
||||
+ this.world.getServer().getPluginManager().callEvent(paintingEvent);
|
||||
+ }
|
||||
+
|
||||
+ if (this.dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
|
||||
+ if (this.dead || event.isCancelled()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.die();
|
||||
this.ac();
|
||||
this.b(damagesource.getEntity());
|
||||
@@ -149,6 +223,18 @@
|
||||
this.ao();
|
||||
this.a(damagesource.getEntity());
|
||||
@@ -146,6 +200,18 @@
|
||||
|
||||
public void move(double d0, double d1, double d2) {
|
||||
if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
|
@ -169,14 +154,14 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
this.die();
|
||||
this.b((Entity) null);
|
||||
this.a((Entity) null);
|
||||
}
|
||||
@@ -156,7 +242,7 @@
|
||||
@@ -153,7 +219,7 @@
|
||||
}
|
||||
|
||||
public void g(double d0, double d1, double d2) {
|
||||
- if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
+ if (false && !this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed
|
||||
this.die();
|
||||
this.b((Entity) null);
|
||||
this.a((Entity) null);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue