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