@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -131,8 +131,72 @@
|
||||
@@ -139,8 +139,67 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
+import org.bukkit.plugin.PluginManager;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class Entity implements SyncedDataHolder, INamableTileEntity, EntityAccess, ICommandListener, ScoreHolder {
|
||||
public abstract class Entity implements SyncedDataHolder, INamableTileEntity, EntityAccess, ScoreHolder {
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private static final int CURRENT_LEVEL = 2;
|
||||
@@ -59,11 +59,6 @@
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
|
||||
+ return getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ public int getDefaultMaxAirSupply() {
|
||||
+ return TOTAL_AIR_SUPPLY;
|
||||
@@ -73,10 +68,10 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -245,6 +309,30 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData inBlockState;
|
||||
@@ -253,6 +312,30 @@
|
||||
private final List<Entity.b> movementThisTick;
|
||||
private final Set<IBlockData> blocksInside;
|
||||
private final LongSet visitedBlocks;
|
||||
+ // CraftBukkit start
|
||||
+ public boolean forceDrops;
|
||||
+ public boolean persist = true;
|
||||
@@ -104,10 +99,10 @@
|
||||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -351,12 +439,18 @@
|
||||
@@ -362,12 +445,18 @@
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
public void kill(WorldServer worldserver) {
|
||||
- this.remove(Entity.RemovalReason.KILLED);
|
||||
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
@@ -125,7 +120,7 @@
|
||||
}
|
||||
|
||||
protected abstract void defineSynchedData(DataWatcher.a datawatcher_a);
|
||||
@@ -365,6 +459,16 @@
|
||||
@@ -376,6 +465,16 @@
|
||||
return this.entityData;
|
||||
}
|
||||
|
||||
@@ -142,7 +137,7 @@
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||
}
|
||||
@@ -374,12 +478,24 @@
|
||||
@@ -385,7 +484,13 @@
|
||||
}
|
||||
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
@@ -157,6 +152,8 @@
|
||||
}
|
||||
|
||||
public void onClientRemoval() {}
|
||||
@@ -393,6 +498,12 @@
|
||||
public void onRemoval(Entity.RemovalReason entity_removalreason) {}
|
||||
|
||||
public void setPose(EntityPose entitypose) {
|
||||
+ // CraftBukkit start
|
||||
@@ -168,7 +165,7 @@
|
||||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -404,6 +520,33 @@
|
||||
@@ -417,6 +528,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
@@ -202,7 +199,7 @@
|
||||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -445,6 +588,15 @@
|
||||
@@ -458,6 +596,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
@@ -216,18 +213,18 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void baseTick() {
|
||||
this.level().getProfiler().push("entityBaseTick");
|
||||
this.inBlockState = null;
|
||||
@@ -459,7 +611,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
GameProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
@@ -471,7 +618,7 @@
|
||||
--this.boardingCooldown;
|
||||
}
|
||||
|
||||
- this.handlePortal();
|
||||
+ if (this instanceof EntityPlayer) this.handlePortal(); // CraftBukkit - // Moved up to postTick
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -494,6 +646,10 @@
|
||||
@@ -510,6 +657,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
@@ -238,21 +235,20 @@
|
||||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -503,7 +659,7 @@
|
||||
|
||||
this.firstTick = false;
|
||||
if (!this.level().isClientSide && this instanceof Leashable) {
|
||||
- Leashable.tickLeash((Entity) ((Leashable) this));
|
||||
+ Leashable.tickLeash((Entity & Leashable) this); // CraftBukkit - decompile error
|
||||
@@ -521,7 +672,7 @@
|
||||
world = this.level();
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (this instanceof Leashable) {
|
||||
- Leashable.tickLeash(worldserver, (Entity) ((Leashable) this));
|
||||
+ Leashable.tickLeash(worldserver, (Entity & Leashable) this); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
this.level().getProfiler().pop();
|
||||
@@ -545,15 +701,47 @@
|
||||
@@ -564,15 +715,32 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
- this.igniteForSeconds(15.0F);
|
||||
- if (this.hurt(this.damageSources().lava(), 4.0F)) {
|
||||
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
|
||||
+ if (this instanceof EntityLiving && remainingFireTicks <= 0) {
|
||||
+ // not on fire yet
|
||||
@@ -268,13 +264,22 @@
|
||||
+ // This will be called every single tick the entity is in lava, so don't throw an event
|
||||
+ this.igniteForSeconds(15.0F, false);
|
||||
+ }
|
||||
+
|
||||
+ if (this.hurt(this.damageSources().lava().directBlock(level, lastLavaContact), 4.0F)) {
|
||||
this.playSound(SoundEffects.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
+ // CraftBukkit end
|
||||
World world = this.level();
|
||||
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
- if (this.hurtServer(worldserver, this.damageSources().lava(), 4.0F) && this.shouldPlayLavaHurtSound() && !this.isSilent()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (this.hurtServer(worldserver, this.damageSources().lava().directBlock(level, lastLavaContact), 4.0F) && this.shouldPlayLavaHurtSound() && !this.isSilent()) {
|
||||
worldserver.playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.GENERIC_BURN, this.getSoundSource(), 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
}
|
||||
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
|
||||
}
|
||||
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
|
||||
|
||||
}
|
||||
@@ -583,6 +751,22 @@
|
||||
}
|
||||
|
||||
public final void igniteForSeconds(float f) {
|
||||
@@ -297,7 +302,7 @@
|
||||
this.igniteForTicks(MathHelper.floor(f * 20.0F));
|
||||
}
|
||||
|
||||
@@ -577,7 +765,7 @@
|
||||
@@ -606,7 +790,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
@@ -306,8 +311,8 @@
|
||||
}
|
||||
|
||||
public boolean isFree(double d0, double d1, double d2) {
|
||||
@@ -702,6 +890,28 @@
|
||||
block.updateEntityAfterFallOn(this.level(), this);
|
||||
@@ -739,6 +923,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -332,10 +337,10 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.onGround()) {
|
||||
block.stepOn(this.level(), blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1073,6 +1283,20 @@
|
||||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
||||
|
||||
@@ -1120,6 +1326,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
@@ -353,10 +358,10 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void checkInsideBlocks() {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
|
||||
@@ -1512,6 +1736,7 @@
|
||||
public void recordMovementThroughBlocks(Vec3D vec3d, Vec3D vec3d1) {
|
||||
this.movementThisTick.add(new Entity.b(vec3d, vec3d1));
|
||||
}
|
||||
@@ -1586,6 +1806,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
@@ -364,7 +369,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1718,6 +1943,12 @@
|
||||
@@ -1838,6 +2059,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -377,7 +382,7 @@
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1746,16 +1977,22 @@
|
||||
@@ -1866,16 +2093,22 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
|
||||
@@ -402,7 +407,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1766,16 +2003,38 @@
|
||||
@@ -1886,16 +2119,38 @@
|
||||
}
|
||||
|
||||
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
|
||||
@@ -445,7 +450,7 @@
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1783,7 +2042,28 @@
|
||||
@@ -1903,7 +2158,28 @@
|
||||
nbttagcompound.putBoolean("OnGround", this.onGround());
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
@@ -475,7 +480,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1832,7 +2112,7 @@
|
||||
@@ -1952,7 +2228,7 @@
|
||||
nbttagcompound.put("Tags", nbttaglist);
|
||||
}
|
||||
|
||||
@@ -484,7 +489,7 @@
|
||||
if (this.isVehicle()) {
|
||||
nbttaglist = new NBTTagList();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1841,7 +2121,7 @@
|
||||
@@ -1961,7 +2237,7 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
@@ -493,7 +498,7 @@
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@@ -1851,6 +2131,11 @@
|
||||
@@ -1971,6 +2247,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +510,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1934,6 +2219,45 @@
|
||||
@@ -2055,6 +2336,45 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@@ -551,7 +556,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1955,6 +2279,12 @@
|
||||
@@ -2076,6 +2396,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
@@ -564,8 +569,8 @@
|
||||
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
|
||||
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
@@ -2009,9 +2339,22 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
@@ -2128,9 +2454,22 @@
|
||||
if (itemstack.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
+ // CraftBukkit start - Capture drops for death event
|
||||
@@ -574,7 +579,7 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY() + (double) f, this.getZ(), itemstack);
|
||||
EntityItem entityitem = new EntityItem(worldserver, this.getX(), this.getY() + (double) f, this.getZ(), itemstack);
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
+ // CraftBukkit start
|
||||
@@ -584,10 +589,10 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().addFreshEntity(entityitem);
|
||||
worldserver.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2040,6 +2383,12 @@
|
||||
@@ -2159,6 +2498,12 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == entityhuman) {
|
||||
if (!this.level().isClientSide()) {
|
||||
@@ -600,7 +605,7 @@
|
||||
leashable.dropLeash(true, !entityhuman.hasInfiniteMaterials());
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
}
|
||||
@@ -2051,6 +2400,13 @@
|
||||
@@ -2170,6 +2515,13 @@
|
||||
|
||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
@@ -614,7 +619,7 @@
|
||||
leashable.setLeashedTo(entityhuman, true);
|
||||
}
|
||||
|
||||
@@ -2134,6 +2490,27 @@
|
||||
@@ -2255,6 +2607,27 @@
|
||||
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -642,7 +647,7 @@
|
||||
if (this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
}
|
||||
@@ -2167,7 +2544,7 @@
|
||||
@@ -2288,7 +2661,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@@ -651,7 +656,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2198,10 +2575,38 @@
|
||||
@@ -2319,10 +2692,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -691,7 +696,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -2213,6 +2618,7 @@
|
||||
@@ -2334,6 +2735,7 @@
|
||||
entity.boardingCooldown = 60;
|
||||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
|
||||
}
|
||||
@@ -699,16 +704,16 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2307,7 +2713,7 @@
|
||||
if (dimensiontransition != null) {
|
||||
WorldServer worldserver1 = dimensiontransition.newLevel();
|
||||
@@ -2434,7 +2836,7 @@
|
||||
if (teleporttransition != null) {
|
||||
WorldServer worldserver1 = teleporttransition.newLevel();
|
||||
|
||||
- if (worldserver.getServer().isLevelEnabled(worldserver1) && (worldserver1.dimension() == worldserver.dimension() || this.canChangeDimensions(worldserver, worldserver1))) {
|
||||
+ if (this instanceof EntityPlayer || (worldserver1 != null && (worldserver1.dimension() == worldserver.dimension() || this.canChangeDimensions(worldserver, worldserver1)))) { // CraftBukkit - always call event for players
|
||||
this.changeDimension(dimensiontransition);
|
||||
- if (worldserver.getServer().isLevelEnabled(worldserver1) && (worldserver1.dimension() == worldserver.dimension() || this.canTeleport(worldserver, worldserver1))) {
|
||||
+ if (this instanceof EntityPlayer || (worldserver1 != null && (worldserver1.dimension() == worldserver.dimension() || this.canTeleport(worldserver, worldserver1)))) { // CraftBukkit - always call event for players
|
||||
this.teleport(teleporttransition);
|
||||
}
|
||||
}
|
||||
@@ -2414,6 +2820,13 @@
|
||||
@@ -2541,6 +2943,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@@ -722,7 +727,7 @@
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2463,8 +2876,12 @@
|
||||
@@ -2594,8 +3003,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@@ -736,7 +741,7 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2483,7 +2900,7 @@
|
||||
@@ -2614,7 +3027,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@@ -745,7 +750,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2491,7 +2908,18 @@
|
||||
@@ -2622,7 +3035,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
@@ -765,7 +770,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2518,11 +2946,40 @@
|
||||
@@ -2649,11 +3073,40 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@@ -786,7 +791,7 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- this.hurt(this.damageSources().lightningBolt(), 5.0F);
|
||||
- this.hurtServer(worldserver, this.damageSources().lightningBolt(), 5.0F);
|
||||
+ // CraftBukkit start
|
||||
+ if (thisBukkitEntity instanceof Hanging) {
|
||||
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
|
||||
@@ -801,47 +806,47 @@
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!this.hurt(this.damageSources().lightningBolt().customEntityDamager(entitylightning), 5.0F)) {
|
||||
+ if (!this.hurtServer(worldserver, this.damageSources().lightningBolt().customEntityDamager(entitylightning), 5.0F)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2691,6 +3148,15 @@
|
||||
@@ -2822,6 +3275,18 @@
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (!this.isRemoved()) {
|
||||
+ // CraftBukkit start
|
||||
+ Location to = new Location(dimensiontransition.newLevel().getWorld(), dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleporttransition), teleporttransition.relatives());
|
||||
+ Location to = CraftLocation.toBukkit(absolutePosition.position(), teleporttransition.newLevel().getWorld(), absolutePosition.yRot(), absolutePosition.xRot());
|
||||
+ EntityTeleportEvent teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ to = teleEvent.getTo();
|
||||
+ dimensiontransition = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), dimensiontransition.speed(), to.getYaw(), to.getPitch(), dimensiontransition.missingRespawnBlock(), dimensiontransition.postDimensionTransition(), dimensiontransition.cause());
|
||||
+ if (!to.equals(teleEvent.getTo())) {
|
||||
+ to = teleEvent.getTo();
|
||||
+ teleporttransition = new TeleportTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), Vec3D.ZERO, to.getYaw(), to.getPitch(), teleporttransition.missingRespawnBlock(), teleporttransition.asPassenger(), Set.of(), teleporttransition.postTeleportTransition(), teleporttransition.cause());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
WorldServer worldserver1 = dimensiontransition.newLevel();
|
||||
List<Entity> list = this.getPassengers();
|
||||
WorldServer worldserver1 = teleporttransition.newLevel();
|
||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||
|
||||
@@ -2716,11 +3182,15 @@
|
||||
if (this != entity2) {
|
||||
entity2.restoreFrom(this);
|
||||
this.removeAfterChangingDimensions();
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity2);
|
||||
+ entity2.bukkitEntity = this.getBukkitEntity();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
@@ -2890,8 +3355,12 @@
|
||||
} else {
|
||||
entity.restoreFrom(this);
|
||||
this.removeAfterChangingDimensions();
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity);
|
||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||
+ // CraftBukkit end
|
||||
entity.teleportSetPosition(PositionMoveRotation.of(teleporttransition), teleporttransition.relatives());
|
||||
- worldserver.addDuringTeleport(entity);
|
||||
+ if (this.inWorld) worldserver.addDuringTeleport(entity); // CraftBukkit - Don't spawn the new entity if the current entity isn't spawned
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
entity2.moveTo(dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), entity2.getXRot());
|
||||
entity2.setDeltaMovement(dimensiontransition.speed());
|
||||
- if (this != entity2) {
|
||||
+ if (this != entity2 && this.inWorld) { // CraftBukkit - Don't spawn the new entity if the current entity isn't spawned
|
||||
worldserver1.addDuringTeleport(entity2);
|
||||
}
|
||||
|
||||
@@ -2754,8 +3224,9 @@
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -2965,8 +3434,9 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
@@ -852,7 +857,7 @@
|
||||
leashable.dropLeash(true, false);
|
||||
}
|
||||
|
||||
@@ -2765,6 +3236,20 @@
|
||||
@@ -2976,6 +3446,20 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
@@ -873,35 +878,25 @@
|
||||
public boolean canUsePortal(boolean flag) {
|
||||
return (flag || !this.isPassenger()) && this.isAlive();
|
||||
}
|
||||
@@ -2877,6 +3362,12 @@
|
||||
@@ -3104,9 +3588,15 @@
|
||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
- public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<Relative> set, float f, float f1, boolean flag) {
|
||||
+ // CraftBukkit start
|
||||
+ public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ return this.teleportTo(worldserver, d0, d1, d2, set, f, f1);
|
||||
+ public final boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<Relative> set, float f, float f1, boolean flag) {
|
||||
+ return teleportTo(worldserver, d0, d1, d2, set, f, f1, flag, PlayerTeleportEvent.TeleportCause.UNKNOWN);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
+ public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<Relative> set, float f, float f1, boolean flag, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
|
||||
float f2 = MathHelper.clamp(f1, -90.0F, 90.0F);
|
||||
- Entity entity = this.teleport(new TeleportTransition(worldserver, new Vec3D(d0, d1, d2), Vec3D.ZERO, f, f2, set, TeleportTransition.DO_NOTHING));
|
||||
+ Entity entity = this.teleport(new TeleportTransition(worldserver, new Vec3D(d0, d1, d2), Vec3D.ZERO, f, f2, set, TeleportTransition.DO_NOTHING, cause));
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -2895,8 +3386,12 @@
|
||||
entity.restoreFrom(this);
|
||||
entity.moveTo(d0, d1, d2, f, f2);
|
||||
entity.setYHeadRot(f);
|
||||
- this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
- worldserver.addDuringTeleport(entity);
|
||||
+ this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
|
||||
+ // CraftBukkit start - Don't spawn the new entity if the current entity isn't spawned
|
||||
+ if (inWorld) {
|
||||
+ worldserver.addDuringTeleport(entity);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -3023,7 +3518,26 @@
|
||||
return entity != null;
|
||||
}
|
||||
@@ -3228,7 +3718,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
@@ -929,7 +924,7 @@
|
||||
}
|
||||
|
||||
public final float getEyeHeight(EntityPose entitypose) {
|
||||
@@ -3332,6 +3846,11 @@
|
||||
@@ -3525,6 +4034,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
@@ -941,7 +936,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3601,6 +4120,14 @@
|
||||
@@ -3792,6 +4306,14 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason entity_removalreason) {
|
||||
|
||||
Reference in New Issue
Block a user