Add Entity Origin API
This replaces the TNT and Falling Block Source Location API with a more general purpose API that works with all entities.
This commit is contained in:
parent
a6a5b12b9e
commit
ced183982a
|
@ -1,14 +1,34 @@
|
|||
From 77c518b68d30af9a16dee08c8352fdeb2c9ad371 Mon Sep 17 00:00:00 2001
|
||||
From b63b68858570e7fa3b29c47c4124fcc69bd87098 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 17:50:31 -0600
|
||||
Subject: [PATCH] FallingBlock and TNTPrimed source location API
|
||||
Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 9f4d48b..b82d112 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -374,4 +374,15 @@ public interface Entity extends Metadatable, CommandSender {
|
||||
|
||||
Spigot spigot();
|
||||
// Spigot End
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the location where this entity originates from.
|
||||
+ * <p>
|
||||
+ * This value can be null if the entity hasn't yet been added to the world.
|
||||
+ *
|
||||
+ * @return Location where entity originates or null if not yet added
|
||||
+ */
|
||||
+ Location getOrigin();
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
index bc56fa2..ae9033c 100644
|
||||
index bc56fa2..360e149 100644
|
||||
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
@@ -59,4 +59,11 @@ public interface FallingBlock extends Entity {
|
||||
@@ -59,4 +59,13 @@ public interface FallingBlock extends Entity {
|
||||
* @param hurtEntities whether entities will be damaged by this block.
|
||||
*/
|
||||
void setHurtEntities(boolean hurtEntities);
|
||||
|
@ -17,14 +37,16 @@ index bc56fa2..ae9033c 100644
|
|||
+ * Gets the source block location of the FallingBlock
|
||||
+ *
|
||||
+ * @return the source block location the FallingBlock was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public org.bukkit.Location getSourceLoc();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
index 3ce322d..74b82f9 100644
|
||||
index 3ce322d..69df487 100644
|
||||
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
@@ -35,4 +35,11 @@ public interface TNTPrimed extends Explosive {
|
||||
@@ -35,4 +35,13 @@ public interface TNTPrimed extends Explosive {
|
||||
* @return the source of this primed TNT
|
||||
*/
|
||||
public Entity getSource();
|
||||
|
@ -33,7 +55,9 @@ index 3ce322d..74b82f9 100644
|
|||
+ * Gets the source block location of the TNTPrimed
|
||||
+ *
|
||||
+ * @return the source block location the TNTPrimed was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public org.bukkit.Location getSourceLoc();
|
||||
}
|
||||
--
|
|
@ -0,0 +1,152 @@
|
|||
From bfa2721aa0e6c9406977d18b648f2eae3d082109 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
||||
Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index f4b9481..eaaca75 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -142,6 +142,7 @@ public abstract class Entity implements ICommandListener {
|
||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
||||
public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
|
||||
public Timing tickTimer = SpigotTimings.getEntityTimings(this); // Paper
|
||||
+ public Location origin; // Paper
|
||||
// Spigot start
|
||||
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
||||
public final boolean defaultActivationState;
|
||||
@@ -1347,6 +1348,11 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Save the entity's origin location
|
||||
+ if (origin != null) {
|
||||
+ nbttagcompound.set("Paper.Origin", this.a(origin.getX(), origin.getY(), origin.getZ()));
|
||||
+ }
|
||||
+ // Paper end
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being saved");
|
||||
@@ -1480,6 +1486,15 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start - Restore the entity's origin location
|
||||
+ if (origin == null) {
|
||||
+ NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6);
|
||||
+ if (!originTag.isEmpty()) {
|
||||
+ origin = new Location(world.getWorld(), originTag.e(0), originTag.e(1), originTag.e(2));
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 6246c05..8f2b253 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -242,6 +242,14 @@ public class EntityFallingBlock extends Entity {
|
||||
this.block = Blocks.SAND.getBlockData();
|
||||
}
|
||||
|
||||
+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility
|
||||
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
|
||||
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
|
||||
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
|
||||
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
|
||||
+ origin = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 564ea37..1113b1c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -104,6 +104,14 @@ public class EntityTNTPrimed extends Entity {
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.setFuseTicks(nbttagcompound.getShort("Fuse"));
|
||||
+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility
|
||||
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
|
||||
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
|
||||
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
|
||||
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
|
||||
+ origin = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public EntityLiving getSource() {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 9124558..18d0bd8 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -948,6 +948,12 @@ public abstract class World implements IBlockAccess {
|
||||
int j = MathHelper.floor(entity.locZ / 16.0D);
|
||||
boolean flag = entity.attachedToPlayer;
|
||||
|
||||
+ // Paper start - Set origin location when the entity is being added to the world
|
||||
+ if (entity.origin == null) {
|
||||
+ entity.origin = entity.getBukkitEntity().getLocation();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (entity instanceof EntityHuman) {
|
||||
flag = true;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 3b29578..ae2dc49 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -593,4 +593,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return spigot;
|
||||
}
|
||||
// Spigot end
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public Location getOrigin() {
|
||||
+ return getHandle().origin;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
||||
index 75eed48..65e1408 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
||||
@@ -57,4 +57,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
|
||||
public void setHurtEntities(boolean hurtEntities) {
|
||||
getHandle().hurtEntities = hurtEntities;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public org.bukkit.Location getSourceLoc() {
|
||||
+ return getOrigin();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
|
||||
index c493c9c..93843aa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
|
||||
@@ -65,4 +65,11 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
|
||||
|
||||
return null;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public org.bukkit.Location getSourceLoc() {
|
||||
+ return getOrigin();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.7.1.windows.2
|
||||
|
|
@ -1,267 +0,0 @@
|
|||
From e34f99c1db1594796d68b10e563925c324b255f2 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
||||
Subject: [PATCH] FallingBlock and TNTPrimed source location API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
|
||||
index f6095af..5c12227 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
|
||||
@@ -33,7 +33,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()));
|
||||
+ // Paper 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()));
|
||||
+ // Paper end
|
||||
} else {
|
||||
world.setAir(blockposition);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
|
||||
index 6654240..936a754 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));
|
||||
+ // Paper start - Add FallingBlock source location
|
||||
+ 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));
|
||||
+ // Paper end
|
||||
|
||||
this.a(entityfallingblock);
|
||||
world.addEntity(entityfallingblock);
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
index f794167..09d5f7b 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
@@ -29,7 +29,8 @@ public class BlockTNT extends Block {
|
||||
|
||||
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
|
||||
if (!world.isClientSide) {
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
|
||||
+ org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc
|
||||
|
||||
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
|
||||
world.addEntity(entitytntprimed);
|
||||
@@ -43,7 +44,8 @@ public class BlockTNT extends Block {
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) {
|
||||
if (!world.isClientSide) {
|
||||
if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) {
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving);
|
||||
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc
|
||||
|
||||
world.addEntity(entitytntprimed);
|
||||
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
index d7bea3d..c1c0c7c 100644
|
||||
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -519,7 +519,7 @@ public class DispenserRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null);
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(block.getLocation(), world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); // Paper - Add source loc
|
||||
// CraftBukkit end
|
||||
|
||||
world.addEntity(entitytntprimed);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 6246c05..5e8523d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -17,13 +17,25 @@ public class EntityFallingBlock extends Entity {
|
||||
private float fallHurtAmount = 2.0F;
|
||||
public NBTTagCompound tileEntityData;
|
||||
protected static final DataWatcherObject<BlockPosition> d = DataWatcher.a(EntityFallingBlock.class, DataWatcherRegistry.j);
|
||||
+ public org.bukkit.Location sourceLoc; // Paper
|
||||
|
||||
+ // Paper start - FallingBlock source location API
|
||||
public EntityFallingBlock(World world) {
|
||||
+ this(null, world);
|
||||
+ }
|
||||
+
|
||||
+ public EntityFallingBlock(org.bukkit.Location loc, World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) {
|
||||
+ this(null, world, d0, d1, d2, iblockdata);
|
||||
+ }
|
||||
+
|
||||
+ public EntityFallingBlock(org.bukkit.Location loc, World world, double d0, double d1, double d2, IBlockData iblockdata) {
|
||||
super(world);
|
||||
+ sourceLoc = loc;
|
||||
+ // Paper end
|
||||
this.block = iblockdata;
|
||||
this.i = true;
|
||||
this.setSize(0.98F, 0.98F);
|
||||
@@ -206,6 +218,13 @@ public class EntityFallingBlock extends Entity {
|
||||
nbttagcompound.set("TileEntityData", this.tileEntityData);
|
||||
}
|
||||
|
||||
+ // Paper 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());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
@@ -242,6 +261,14 @@ public class EntityFallingBlock extends Entity {
|
||||
this.block = Blocks.SAND.getBlockData();
|
||||
}
|
||||
|
||||
+ // Paper 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);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 564ea37..1820c7b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -9,16 +9,28 @@ public class EntityTNTPrimed extends Entity {
|
||||
private int c;
|
||||
public float yield = 4; // CraftBukkit - add field
|
||||
public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
+ public org.bukkit.Location sourceLoc; // Paper - TNT soure location API
|
||||
|
||||
+ // Paper start - TNT source location API
|
||||
public EntityTNTPrimed(World world) {
|
||||
+ this(null, world);
|
||||
+ }
|
||||
+
|
||||
+ public EntityTNTPrimed(org.bukkit.Location loc, World world) {
|
||||
super(world);
|
||||
+ sourceLoc = loc;
|
||||
+ // Paper end
|
||||
this.c = 80;
|
||||
this.i = true;
|
||||
this.setSize(0.98F, 0.98F);
|
||||
}
|
||||
|
||||
public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
|
||||
- this(world);
|
||||
+ this(null, world, d0, d1, d2, entityliving);
|
||||
+ }
|
||||
+
|
||||
+ public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) {
|
||||
+ this(loc, world);
|
||||
this.setPosition(d0, d1, d2);
|
||||
float f = (float) (Math.random() * 6.2831854820251465D);
|
||||
|
||||
@@ -100,10 +112,25 @@ public class EntityTNTPrimed extends Entity {
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("Fuse", (short) this.getFuseTicks());
|
||||
+ // Paper start - TNT source location API
|
||||
+ if (sourceLoc != null) {
|
||||
+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX());
|
||||
+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY());
|
||||
+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.setFuseTicks(nbttagcompound.getShort("Fuse"));
|
||||
+ // Paper start - TNT 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);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public EntityLiving getSource() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 83e3003..25edfb8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -921,7 +921,10 @@ public class CraftWorld implements World {
|
||||
double y = location.getBlockY() + 0.5;
|
||||
double z = location.getBlockZ() + 0.5;
|
||||
|
||||
- EntityFallingBlock entity = new EntityFallingBlock(world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data));
|
||||
+ // Paper start - Add FallingBlock source location API
|
||||
+ location = location.clone();
|
||||
+ EntityFallingBlock entity = new EntityFallingBlock(location, world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data));
|
||||
+ // Paper end
|
||||
entity.ticksLived = 1;
|
||||
|
||||
world.addEntity(entity, SpawnReason.CUSTOM);
|
||||
@@ -957,7 +960,10 @@ public class CraftWorld implements World {
|
||||
int type = CraftMagicNumbers.getId(blockData.getBlock());
|
||||
int data = blockData.getBlock().toLegacyData(blockData);
|
||||
|
||||
- entity = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data));
|
||||
+ // Paper start - Add FallingBlock source location API
|
||||
+ location = location.clone();
|
||||
+ entity = new EntityFallingBlock(location, world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data));
|
||||
+ // Paper end
|
||||
} else if (Projectile.class.isAssignableFrom(clazz)) {
|
||||
if (Snowball.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntitySnowball(world, x, y, z);
|
||||
@@ -1162,7 +1168,8 @@ public class CraftWorld implements World {
|
||||
throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
|
||||
}
|
||||
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
||||
- entity = new EntityTNTPrimed(world, x, y, z, null);
|
||||
+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), x, y, z); // Paper
|
||||
+ entity = new EntityTNTPrimed(loc, world, x, y, z, null);
|
||||
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntityExperienceOrb(world, x, y, z, 0);
|
||||
} else if (Weather.class.isAssignableFrom(clazz)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
||||
index 75eed48..9e6ed0c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java
|
||||
@@ -57,4 +57,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
|
||||
public void setHurtEntities(boolean hurtEntities) {
|
||||
getHandle().hurtEntities = hurtEntities;
|
||||
}
|
||||
+
|
||||
+ // Paper start - Add FallingBlock source location API
|
||||
+ @Override
|
||||
+ public org.bukkit.Location getSourceLoc() {
|
||||
+ return getHandle().sourceLoc;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
|
||||
index c493c9c..eea3238 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
|
||||
@@ -65,4 +65,11 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
|
||||
|
||||
return null;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public org.bukkit.Location getSourceLoc() {
|
||||
+ return getHandle().sourceLoc;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.7.1.windows.2
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
From 55424879c75d40adf92d11dac79bc28e8e092b11 Mon Sep 17 00:00:00 2001
|
||||
From 4ec4d6943f6c93abbc66d389945bf4d9e96de6bc Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 1 Mar 2016 23:52:34 -0600
|
||||
Subject: [PATCH] Prevent tile entity and entity crashes
|
||||
|
@ -23,10 +23,10 @@ index 4193f20..f579d28 100644
|
|||
public String a() throws Exception {
|
||||
int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock());
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3b7c16e..c5ce0c3 100644
|
||||
index 18d0bd8..f564b1a 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1428,10 +1428,12 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1434,10 +1434,12 @@ public abstract class World implements IBlockAccess {
|
||||
entity.tickTimer.stopTiming(); // Paper
|
||||
} catch (Throwable throwable1) {
|
||||
entity.tickTimer.stopTiming();
|
||||
|
@ -43,7 +43,7 @@ index 3b7c16e..c5ce0c3 100644
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1493,10 +1495,13 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1499,10 +1501,13 @@ public abstract class World implements IBlockAccess {
|
||||
((ITickable) tileentity).c();
|
||||
this.methodProfiler.b();
|
||||
} catch (Throwable throwable2) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 85c162228c3c70674ab7bfc8d498138fb3620b4e Mon Sep 17 00:00:00 2001
|
||||
From 10b350b444bd8faa19ee78120ee98a263604e561 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 1 Mar 2016 23:58:50 -0600
|
||||
Subject: [PATCH] Configurable top of nether void damage
|
||||
|
@ -20,10 +20,10 @@ index f81ece3..7c0e61f 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index f4b9481..018da0f 100644
|
||||
index eaaca75..00ea730 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -300,6 +300,13 @@ public abstract class Entity implements ICommandListener {
|
||||
@@ -301,6 +301,13 @@ public abstract class Entity implements ICommandListener {
|
||||
this.U();
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ index f4b9481..018da0f 100644
|
|||
public void U() {
|
||||
this.world.methodProfiler.a("entityBaseTick");
|
||||
if (this.isPassenger() && this.by().dead) {
|
||||
@@ -380,7 +387,7 @@ public abstract class Entity implements ICommandListener {
|
||||
@@ -381,7 +388,7 @@ public abstract class Entity implements ICommandListener {
|
||||
this.fallDistance *= 0.5F;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 73b3ea1a73387e5a5a24366959c1c35caf7387e9 Mon Sep 17 00:00:00 2001
|
||||
From d438c0dfa1b5b31fbb7c65e5b8675824847f541b Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Wed, 2 Mar 2016 00:52:31 -0600
|
||||
Subject: [PATCH] Lighting Queue
|
||||
|
@ -31,7 +31,7 @@ index facb98c..e0e9a65 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index cde4124..9020b1b 100644
|
||||
index cde4124..3b5e8c2 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -44,6 +44,7 @@ public class Chunk {
|
||||
|
@ -146,7 +146,7 @@ index 83857a6..4dd672a 100644
|
|||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
server.getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 6ae06a5..aa337cc 100644
|
||||
index e9bb02f..d0fd638 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -47,6 +47,11 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
|
@ -206,7 +206,7 @@ index 6ae06a5..aa337cc 100644
|
|||
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index c5ce0c3..a1d8bc5 100644
|
||||
index f564b1a..cdb722d 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -378,7 +378,17 @@ public abstract class World implements IBlockAccess {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 60c2444bb8842bbeeec2b7c92dbe2df43eeabba5 Mon Sep 17 00:00:00 2001
|
||||
From af956966919135aa17834ffb544bbb26b999edaf Mon Sep 17 00:00:00 2001
|
||||
From: Iceee <andrew@opticgaming.tv>
|
||||
Date: Wed, 2 Mar 2016 23:00:53 -0600
|
||||
Subject: [PATCH] Configurable TNT cannon fix
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 5efba80..2cfeb9c 100644
|
||||
index 1236128..8d97890 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -241,4 +241,10 @@ public class PaperWorldConfig {
|
||||
|
@ -140,37 +140,37 @@ index 1a133d9..f4f9be6 100644
|
|||
int i = aenumdirection.length;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
index 09d5f7b..a3c0315 100644
|
||||
index f794167..021a3be 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
@@ -30,7 +30,11 @@ public class BlockTNT extends Block {
|
||||
@@ -29,7 +29,11 @@ public class BlockTNT extends Block {
|
||||
|
||||
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
|
||||
if (!world.isClientSide) {
|
||||
org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
|
||||
+ // Paper start - Fix cannons
|
||||
+ double y = blockposition.getY();
|
||||
+ if (!world.paperConfig.fixCannons) y += 0.5;
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
|
||||
+ // Paper end
|
||||
|
||||
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
|
||||
world.addEntity(entitytntprimed);
|
||||
@@ -45,7 +49,11 @@ public class BlockTNT extends Block {
|
||||
@@ -43,7 +47,11 @@ public class BlockTNT extends Block {
|
||||
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) {
|
||||
if (!world.isClientSide) {
|
||||
if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) {
|
||||
org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving);
|
||||
+ // Paper start - Fix cannons
|
||||
+ double y = blockposition.getY();
|
||||
+ if (!world.paperConfig.fixCannons) y += 0.5;
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc
|
||||
+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), entityliving);
|
||||
+ // Paper end
|
||||
|
||||
world.addEntity(entitytntprimed);
|
||||
world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
index c1c0c7c..e2eb620 100644
|
||||
index d7bea3d..61ac795 100644
|
||||
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -498,7 +498,11 @@ public class DispenserRegistry {
|
||||
|
@ -187,10 +187,10 @@ index c1c0c7c..e2eb620 100644
|
|||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
index 5e8523d..4345a3c 100644
|
||||
index 8f2b253..23fb154 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||
@@ -293,4 +293,22 @@ public class EntityFallingBlock extends Entity {
|
||||
@@ -274,4 +274,22 @@ public class EntityFallingBlock extends Entity {
|
||||
public boolean br() {
|
||||
return true;
|
||||
}
|
||||
|
@ -214,10 +214,10 @@ index 5e8523d..4345a3c 100644
|
|||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 1820c7b..ca3bfd5 100644
|
||||
index 1113b1c..12feacf 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -42,6 +42,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
@@ -30,6 +30,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
this.source = entityliving;
|
||||
|
@ -225,7 +225,7 @@ index 1820c7b..ca3bfd5 100644
|
|||
}
|
||||
|
||||
protected void i() {
|
||||
@@ -137,9 +138,66 @@ public class EntityTNTPrimed extends Entity {
|
||||
@@ -118,9 +119,66 @@ public class EntityTNTPrimed extends Entity {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
From cf6fcfa594a8512abf3b7821edcebe478fc13df0 Mon Sep 17 00:00:00 2001
|
||||
From eb7ba9fcaad158852e146e383bf65e7410e63059 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Wed, 2 Mar 2016 23:45:17 -0600
|
||||
Subject: [PATCH] Disable spigot tick limiters
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3fe987f..c93af22 100644
|
||||
index a4b4d1e..18e49b5 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1415,10 +1415,10 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1421,10 +1421,10 @@ public abstract class World implements IBlockAccess {
|
||||
// CraftBukkit start - Use field for loop variable
|
||||
co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper
|
||||
int entitiesThisCycle = 0;
|
||||
|
@ -23,7 +23,7 @@ index 3fe987f..c93af22 100644
|
|||
tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0;
|
||||
entity = (Entity) this.entityList.get(this.tickPosition);
|
||||
// CraftBukkit end
|
||||
@@ -1483,9 +1483,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1489,9 +1489,7 @@ public abstract class World implements IBlockAccess {
|
||||
// Spigot start
|
||||
// Iterator iterator = this.tileEntityListTick.iterator();
|
||||
int tilesThisCycle = 0;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 4e1268b8724257d5e429efa488898d14e9204881 Mon Sep 17 00:00:00 2001
|
||||
From 5287c52a14a27be99d61b5744b4738fd0c443c69 Mon Sep 17 00:00:00 2001
|
||||
From: Nik Gil <nikmanG@users.noreply.github.com>
|
||||
Date: Thu, 3 Mar 2016 04:04:19 -0600
|
||||
Subject: [PATCH] Made EntityDismountEvent Cancellable
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 38bc9c0..ab718ce 100644
|
||||
index 446c0aa..8d4e4f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -38,6 +38,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
@ -16,7 +16,7 @@ index 38bc9c0..ab718ce 100644
|
|||
// CraftBukkit end
|
||||
|
||||
public abstract class Entity implements ICommandListener {
|
||||
@@ -1737,6 +1738,11 @@ public abstract class Entity implements ICommandListener {
|
||||
@@ -1752,6 +1753,11 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
// CraftBukkit end
|
||||
Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
|
||||
|
@ -29,5 +29,5 @@ index 38bc9c0..ab718ce 100644
|
|||
entity.j = 60;
|
||||
}
|
||||
--
|
||||
2.7.2
|
||||
2.7.1.windows.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 2a296ac64bd3bd678edd258287d058ed28e9c186 Mon Sep 17 00:00:00 2001
|
||||
From 88409e2d479cf1860508674d0329802571bc1ac1 Mon Sep 17 00:00:00 2001
|
||||
From: CullanP <cullanpage@gmail.com>
|
||||
Date: Thu, 3 Mar 2016 02:13:38 -0600
|
||||
Subject: [PATCH] Avoid hopper searches if there are no items
|
||||
|
@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
|
|||
Combined, this adds up a lot.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index f233c13..d8c0347 100644
|
||||
index 42fedb7..806e499 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -46,6 +46,13 @@ public class Chunk {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 5f62245e7a6eaa0c63251b6ae75698fd0e6765c5 Mon Sep 17 00:00:00 2001
|
||||
From e8e6bdea274b31e55511c5f353c9e3e88c0493a9 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Hirschfeld <joe@ibj.io>
|
||||
Date: Thu, 3 Mar 2016 02:39:54 -0600
|
||||
Subject: [PATCH] Change implementation of (tile)entity removal list
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 4f1c1b5..ccef853 100644
|
||||
index 18e49b5..cf5f4f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -30,6 +30,11 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
|
@ -34,7 +34,7 @@ index 4f1c1b5..ccef853 100644
|
|||
public final List<EntityHuman> players = Lists.newArrayList();
|
||||
public final List<Entity> j = Lists.newArrayList();
|
||||
protected final IntHashMap<Entity> entitiesById = new IntHashMap();
|
||||
@@ -1387,19 +1392,20 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1393,19 +1398,20 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
int j;
|
||||
|
||||
|
@ -64,5 +64,5 @@ index 4f1c1b5..ccef853 100644
|
|||
this.f.clear();
|
||||
this.l();
|
||||
--
|
||||
2.7.4
|
||||
2.7.1.windows.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From fabc3a2adbde966e8248772fadf3f9930b2b1101 Mon Sep 17 00:00:00 2001
|
||||
From 6e2fcdb3c97946c75a14eb3d1ce5fbba80959837 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Hirschfeld <joe@ibj.io>
|
||||
Date: Thu, 3 Mar 2016 03:15:41 -0600
|
||||
Subject: [PATCH] Add exception reporting event
|
||||
|
@ -50,7 +50,7 @@ index 0000000..9339718
|
|||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index d8c0347..d42a8d2 100644
|
||||
index 806e499..8b11266 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -292,7 +292,7 @@ index 320e52e..d40257f 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 6cfd38c..614cabe 100644
|
||||
index cf5f4f5..d3621ec 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1,5 +1,7 @@
|
||||
|
@ -303,7 +303,7 @@ index 6cfd38c..614cabe 100644
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -1447,8 +1449,10 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1453,8 +1455,10 @@ public abstract class World implements IBlockAccess {
|
||||
} catch (Throwable throwable1) {
|
||||
entity.tickTimer.stopTiming();
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
|
@ -315,7 +315,7 @@ index 6cfd38c..614cabe 100644
|
|||
entity.dead = true;
|
||||
continue;
|
||||
// Paper end
|
||||
@@ -1512,8 +1516,10 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1518,8 +1522,10 @@ public abstract class World implements IBlockAccess {
|
||||
this.methodProfiler.b();
|
||||
} catch (Throwable throwable2) {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 821a19198ac0334421250b89174b7b353543e9c2 Mon Sep 17 00:00:00 2001
|
||||
From dd87711174327d19cb459835683ab0d47efbd768 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 8 Mar 2016 23:25:45 -0500
|
||||
Subject: [PATCH] Disable Scoreboards for non players by default
|
||||
|
@ -11,7 +11,7 @@ So avoid looking up scoreboards and short circuit to the "not on a team"
|
|||
logic which is most likely to be true.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7b5b2d3..7cd36da 100644
|
||||
index 75b22fa..f967ec0 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -277,4 +277,9 @@ public class PaperWorldConfig {
|
||||
|
@ -37,10 +37,10 @@ index 871535c..25950bd 100644
|
|||
|
||||
if (scoreboard.addPlayerToTeam(s2, s)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index ab718ce..c28cf58 100644
|
||||
index 8d4e4f5..55fe96b 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1846,6 +1846,7 @@ public abstract class Entity implements ICommandListener {
|
||||
@@ -1861,6 +1861,7 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
|
||||
public ScoreboardTeamBase aO() {
|
||||
|
@ -49,5 +49,5 @@ index ab718ce..c28cf58 100644
|
|||
}
|
||||
|
||||
--
|
||||
2.7.3
|
||||
2.7.1.windows.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From f3a9dd01aab3b666d2b5e76346c58afef11ed3b1 Mon Sep 17 00:00:00 2001
|
||||
From 31bd0087461e17206c64771c0ec8fdf787955a5f Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 18 Mar 2016 17:57:25 -0400
|
||||
Subject: [PATCH] Optimize Chunk Unload Queue
|
||||
|
@ -23,7 +23,7 @@ it will skip it and move to next.
|
|||
Also optimize EAR to use these methods.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index d42a8d2..05417a7 100644
|
||||
index f4ec2e4..ad69025 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -53,6 +53,8 @@ public class Chunk {
|
||||
|
@ -240,7 +240,7 @@ index 63e118d..721bcae 100644
|
|||
i += server.getChunkAt( x, z ).entityCount.get( oClass );
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 2283536..406bdaa 100644
|
||||
index 1e14a62..4cc729e 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -159,9 +159,15 @@ public abstract class World implements IBlockAccess {
|
||||
|
@ -261,7 +261,7 @@ index 2283536..406bdaa 100644
|
|||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
|
||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index c51c74b..caa5e62 100644
|
||||
index 3f2d83a..c81dfee 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -206,7 +206,7 @@ public class CraftWorld implements World {
|
||||
|
@ -299,7 +299,7 @@ index c51c74b..caa5e62 100644
|
|||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
@@ -1543,7 +1544,7 @@ public class CraftWorld implements World {
|
||||
@@ -1536,7 +1537,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
// Already unloading?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 8f9680573688c86f293c0d15568d7b04a0fac502 Mon Sep 17 00:00:00 2001
|
||||
From c91433a2a23ef4fc223164c76f978065bd421bfb Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 22 Mar 2016 00:33:47 -0400
|
||||
Subject: [PATCH] Use a Shared Random for Entities
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities
|
|||
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index c28cf58..0f66b39 100644
|
||||
index 55fe96b..bf8e194 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -45,6 +45,7 @@ public abstract class Entity implements ICommandListener {
|
||||
|
@ -17,7 +17,7 @@ index c28cf58..0f66b39 100644
|
|||
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
|
||||
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
}
|
||||
@@ -167,7 +168,7 @@ public abstract class Entity implements ICommandListener {
|
||||
@@ -168,7 +169,7 @@ public abstract class Entity implements ICommandListener {
|
||||
this.width = 0.6F;
|
||||
this.length = 1.8F;
|
||||
this.av = 1;
|
||||
|
@ -27,5 +27,5 @@ index c28cf58..0f66b39 100644
|
|||
this.justCreated = true;
|
||||
this.uniqueID = MathHelper.a(this.random);
|
||||
--
|
||||
2.7.4.windows.1
|
||||
2.7.1.windows.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From e94649fa55d3b711ec126ba5ead2bce8e51cd403 Mon Sep 17 00:00:00 2001
|
||||
From 2d7c10790e8d85fa5a372613eca4f0fd633190cb Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 22 Mar 2016 00:55:23 -0400
|
||||
Subject: [PATCH] Don't teleport dead entities
|
||||
|
@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic.
|
|||
Potentially an old CB change that's no longer needed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 0f66b39..e57195c 100644
|
||||
index bf8e194..5a6ad50 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -2096,7 +2096,7 @@ public abstract class Entity implements ICommandListener {
|
||||
@@ -2111,7 +2111,7 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
|
||||
public Entity teleportTo(Location exit, boolean portal) {
|
||||
|
@ -20,5 +20,5 @@ index 0f66b39..e57195c 100644
|
|||
WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
|
||||
int i = worldserver1.dimension;
|
||||
--
|
||||
2.7.4.windows.1
|
||||
2.7.1.windows.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From a17ff1e8481c51527b7dab89a11a1d4c991e9817 Mon Sep 17 00:00:00 2001
|
||||
From d99823c93acbfbff23f1e9057d12ef1ea40fd783 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 22 Mar 2016 23:41:34 -0400
|
||||
Subject: [PATCH] Optimize isValidLocation for inlining
|
||||
|
@ -22,7 +22,7 @@ index f0908a2..d1688e1 100644
|
|||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 2033982..9ad2501 100644
|
||||
index a78b029..e5ea99c 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -284,8 +284,8 @@ public abstract class World implements IBlockAccess {
|
||||
|
@ -99,7 +99,7 @@ index 2033982..9ad2501 100644
|
|||
return Blocks.AIR.getBlockData();
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
|
||||
@@ -2056,7 +2056,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -2062,7 +2062,7 @@ public abstract class World implements IBlockAccess {
|
||||
public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
|
||||
|
||||
public TileEntity getTileEntity(BlockPosition blockposition) {
|
||||
|
@ -108,7 +108,7 @@ index 2033982..9ad2501 100644
|
|||
return null;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
@@ -2159,7 +2159,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -2165,7 +2165,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public boolean d(BlockPosition blockposition, boolean flag) {
|
||||
|
@ -118,5 +118,5 @@ index 2033982..9ad2501 100644
|
|||
} else {
|
||||
Chunk chunk = this.chunkProvider.getLoadedChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
--
|
||||
2.7.4
|
||||
2.7.1.windows.2
|
||||
|
||||
|
|
Loading…
Reference in New Issue