mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-11 18:22:08 -07:00
Update to Minecraft 1.9
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user