2015-12-07 00:14:41 +01:00
|
|
|
From c5e8524e67e8def786c77dc219c459d0ef932b4a Mon Sep 17 00:00:00 2001
|
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
Date: Sun, 6 Dec 2015 17:12:38 -0600
|
2015-04-17 11:51:46 +02:00
|
|
|
Subject: [PATCH] Add FallingBlock source location API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
|
|
|
|
index de7ac6f..76a6272 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
|
|
|
|
@@ -28,7 +28,10 @@ public class BlockDragonEgg extends Block {
|
|
|
|
byte b0 = 32;
|
|
|
|
|
|
|
|
if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
|
|
|
|
- world.addEntity(new EntityFallingBlock(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData()));
|
|
|
|
+ // PaperSpigot start - Add FallingBlock source location API
|
|
|
|
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F));
|
|
|
|
+ world.addEntity(new EntityFallingBlock(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData()));
|
|
|
|
+ // PaperSpigot end
|
|
|
|
} else {
|
|
|
|
world.setAir(blockposition);
|
|
|
|
|
2015-04-18 22:14:31 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
|
|
|
|
index 29f8554..1d952b8 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/BlockFalling.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
|
|
|
|
@@ -36,7 +36,10 @@ public class BlockFalling extends Block {
|
|
|
|
|
|
|
|
if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
|
|
|
|
if (!world.isClientSide) {
|
|
|
|
- EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
|
|
|
|
+ // PaperSpigot start - Add FallingBlock source location API
|
|
|
|
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F));
|
|
|
|
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(loc, world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
|
|
|
|
+ // PaperSpigot end
|
|
|
|
|
|
|
|
this.a(entityfallingblock);
|
|
|
|
world.addEntity(entityfallingblock);
|
2015-04-17 11:51:46 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2015-12-07 00:14:41 +01:00
|
|
|
index 86556cd..b34e93c 100644
|
2015-04-17 11:51:46 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2015-12-07 00:14:41 +01:00
|
|
|
@@ -16,13 +16,26 @@ public class EntityFallingBlock extends Entity {
|
2015-04-17 11:51:46 +02:00
|
|
|
private int fallHurtMax = 40;
|
|
|
|
private float fallHurtAmount = 2.0F;
|
|
|
|
public NBTTagCompound tileEntityData;
|
|
|
|
+ public org.bukkit.Location sourceLoc; // PaperSpigot
|
|
|
|
|
|
|
|
+ // PaperSpigot start - Add FallingBlock source location API
|
|
|
|
public EntityFallingBlock(World world) {
|
|
|
|
+ this(null, world);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public EntityFallingBlock(org.bukkit.Location loc, World world) {
|
|
|
|
super(world);
|
|
|
|
+ sourceLoc = loc;
|
|
|
|
}
|
|
|
|
|
2015-12-07 00:14:41 +01:00
|
|
|
public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) {
|
|
|
|
+ this(null, world, d0, d1, d2, iblockdata);
|
|
|
|
+ }
|
|
|
|
+
|
2015-04-17 11:51:46 +02:00
|
|
|
+ public EntityFallingBlock(org.bukkit.Location loc, World world, double d0, double d1, double d2, IBlockData iblockdata) {
|
|
|
|
super(world);
|
|
|
|
+ sourceLoc = loc;
|
|
|
|
+ // PaperSpigot end
|
|
|
|
this.block = iblockdata;
|
|
|
|
this.k = true;
|
|
|
|
this.setSize(0.98F, 0.98F);
|
2015-12-07 00:14:41 +01:00
|
|
|
@@ -197,7 +210,13 @@ public class EntityFallingBlock extends Entity {
|
2015-04-17 11:51:46 +02:00
|
|
|
if (this.tileEntityData != null) {
|
|
|
|
nbttagcompound.set("TileEntityData", this.tileEntityData);
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+ // PaperSpigot start - Add FallingBlock source location API
|
|
|
|
+ if (sourceLoc != null) {
|
|
|
|
+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX());
|
|
|
|
+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY());
|
|
|
|
+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ());
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void a(NBTTagCompound nbttagcompound) {
|
2015-12-07 00:14:41 +01:00
|
|
|
@@ -233,7 +252,14 @@ public class EntityFallingBlock extends Entity {
|
2015-04-17 11:51:46 +02:00
|
|
|
if (block == null || block.getMaterial() == Material.AIR) {
|
|
|
|
this.block = Blocks.SAND.getBlockData();
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+ // PaperSpigot start - Add FallingBlock source location API
|
|
|
|
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
|
|
|
|
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
|
|
|
|
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
|
|
|
|
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
|
|
|
|
+ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(boolean flag) {
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
2015-09-19 03:44:37 +02:00
|
|
|
index 75eed48..eedb66f 100644
|
2015-04-17 11:51:46 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
2015-09-19 03:44:37 +02:00
|
|
|
@@ -57,4 +57,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
|
|
|
|
public void setHurtEntities(boolean hurtEntities) {
|
|
|
|
getHandle().hurtEntities = hurtEntities;
|
2015-04-17 11:51:46 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // PaperSpigot start - Add FallingBlock source location API
|
|
|
|
+ @Override
|
|
|
|
+ public org.bukkit.Location getSourceLoc() {
|
|
|
|
+ return getHandle().sourceLoc;
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
}
|
|
|
|
--
|
2015-12-07 00:14:41 +01:00
|
|
|
2.6.3
|
2015-04-17 11:51:46 +02:00
|
|
|
|