mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 03:48:01 +01:00
Expand Pose API
This commit is contained in:
parent
e39a789ec6
commit
1cb5b6e838
@ -18,7 +18,7 @@
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.FenceGateBlock;
|
||||
@@ -138,9 +138,153 @@
|
||||
@@ -138,8 +138,152 @@
|
||||
import net.minecraft.world.scores.ScoreHolder;
|
||||
import net.minecraft.world.scores.Team;
|
||||
import org.slf4j.Logger;
|
||||
@ -61,7 +61,7 @@
|
||||
+// CraftBukkit end
|
||||
|
||||
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
|
||||
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ private static final int CURRENT_LEVEL = 2;
|
||||
+ public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation
|
||||
@ -168,10 +168,9 @@
|
||||
+ return Entity.TOTAL_AIR_SUPPLY;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -224,7 +368,7 @@
|
||||
private static final EntityDataAccessor<Boolean> DATA_CUSTOM_NAME_VISIBLE = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BOOLEAN);
|
||||
private static final EntityDataAccessor<Boolean> DATA_SILENT = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BOOLEAN);
|
||||
@ -181,7 +180,7 @@
|
||||
private static final EntityDataAccessor<Integer> DATA_TICKS_FROZEN = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT);
|
||||
private EntityInLevelCallback levelCallback;
|
||||
private final VecDeltaCodec packetPositionCodec;
|
||||
@@ -253,7 +397,67 @@
|
||||
@@ -253,7 +397,68 @@
|
||||
private final List<Entity.Movement> movementThisTick;
|
||||
private final Set<BlockState> blocksInside;
|
||||
private final LongSet visitedBlocks;
|
||||
@ -216,6 +215,7 @@
|
||||
+ @javax.annotation.Nullable
|
||||
+ private UUID originWorld;
|
||||
+ public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
+ public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
|
||||
+ public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
+ this.origin = location.toVector();
|
||||
@ -249,7 +249,7 @@
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
this.passengers = ImmutableList.of();
|
||||
@@ -261,7 +465,7 @@
|
||||
@@ -261,7 +466,7 @@
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
@ -258,7 +258,7 @@
|
||||
this.remainingFireTicks = -this.getFireImmuneTicks();
|
||||
this.fluidHeight = new Object2DoubleArrayMap(2);
|
||||
this.fluidOnEyes = new HashSet();
|
||||
@@ -284,6 +488,13 @@
|
||||
@@ -284,6 +489,13 @@
|
||||
this.position = Vec3.ZERO;
|
||||
this.blockPosition = BlockPos.ZERO;
|
||||
this.chunkPosition = ChunkPos.ZERO;
|
||||
@ -272,7 +272,7 @@
|
||||
SynchedEntityData.Builder datawatcher_a = new SynchedEntityData.Builder(this);
|
||||
|
||||
datawatcher_a.define(Entity.DATA_SHARED_FLAGS_ID, (byte) 0);
|
||||
@@ -292,7 +503,7 @@
|
||||
@@ -292,7 +504,7 @@
|
||||
datawatcher_a.define(Entity.DATA_CUSTOM_NAME, Optional.empty());
|
||||
datawatcher_a.define(Entity.DATA_SILENT, false);
|
||||
datawatcher_a.define(Entity.DATA_NO_GRAVITY, false);
|
||||
@ -281,7 +281,7 @@
|
||||
datawatcher_a.define(Entity.DATA_TICKS_FROZEN, 0);
|
||||
this.defineSynchedData(datawatcher_a);
|
||||
this.entityData = datawatcher_a.build();
|
||||
@@ -362,20 +573,36 @@
|
||||
@@ -362,20 +574,36 @@
|
||||
}
|
||||
|
||||
public void kill(ServerLevel world) {
|
||||
@ -320,7 +320,7 @@
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||
}
|
||||
@@ -385,22 +612,34 @@
|
||||
@@ -385,22 +613,35 @@
|
||||
}
|
||||
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
@ -340,6 +340,7 @@
|
||||
|
||||
- public void setPose(Pose pose) {
|
||||
+ public void setPose(net.minecraft.world.entity.Pose pose) {
|
||||
+ if (this.fixedPose) return; // Paper - Expand Pose API
|
||||
+ // CraftBukkit start
|
||||
+ if (pose == this.getPose()) {
|
||||
+ return;
|
||||
@ -360,7 +361,7 @@
|
||||
return this.getPose() == pose;
|
||||
}
|
||||
|
||||
@@ -417,6 +656,33 @@
|
||||
@@ -417,6 +658,33 @@
|
||||
}
|
||||
|
||||
public void setRot(float yaw, float pitch) {
|
||||
@ -394,7 +395,7 @@
|
||||
this.setYRot(yaw % 360.0F);
|
||||
this.setXRot(pitch % 360.0F);
|
||||
}
|
||||
@@ -426,8 +692,8 @@
|
||||
@@ -426,8 +694,8 @@
|
||||
}
|
||||
|
||||
public void setPos(double x, double y, double z) {
|
||||
@ -405,21 +406,19 @@
|
||||
}
|
||||
|
||||
protected final AABB makeBoundingBox() {
|
||||
@@ -460,12 +726,22 @@
|
||||
|
||||
public void tick() {
|
||||
@@ -462,10 +730,20 @@
|
||||
this.baseTick();
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void postTick() {
|
||||
+ // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle
|
||||
+ if (!(this instanceof ServerPlayer) && this.isAlive()) { // Paper - don't attempt to teleport dead entities
|
||||
+ this.handlePortal();
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public void baseTick() {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
@ -428,7 +427,7 @@
|
||||
this.inBlockState = null;
|
||||
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
||||
this.stopRiding();
|
||||
@@ -475,7 +751,7 @@
|
||||
@@ -475,7 +753,7 @@
|
||||
--this.boardingCooldown;
|
||||
}
|
||||
|
||||
@ -437,7 +436,7 @@
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -502,7 +778,7 @@
|
||||
@@ -502,7 +780,7 @@
|
||||
this.setRemainingFireTicks(this.remainingFireTicks - 1);
|
||||
}
|
||||
|
||||
@ -446,7 +445,7 @@
|
||||
this.setTicksFrozen(0);
|
||||
this.level().levelEvent((Player) null, 1009, this.blockPosition, 1);
|
||||
}
|
||||
@@ -514,6 +790,10 @@
|
||||
@@ -514,6 +792,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
@ -457,7 +456,7 @@
|
||||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -525,7 +805,7 @@
|
||||
@@ -525,7 +807,7 @@
|
||||
world = this.level();
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
if (this instanceof Leashable) {
|
||||
@ -466,7 +465,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,7 +817,11 @@
|
||||
@@ -537,7 +819,11 @@
|
||||
}
|
||||
|
||||
public void checkBelowWorld() {
|
||||
@ -479,7 +478,7 @@
|
||||
this.onBelowWorld();
|
||||
}
|
||||
|
||||
@@ -568,15 +852,32 @@
|
||||
@@ -568,15 +854,32 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
@ -514,7 +513,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -587,9 +888,25 @@
|
||||
@@ -587,9 +890,25 @@
|
||||
}
|
||||
|
||||
public final void igniteForSeconds(float seconds) {
|
||||
@ -541,7 +540,7 @@
|
||||
public void igniteForTicks(int ticks) {
|
||||
if (this.remainingFireTicks < ticks) {
|
||||
this.setRemainingFireTicks(ticks);
|
||||
@@ -610,7 +927,7 @@
|
||||
@@ -610,7 +929,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
@ -550,7 +549,7 @@
|
||||
}
|
||||
|
||||
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
||||
@@ -672,6 +989,7 @@
|
||||
@@ -672,6 +991,7 @@
|
||||
}
|
||||
|
||||
public void move(MoverType type, Vec3 movement) {
|
||||
@ -558,10 +557,13 @@
|
||||
if (this.noPhysics) {
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
@@ -750,6 +1068,28 @@
|
||||
}
|
||||
}
|
||||
@@ -747,8 +1067,30 @@
|
||||
|
||||
if (movement.y != vec3d1.y) {
|
||||
block.updateEntityMovementAfterFallOn(this.level(), this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) {
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
@ -580,14 +582,13 @@
|
||||
+ if (!bl.getType().isAir()) {
|
||||
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl, org.bukkit.craftbukkit.util.CraftVector.toBukkit(originalMovement)); // Paper - Expose pre-collision velocity
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
||||
|
||||
@@ -913,7 +1253,7 @@
|
||||
@@ -913,7 +1255,7 @@
|
||||
}
|
||||
|
||||
protected BlockPos getOnPos(float offset) {
|
||||
@ -596,7 +597,7 @@
|
||||
BlockPos blockposition = (BlockPos) this.mainSupportingBlockPos.get();
|
||||
|
||||
if (offset <= 1.0E-5F) {
|
||||
@@ -1131,8 +1471,22 @@
|
||||
@@ -1131,8 +1473,22 @@
|
||||
|
||||
protected SoundEvent getSwimHighSpeedSplashSound() {
|
||||
return SoundEvents.GENERIC_SPLASH;
|
||||
@ -619,7 +620,7 @@
|
||||
public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) {
|
||||
this.movementThisTick.add(new Entity.Movement(oldPos, newPos));
|
||||
}
|
||||
@@ -1599,6 +1953,7 @@
|
||||
@@ -1599,6 +1955,7 @@
|
||||
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
|
||||
this.yRotO = this.getYRot();
|
||||
this.xRotO = this.getXRot();
|
||||
@ -627,7 +628,7 @@
|
||||
}
|
||||
|
||||
public void absMoveTo(double x, double y, double z) {
|
||||
@@ -1609,6 +1964,7 @@
|
||||
@@ -1609,6 +1966,7 @@
|
||||
this.yo = y;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, y, d4);
|
||||
@ -635,7 +636,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3 pos) {
|
||||
@@ -1628,11 +1984,19 @@
|
||||
@@ -1628,11 +1986,19 @@
|
||||
}
|
||||
|
||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
||||
@ -655,7 +656,7 @@
|
||||
}
|
||||
|
||||
public final void setOldPosAndRot() {
|
||||
@@ -1701,6 +2065,7 @@
|
||||
@@ -1701,6 +2067,7 @@
|
||||
public void push(Entity entity) {
|
||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
@ -663,7 +664,7 @@
|
||||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = Mth.absMax(d0, d1);
|
||||
@@ -1737,7 +2102,21 @@
|
||||
@@ -1737,7 +2104,21 @@
|
||||
}
|
||||
|
||||
public void push(double deltaX, double deltaY, double deltaZ) {
|
||||
@ -686,7 +687,7 @@
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -1858,9 +2237,21 @@
|
||||
@@ -1858,9 +2239,21 @@
|
||||
}
|
||||
|
||||
public boolean isPushable() {
|
||||
@ -708,7 +709,7 @@
|
||||
public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
|
||||
if (entityKilled instanceof ServerPlayer) {
|
||||
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
|
||||
@@ -1889,74 +2280,133 @@
|
||||
@@ -1889,74 +2282,133 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(CompoundTag nbt) {
|
||||
@ -865,7 +866,7 @@
|
||||
}
|
||||
|
||||
ListTag nbttaglist;
|
||||
@@ -1972,10 +2422,10 @@
|
||||
@@ -1972,10 +2424,10 @@
|
||||
nbttaglist.add(StringTag.valueOf(s));
|
||||
}
|
||||
|
||||
@ -878,7 +879,7 @@
|
||||
if (this.isVehicle()) {
|
||||
nbttaglist = new ListTag();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1984,17 +2434,44 @@
|
||||
@@ -1984,17 +2436,44 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
CompoundTag nbttagcompound1 = new CompoundTag();
|
||||
|
||||
@ -926,7 +927,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
||||
@@ -2080,6 +2557,71 @@
|
||||
@@ -2080,6 +2559,71 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@ -998,7 +999,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -2101,6 +2643,12 @@
|
||||
@@ -2101,6 +2645,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
@ -1011,7 +1012,7 @@
|
||||
protected abstract void readAdditionalSaveData(CompoundTag nbt);
|
||||
|
||||
protected abstract void addAdditionalSaveData(CompoundTag nbt);
|
||||
@@ -2153,9 +2701,31 @@
|
||||
@@ -2153,9 +2703,31 @@
|
||||
if (stack.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
@ -1044,7 +1045,7 @@
|
||||
world.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2184,7 +2754,16 @@
|
||||
@@ -2184,7 +2756,16 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == player) {
|
||||
if (!this.level().isClientSide()) {
|
||||
@ -1062,7 +1063,7 @@
|
||||
leashable.removeLeash();
|
||||
} else {
|
||||
leashable.dropLeash();
|
||||
@@ -2200,6 +2779,13 @@
|
||||
@@ -2200,6 +2781,13 @@
|
||||
|
||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
@ -1076,7 +1077,7 @@
|
||||
leashable.setLeashedTo(player, true);
|
||||
}
|
||||
|
||||
@@ -2265,15 +2851,15 @@
|
||||
@@ -2265,15 +2853,15 @@
|
||||
}
|
||||
|
||||
public boolean showVehicleHealth() {
|
||||
@ -1095,7 +1096,7 @@
|
||||
return false;
|
||||
} else {
|
||||
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
||||
@@ -2285,11 +2871,32 @@
|
||||
@@ -2285,11 +2873,32 @@
|
||||
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
@ -1129,7 +1130,7 @@
|
||||
this.vehicle = entity;
|
||||
this.vehicle.addPassenger(this);
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
@@ -2314,19 +2921,30 @@
|
||||
@@ -2314,19 +2923,30 @@
|
||||
}
|
||||
|
||||
public void removeVehicle() {
|
||||
@ -1162,7 +1163,7 @@
|
||||
protected void addPassenger(Entity passenger) {
|
||||
if (passenger.getVehicle() != this) {
|
||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||
@@ -2349,21 +2967,53 @@
|
||||
@@ -2349,21 +2969,53 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -1222,7 +1223,7 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity passenger) {
|
||||
@@ -2464,7 +3114,7 @@
|
||||
@@ -2464,7 +3116,7 @@
|
||||
if (teleporttransition != null) {
|
||||
ServerLevel worldserver1 = teleporttransition.newLevel();
|
||||
|
||||
@ -1231,7 +1232,7 @@
|
||||
this.teleport(teleporttransition);
|
||||
}
|
||||
}
|
||||
@@ -2547,7 +3197,7 @@
|
||||
@@ -2547,7 +3199,7 @@
|
||||
}
|
||||
|
||||
public boolean isCrouching() {
|
||||
@ -1240,7 +1241,7 @@
|
||||
}
|
||||
|
||||
public boolean isSprinting() {
|
||||
@@ -2563,7 +3213,7 @@
|
||||
@@ -2563,7 +3215,7 @@
|
||||
}
|
||||
|
||||
public boolean isVisuallySwimming() {
|
||||
@ -1249,7 +1250,7 @@
|
||||
}
|
||||
|
||||
public boolean isVisuallyCrawling() {
|
||||
@@ -2571,6 +3221,13 @@
|
||||
@@ -2571,6 +3223,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean swimming) {
|
||||
@ -1263,7 +1264,7 @@
|
||||
this.setSharedFlag(4, swimming);
|
||||
}
|
||||
|
||||
@@ -2609,6 +3266,7 @@
|
||||
@@ -2609,6 +3268,7 @@
|
||||
|
||||
@Nullable
|
||||
public PlayerTeam getTeam() {
|
||||
@ -1271,7 +1272,7 @@
|
||||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||
}
|
||||
|
||||
@@ -2624,8 +3282,12 @@
|
||||
@@ -2624,8 +3284,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
||||
}
|
||||
|
||||
@ -1285,7 +1286,7 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int index) {
|
||||
@@ -2644,7 +3306,7 @@
|
||||
@@ -2644,7 +3308,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@ -1294,7 +1295,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2652,7 +3314,18 @@
|
||||
@@ -2652,7 +3316,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int air) {
|
||||
@ -1314,7 +1315,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2679,11 +3352,44 @@
|
||||
@@ -2679,11 +3354,44 @@
|
||||
|
||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@ -1361,7 +1362,7 @@
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean drag) {
|
||||
@@ -2713,7 +3419,7 @@
|
||||
@@ -2713,7 +3421,7 @@
|
||||
this.resetFallDistance();
|
||||
}
|
||||
|
||||
@ -1370,7 +1371,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2818,7 +3524,7 @@
|
||||
@@ -2818,7 +3526,7 @@
|
||||
public String toString() {
|
||||
String s = this.level() == null ? "~NULL~" : this.level().toString();
|
||||
|
||||
@ -1379,7 +1380,7 @@
|
||||
}
|
||||
|
||||
public final boolean isInvulnerableToBase(DamageSource damageSource) {
|
||||
@@ -2838,6 +3544,13 @@
|
||||
@@ -2838,6 +3546,13 @@
|
||||
}
|
||||
|
||||
public void restoreFrom(Entity original) {
|
||||
@ -1393,7 +1394,7 @@
|
||||
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
|
||||
|
||||
nbttagcompound.remove("Dimension");
|
||||
@@ -2850,8 +3563,57 @@
|
||||
@@ -2850,8 +3565,57 @@
|
||||
public Entity teleport(TeleportTransition teleportTarget) {
|
||||
Level world = this.level();
|
||||
|
||||
@ -1451,7 +1452,7 @@
|
||||
ServerLevel worldserver1 = teleportTarget.newLevel();
|
||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||
|
||||
@@ -2918,10 +3680,19 @@
|
||||
@@ -2918,10 +3682,19 @@
|
||||
gameprofilerfiller.pop();
|
||||
return null;
|
||||
} else {
|
||||
@ -1472,7 +1473,7 @@
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -2947,7 +3718,7 @@
|
||||
@@ -2947,7 +3720,7 @@
|
||||
}
|
||||
|
||||
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
||||
@ -1481,7 +1482,7 @@
|
||||
Iterator iterator = this.getIndirectPassengers().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -2995,9 +3766,17 @@
|
||||
@@ -2995,9 +3768,17 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
@ -1502,7 +1503,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3006,11 +3785,34 @@
|
||||
@@ -3006,11 +3787,34 @@
|
||||
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
@ -1537,7 +1538,7 @@
|
||||
if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) {
|
||||
Iterator iterator = this.getPassengers().iterator();
|
||||
|
||||
@@ -3134,10 +3936,16 @@
|
||||
@@ -3134,10 +3938,16 @@
|
||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
@ -1557,7 +1558,7 @@
|
||||
return entity != null;
|
||||
}
|
||||
|
||||
@@ -3187,7 +3995,7 @@
|
||||
@@ -3187,7 +3997,7 @@
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
protected void fixupDimensions() {
|
||||
@ -1566,7 +1567,7 @@
|
||||
EntityDimensions entitysize = this.getDimensions(entitypose);
|
||||
|
||||
this.dimensions = entitysize;
|
||||
@@ -3196,7 +4004,7 @@
|
||||
@@ -3196,7 +4006,7 @@
|
||||
|
||||
public void refreshDimensions() {
|
||||
EntityDimensions entitysize = this.dimensions;
|
||||
@ -1575,7 +1576,7 @@
|
||||
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
||||
|
||||
this.dimensions = entitysize1;
|
||||
@@ -3258,10 +4066,29 @@
|
||||
@@ -3258,10 +4068,29 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
@ -1607,7 +1608,7 @@
|
||||
return this.getDimensions(pose).eyeHeight();
|
||||
}
|
||||
|
||||
@@ -3300,7 +4127,14 @@
|
||||
@@ -3300,7 +4129,14 @@
|
||||
|
||||
public void startSeenByPlayer(ServerPlayer player) {}
|
||||
|
||||
@ -1623,7 +1624,7 @@
|
||||
|
||||
public float rotate(Rotation rotation) {
|
||||
float f = Mth.wrapDegrees(this.getYRot());
|
||||
@@ -3335,7 +4169,7 @@
|
||||
@@ -3335,7 +4171,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -1632,7 +1633,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3373,20 +4207,34 @@
|
||||
@@ -3373,20 +4209,34 @@
|
||||
}
|
||||
|
||||
private Stream<Entity> getIndirectPassengersStream() {
|
||||
@ -1667,7 +1668,7 @@
|
||||
return () -> {
|
||||
return this.getIndirectPassengersStream().iterator();
|
||||
};
|
||||
@@ -3399,6 +4247,7 @@
|
||||
@@ -3399,6 +4249,7 @@
|
||||
}
|
||||
|
||||
public boolean hasExactlyOnePlayerPassenger() {
|
||||
@ -1675,7 +1676,7 @@
|
||||
return this.countPlayerPassengers() == 1;
|
||||
}
|
||||
|
||||
@@ -3435,7 +4284,7 @@
|
||||
@@ -3435,7 +4286,7 @@
|
||||
}
|
||||
|
||||
public boolean isControlledByLocalInstance() {
|
||||
@ -1684,7 +1685,7 @@
|
||||
|
||||
if (entityliving instanceof Player entityhuman) {
|
||||
return entityhuman.isLocalPlayer();
|
||||
@@ -3445,7 +4294,7 @@
|
||||
@@ -3445,7 +4296,7 @@
|
||||
}
|
||||
|
||||
public boolean isControlledByClient() {
|
||||
@ -1693,7 +1694,7 @@
|
||||
|
||||
return entityliving != null && entityliving.isControlledByClient();
|
||||
}
|
||||
@@ -3463,7 +4312,7 @@
|
||||
@@ -3463,7 +4314,7 @@
|
||||
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
||||
}
|
||||
|
||||
@ -1702,7 +1703,7 @@
|
||||
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
||||
}
|
||||
|
||||
@@ -3489,8 +4338,37 @@
|
||||
@@ -3489,8 +4340,37 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1741,7 +1742,7 @@
|
||||
}
|
||||
|
||||
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
||||
@@ -3551,6 +4429,11 @@
|
||||
@@ -3551,6 +4431,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
@ -1753,7 +1754,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3613,7 +4496,7 @@
|
||||
@@ -3613,7 +4498,7 @@
|
||||
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
||||
}
|
||||
|
||||
@ -1762,7 +1763,7 @@
|
||||
return this.type.getDimensions();
|
||||
}
|
||||
|
||||
@@ -3714,7 +4597,39 @@
|
||||
@@ -3714,7 +4599,39 @@
|
||||
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
||||
}
|
||||
|
||||
@ -1802,7 +1803,7 @@
|
||||
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
||||
this.position = new Vec3(x, y, z);
|
||||
int i = Mth.floor(x);
|
||||
@@ -3732,6 +4647,12 @@
|
||||
@@ -3732,6 +4649,12 @@
|
||||
this.levelCallback.onMove();
|
||||
}
|
||||
|
||||
@ -1815,7 +1816,7 @@
|
||||
}
|
||||
|
||||
public void checkDespawn() {}
|
||||
@@ -3818,8 +4739,17 @@
|
||||
@@ -3818,8 +4741,17 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason reason) {
|
||||
@ -1834,7 +1835,7 @@
|
||||
}
|
||||
|
||||
if (this.removalReason.shouldDestroy()) {
|
||||
@@ -3827,14 +4757,30 @@
|
||||
@@ -3827,14 +4759,30 @@
|
||||
}
|
||||
|
||||
this.getPassengers().forEach(Entity::stopRiding);
|
||||
@ -1867,7 +1868,7 @@
|
||||
@Override
|
||||
public void setLevelCallback(EntityInLevelCallback changeListener) {
|
||||
this.levelCallback = changeListener;
|
||||
@@ -3887,7 +4833,7 @@
|
||||
@@ -3887,7 +4835,7 @@
|
||||
}
|
||||
|
||||
public Vec3 getKnownMovement() {
|
||||
@ -1876,7 +1877,7 @@
|
||||
|
||||
if (entityliving instanceof Player entityhuman) {
|
||||
if (this.isAlive()) {
|
||||
@@ -3962,4 +4908,14 @@
|
||||
@@ -3962,4 +4910,14 @@
|
||||
|
||||
void accept(Entity entity, double x, double y, double z);
|
||||
}
|
||||
|
@ -895,6 +895,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
public boolean isSneaking() {
|
||||
return this.getHandle().isShiftKeyDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPose(Pose pose, boolean fixed) {
|
||||
Preconditions.checkNotNull(pose, "Pose cannot be null");
|
||||
final Entity handle = this.getHandle();
|
||||
handle.fixedPose = false;
|
||||
handle.setPose(net.minecraft.world.entity.Pose.values()[pose.ordinal()]);
|
||||
handle.fixedPose = fixed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFixedPose() {
|
||||
return this.getHandle().fixedPose;
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user