geforkt von Mirrors/Paper
Entity#fromMobSpawner()
Dieser Commit ist enthalten in:
Ursprung
3edcdeaf22
Commit
760d9e300f
@ -168,7 +168,7 @@
|
|||||||
private static final EntityDataAccessor<Integer> DATA_TICKS_FROZEN = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT);
|
private static final EntityDataAccessor<Integer> DATA_TICKS_FROZEN = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT);
|
||||||
private EntityInLevelCallback levelCallback;
|
private EntityInLevelCallback levelCallback;
|
||||||
private final VecDeltaCodec packetPositionCodec;
|
private final VecDeltaCodec packetPositionCodec;
|
||||||
@@ -253,7 +384,63 @@
|
@@ -253,7 +384,64 @@
|
||||||
private final List<Entity.Movement> movementThisTick;
|
private final List<Entity.Movement> movementThisTick;
|
||||||
private final Set<BlockState> blocksInside;
|
private final Set<BlockState> blocksInside;
|
||||||
private final LongSet visitedBlocks;
|
private final LongSet visitedBlocks;
|
||||||
@ -194,17 +194,18 @@
|
|||||||
+ public void inactiveTick() { }
|
+ public void inactiveTick() { }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
+ protected int numCollisions = 0; // Paper - Cap entity collisions
|
+ protected int numCollisions = 0; // Paper - Cap entity collisions
|
||||||
|
+ public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
|
||||||
+ // Paper start - Entity origin API
|
+ // Paper start - Entity origin API
|
||||||
+ @javax.annotation.Nullable
|
+ @javax.annotation.Nullable
|
||||||
+ private org.bukkit.util.Vector origin;
|
+ private org.bukkit.util.Vector origin;
|
||||||
+ @javax.annotation.Nullable
|
+ @javax.annotation.Nullable
|
||||||
+ private UUID originWorld;
|
+ private UUID originWorld;
|
||||||
+
|
|
||||||
+ public void setOrigin(@javax.annotation.Nonnull Location location) {
|
+ public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||||
+ this.origin = location.toVector();
|
+ this.origin = location.toVector();
|
||||||
+ this.originWorld = location.getWorld().getUID();
|
+ this.originWorld = location.getWorld().getUID();
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ @javax.annotation.Nullable
|
+ @javax.annotation.Nullable
|
||||||
+ public org.bukkit.util.Vector getOriginVector() {
|
+ public org.bukkit.util.Vector getOriginVector() {
|
||||||
+ return this.origin != null ? this.origin.clone() : null;
|
+ return this.origin != null ? this.origin.clone() : null;
|
||||||
@ -232,7 +233,7 @@
|
|||||||
public Entity(EntityType<?> type, Level world) {
|
public Entity(EntityType<?> type, Level world) {
|
||||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||||
this.passengers = ImmutableList.of();
|
this.passengers = ImmutableList.of();
|
||||||
@@ -261,7 +448,7 @@
|
@@ -261,7 +449,7 @@
|
||||||
this.bb = Entity.INITIAL_AABB;
|
this.bb = Entity.INITIAL_AABB;
|
||||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||||
this.nextStep = 1.0F;
|
this.nextStep = 1.0F;
|
||||||
@ -241,7 +242,7 @@
|
|||||||
this.remainingFireTicks = -this.getFireImmuneTicks();
|
this.remainingFireTicks = -this.getFireImmuneTicks();
|
||||||
this.fluidHeight = new Object2DoubleArrayMap(2);
|
this.fluidHeight = new Object2DoubleArrayMap(2);
|
||||||
this.fluidOnEyes = new HashSet();
|
this.fluidOnEyes = new HashSet();
|
||||||
@@ -284,6 +471,13 @@
|
@@ -284,6 +472,13 @@
|
||||||
this.position = Vec3.ZERO;
|
this.position = Vec3.ZERO;
|
||||||
this.blockPosition = BlockPos.ZERO;
|
this.blockPosition = BlockPos.ZERO;
|
||||||
this.chunkPosition = ChunkPos.ZERO;
|
this.chunkPosition = ChunkPos.ZERO;
|
||||||
@ -255,7 +256,7 @@
|
|||||||
SynchedEntityData.Builder datawatcher_a = new SynchedEntityData.Builder(this);
|
SynchedEntityData.Builder datawatcher_a = new SynchedEntityData.Builder(this);
|
||||||
|
|
||||||
datawatcher_a.define(Entity.DATA_SHARED_FLAGS_ID, (byte) 0);
|
datawatcher_a.define(Entity.DATA_SHARED_FLAGS_ID, (byte) 0);
|
||||||
@@ -292,7 +486,7 @@
|
@@ -292,7 +487,7 @@
|
||||||
datawatcher_a.define(Entity.DATA_CUSTOM_NAME, Optional.empty());
|
datawatcher_a.define(Entity.DATA_CUSTOM_NAME, Optional.empty());
|
||||||
datawatcher_a.define(Entity.DATA_SILENT, false);
|
datawatcher_a.define(Entity.DATA_SILENT, false);
|
||||||
datawatcher_a.define(Entity.DATA_NO_GRAVITY, false);
|
datawatcher_a.define(Entity.DATA_NO_GRAVITY, false);
|
||||||
@ -264,7 +265,7 @@
|
|||||||
datawatcher_a.define(Entity.DATA_TICKS_FROZEN, 0);
|
datawatcher_a.define(Entity.DATA_TICKS_FROZEN, 0);
|
||||||
this.defineSynchedData(datawatcher_a);
|
this.defineSynchedData(datawatcher_a);
|
||||||
this.entityData = datawatcher_a.build();
|
this.entityData = datawatcher_a.build();
|
||||||
@@ -362,20 +556,36 @@
|
@@ -362,19 +557,35 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kill(ServerLevel world) {
|
public void kill(ServerLevel world) {
|
||||||
@ -288,8 +289,8 @@
|
|||||||
|
|
||||||
public SynchedEntityData getEntityData() {
|
public SynchedEntityData getEntityData() {
|
||||||
return this.entityData;
|
return this.entityData;
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public void refreshEntityData(ServerPlayer to) {
|
+ public void refreshEntityData(ServerPlayer to) {
|
||||||
+ List<SynchedEntityData.DataValue<?>> list = this.getEntityData().getNonDefaultValues();
|
+ List<SynchedEntityData.DataValue<?>> list = this.getEntityData().getNonDefaultValues();
|
||||||
@ -297,13 +298,12 @@
|
|||||||
+ if (list != null) {
|
+ if (list != null) {
|
||||||
+ to.connection.send(new ClientboundSetEntityDataPacket(this.getId(), list));
|
+ to.connection.send(new ClientboundSetEntityDataPacket(this.getId(), list));
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||||
}
|
@@ -385,22 +596,34 @@
|
||||||
@@ -385,22 +595,34 @@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Entity.RemovalReason reason) {
|
public void remove(Entity.RemovalReason reason) {
|
||||||
@ -343,7 +343,7 @@
|
|||||||
return this.getPose() == pose;
|
return this.getPose() == pose;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,6 +639,33 @@
|
@@ -417,6 +640,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRot(float yaw, float pitch) {
|
public void setRot(float yaw, float pitch) {
|
||||||
@ -377,24 +377,23 @@
|
|||||||
this.setYRot(yaw % 360.0F);
|
this.setYRot(yaw % 360.0F);
|
||||||
this.setXRot(pitch % 360.0F);
|
this.setXRot(pitch % 360.0F);
|
||||||
}
|
}
|
||||||
@@ -460,7 +709,16 @@
|
@@ -462,6 +712,15 @@
|
||||||
|
|
||||||
public void tick() {
|
|
||||||
this.baseTick();
|
this.baseTick();
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public void postTick() {
|
+ 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
|
+ // 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)) {
|
+ if (!(this instanceof ServerPlayer)) {
|
||||||
+ this.handlePortal();
|
+ this.handlePortal();
|
||||||
+ }
|
+ }
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
public void baseTick() {
|
public void baseTick() {
|
||||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||||
@@ -475,7 +733,7 @@
|
|
||||||
|
@@ -475,7 +734,7 @@
|
||||||
--this.boardingCooldown;
|
--this.boardingCooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +402,7 @@
|
|||||||
if (this.canSpawnSprintParticle()) {
|
if (this.canSpawnSprintParticle()) {
|
||||||
this.spawnSprintParticle();
|
this.spawnSprintParticle();
|
||||||
}
|
}
|
||||||
@@ -514,6 +772,10 @@
|
@@ -514,6 +773,10 @@
|
||||||
if (this.isInLava()) {
|
if (this.isInLava()) {
|
||||||
this.lavaHurt();
|
this.lavaHurt();
|
||||||
this.fallDistance *= 0.5F;
|
this.fallDistance *= 0.5F;
|
||||||
@ -414,7 +413,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.checkBelowWorld();
|
this.checkBelowWorld();
|
||||||
@@ -525,7 +787,7 @@
|
@@ -525,7 +788,7 @@
|
||||||
world = this.level();
|
world = this.level();
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
if (this instanceof Leashable) {
|
if (this instanceof Leashable) {
|
||||||
@ -423,7 +422,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +799,11 @@
|
@@ -537,7 +800,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkBelowWorld() {
|
public void checkBelowWorld() {
|
||||||
@ -436,7 +435,7 @@
|
|||||||
this.onBelowWorld();
|
this.onBelowWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,15 +834,32 @@
|
@@ -568,15 +835,32 @@
|
||||||
|
|
||||||
public void lavaHurt() {
|
public void lavaHurt() {
|
||||||
if (!this.fireImmune()) {
|
if (!this.fireImmune()) {
|
||||||
@ -471,15 +470,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -587,9 +870,25 @@
|
@@ -587,7 +871,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void igniteForSeconds(float seconds) {
|
public final void igniteForSeconds(float seconds) {
|
||||||
- this.igniteForTicks(Mth.floor(seconds * 20.0F));
|
- this.igniteForTicks(Mth.floor(seconds * 20.0F));
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ this.igniteForSeconds(seconds, true);
|
+ this.igniteForSeconds(seconds, true);
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ public final void igniteForSeconds(float f, boolean callEvent) {
|
+ public final void igniteForSeconds(float f, boolean callEvent) {
|
||||||
+ if (callEvent) {
|
+ if (callEvent) {
|
||||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), f);
|
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), f);
|
||||||
@ -493,12 +492,10 @@
|
|||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ this.igniteForTicks(Mth.floor(f * 20.0F));
|
+ this.igniteForTicks(Mth.floor(f * 20.0F));
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
public void igniteForTicks(int ticks) {
|
public void igniteForTicks(int ticks) {
|
||||||
if (this.remainingFireTicks < ticks) {
|
@@ -610,7 +910,7 @@
|
||||||
this.setRemainingFireTicks(ticks);
|
|
||||||
@@ -610,7 +909,7 @@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onBelowWorld() {
|
protected void onBelowWorld() {
|
||||||
@ -507,7 +504,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
||||||
@@ -750,6 +1049,28 @@
|
@@ -750,6 +1050,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +533,7 @@
|
|||||||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||||
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
||||||
|
|
||||||
@@ -1133,6 +1454,20 @@
|
@@ -1133,6 +1455,20 @@
|
||||||
return SoundEvents.GENERIC_SPLASH;
|
return SoundEvents.GENERIC_SPLASH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,7 +554,7 @@
|
|||||||
public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) {
|
public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) {
|
||||||
this.movementThisTick.add(new Entity.Movement(oldPos, newPos));
|
this.movementThisTick.add(new Entity.Movement(oldPos, newPos));
|
||||||
}
|
}
|
||||||
@@ -1609,6 +1944,7 @@
|
@@ -1609,6 +1945,7 @@
|
||||||
this.yo = y;
|
this.yo = y;
|
||||||
this.zo = d4;
|
this.zo = d4;
|
||||||
this.setPos(d3, y, d4);
|
this.setPos(d3, y, d4);
|
||||||
@ -565,7 +562,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void moveTo(Vec3 pos) {
|
public void moveTo(Vec3 pos) {
|
||||||
@@ -1861,6 +2197,12 @@
|
@@ -1861,6 +2198,12 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +575,7 @@
|
|||||||
public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
|
public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
|
||||||
if (entityKilled instanceof ServerPlayer) {
|
if (entityKilled instanceof ServerPlayer) {
|
||||||
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
|
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
|
||||||
@@ -1889,16 +2231,22 @@
|
@@ -1889,16 +2232,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveAsPassenger(CompoundTag nbt) {
|
public boolean saveAsPassenger(CompoundTag nbt) {
|
||||||
@ -604,7 +601,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1909,54 +2257,98 @@
|
@@ -1909,54 +2258,98 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag saveWithoutId(CompoundTag nbt) {
|
public CompoundTag saveWithoutId(CompoundTag nbt) {
|
||||||
@ -723,7 +720,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListTag nbttaglist;
|
ListTag nbttaglist;
|
||||||
@@ -1972,10 +2364,10 @@
|
@@ -1972,10 +2365,10 @@
|
||||||
nbttaglist.add(StringTag.valueOf(s));
|
nbttaglist.add(StringTag.valueOf(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +733,7 @@
|
|||||||
if (this.isVehicle()) {
|
if (this.isVehicle()) {
|
||||||
nbttaglist = new ListTag();
|
nbttaglist = new ListTag();
|
||||||
iterator = this.getPassengers().iterator();
|
iterator = this.getPassengers().iterator();
|
||||||
@@ -1984,17 +2376,31 @@
|
@@ -1984,17 +2377,35 @@
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
CompoundTag nbttagcompound1 = new CompoundTag();
|
CompoundTag nbttagcompound1 = new CompoundTag();
|
||||||
|
|
||||||
@ -766,15 +763,20 @@
|
|||||||
+ }
|
+ }
|
||||||
+ nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
|
+ nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
|
||||||
+ }
|
+ }
|
||||||
|
+ // Save entity's from mob spawner status
|
||||||
|
+ if (spawnedViaMobSpawner) {
|
||||||
|
+ nbttagcompound.putBoolean("Paper.FromMobSpawner", true);
|
||||||
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+ return nbttagcompound;
|
+ return nbttagcompound;
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
||||||
@@ -2080,6 +2486,64 @@
|
@@ -2079,7 +2490,67 @@
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Entity has invalid position");
|
throw new IllegalStateException("Entity has invalid position");
|
||||||
}
|
+ }
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ // Spigot start
|
+ // Spigot start
|
||||||
@ -830,13 +832,15 @@
|
|||||||
+ }
|
+ }
|
||||||
+ this.originWorld = originWorld;
|
+ this.originWorld = originWorld;
|
||||||
+ origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
|
+ origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
|
||||||
+ }
|
}
|
||||||
|
+
|
||||||
|
+ spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||||
@@ -2101,6 +2565,12 @@
|
@@ -2101,6 +2572,12 @@
|
||||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -849,7 +853,7 @@
|
|||||||
protected abstract void readAdditionalSaveData(CompoundTag nbt);
|
protected abstract void readAdditionalSaveData(CompoundTag nbt);
|
||||||
|
|
||||||
protected abstract void addAdditionalSaveData(CompoundTag nbt);
|
protected abstract void addAdditionalSaveData(CompoundTag nbt);
|
||||||
@@ -2153,9 +2623,22 @@
|
@@ -2153,9 +2630,22 @@
|
||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -872,7 +876,7 @@
|
|||||||
world.addFreshEntity(entityitem);
|
world.addFreshEntity(entityitem);
|
||||||
return entityitem;
|
return entityitem;
|
||||||
}
|
}
|
||||||
@@ -2184,6 +2667,12 @@
|
@@ -2184,6 +2674,12 @@
|
||||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||||
if (leashable.getLeashHolder() == player) {
|
if (leashable.getLeashHolder() == player) {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
@ -885,7 +889,7 @@
|
|||||||
if (player.hasInfiniteMaterials()) {
|
if (player.hasInfiniteMaterials()) {
|
||||||
leashable.removeLeash();
|
leashable.removeLeash();
|
||||||
} else {
|
} else {
|
||||||
@@ -2200,6 +2689,13 @@
|
@@ -2200,6 +2696,13 @@
|
||||||
|
|
||||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
@ -899,7 +903,7 @@
|
|||||||
leashable.setLeashedTo(player, true);
|
leashable.setLeashedTo(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2265,7 +2761,7 @@
|
@@ -2265,7 +2768,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean showVehicleHealth() {
|
public boolean showVehicleHealth() {
|
||||||
@ -908,7 +912,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean startRiding(Entity entity, boolean force) {
|
public boolean startRiding(Entity entity, boolean force) {
|
||||||
@@ -2273,7 +2769,7 @@
|
@@ -2273,7 +2776,7 @@
|
||||||
return false;
|
return false;
|
||||||
} else if (!entity.couldAcceptPassenger()) {
|
} else if (!entity.couldAcceptPassenger()) {
|
||||||
return false;
|
return false;
|
||||||
@ -917,7 +921,7 @@
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
||||||
@@ -2285,11 +2781,32 @@
|
@@ -2285,11 +2788,32 @@
|
||||||
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -951,7 +955,7 @@
|
|||||||
this.vehicle = entity;
|
this.vehicle = entity;
|
||||||
this.vehicle.addPassenger(this);
|
this.vehicle.addPassenger(this);
|
||||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||||
@@ -2318,7 +2835,7 @@
|
@@ -2318,7 +2842,7 @@
|
||||||
Entity entity = this.vehicle;
|
Entity entity = this.vehicle;
|
||||||
|
|
||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
@ -960,7 +964,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2349,21 +2866,50 @@
|
@@ -2349,21 +2873,50 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,7 +1021,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canAddPassenger(Entity passenger) {
|
protected boolean canAddPassenger(Entity passenger) {
|
||||||
@@ -2464,7 +3010,7 @@
|
@@ -2464,7 +3017,7 @@
|
||||||
if (teleporttransition != null) {
|
if (teleporttransition != null) {
|
||||||
ServerLevel worldserver1 = teleporttransition.newLevel();
|
ServerLevel worldserver1 = teleporttransition.newLevel();
|
||||||
|
|
||||||
@ -1026,7 +1030,7 @@
|
|||||||
this.teleport(teleporttransition);
|
this.teleport(teleporttransition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2547,7 +3093,7 @@
|
@@ -2547,7 +3100,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCrouching() {
|
public boolean isCrouching() {
|
||||||
@ -1035,7 +1039,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSprinting() {
|
public boolean isSprinting() {
|
||||||
@@ -2563,7 +3109,7 @@
|
@@ -2563,7 +3116,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisuallySwimming() {
|
public boolean isVisuallySwimming() {
|
||||||
@ -1044,7 +1048,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisuallyCrawling() {
|
public boolean isVisuallyCrawling() {
|
||||||
@@ -2571,6 +3117,13 @@
|
@@ -2571,6 +3124,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean swimming) {
|
public void setSwimming(boolean swimming) {
|
||||||
@ -1058,7 +1062,7 @@
|
|||||||
this.setSharedFlag(4, swimming);
|
this.setSharedFlag(4, swimming);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2609,6 +3162,7 @@
|
@@ -2609,6 +3169,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public PlayerTeam getTeam() {
|
public PlayerTeam getTeam() {
|
||||||
@ -1066,7 +1070,7 @@
|
|||||||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2624,8 +3178,12 @@
|
@@ -2624,8 +3185,12 @@
|
||||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,7 +1084,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSharedFlag(int index) {
|
public boolean getSharedFlag(int index) {
|
||||||
@@ -2644,7 +3202,7 @@
|
@@ -2644,7 +3209,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxAirSupply() {
|
public int getMaxAirSupply() {
|
||||||
@ -1089,7 +1093,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getAirSupply() {
|
public int getAirSupply() {
|
||||||
@@ -2652,7 +3210,18 @@
|
@@ -2652,7 +3217,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirSupply(int air) {
|
public void setAirSupply(int air) {
|
||||||
@ -1109,7 +1113,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getTicksFrozen() {
|
public int getTicksFrozen() {
|
||||||
@@ -2679,11 +3248,40 @@
|
@@ -2679,11 +3255,40 @@
|
||||||
|
|
||||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||||
@ -1152,7 +1156,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onAboveBubbleCol(boolean drag) {
|
public void onAboveBubbleCol(boolean drag) {
|
||||||
@@ -2713,7 +3311,7 @@
|
@@ -2713,7 +3318,7 @@
|
||||||
this.resetFallDistance();
|
this.resetFallDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,7 +1165,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2852,6 +3450,18 @@
|
@@ -2852,6 +3457,18 @@
|
||||||
|
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
if (!this.isRemoved()) {
|
if (!this.isRemoved()) {
|
||||||
@ -1180,7 +1184,7 @@
|
|||||||
ServerLevel worldserver1 = teleportTarget.newLevel();
|
ServerLevel worldserver1 = teleportTarget.newLevel();
|
||||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||||
|
|
||||||
@@ -2920,8 +3530,12 @@
|
@@ -2920,8 +3537,12 @@
|
||||||
} else {
|
} else {
|
||||||
entity.restoreFrom(this);
|
entity.restoreFrom(this);
|
||||||
this.removeAfterChangingDimensions();
|
this.removeAfterChangingDimensions();
|
||||||
@ -1194,7 +1198,7 @@
|
|||||||
Iterator iterator1 = list1.iterator();
|
Iterator iterator1 = list1.iterator();
|
||||||
|
|
||||||
while (iterator1.hasNext()) {
|
while (iterator1.hasNext()) {
|
||||||
@@ -2947,7 +3561,7 @@
|
@@ -2947,7 +3568,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
||||||
@ -1203,7 +1207,7 @@
|
|||||||
Iterator iterator = this.getIndirectPassengers().iterator();
|
Iterator iterator = this.getIndirectPassengers().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -2995,8 +3609,9 @@
|
@@ -2995,8 +3616,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeAfterChangingDimensions() {
|
protected void removeAfterChangingDimensions() {
|
||||||
@ -1214,12 +1218,10 @@
|
|||||||
leashable.removeLeash();
|
leashable.removeLeash();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3004,7 +3619,21 @@
|
@@ -3006,6 +3628,20 @@
|
||||||
|
|
||||||
public Vec3 getRelativePortalPosition(Direction.Axis portalAxis, BlockUtil.FoundRectangle portalRect) {
|
|
||||||
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||||
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||||
@ -1231,12 +1233,13 @@
|
|||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ return new CraftPortalEvent(event);
|
+ return new CraftPortalEvent(event);
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
public boolean canUsePortal(boolean allowVehicles) {
|
public boolean canUsePortal(boolean allowVehicles) {
|
||||||
return (allowVehicles || !this.isPassenger()) && this.isAlive();
|
return (allowVehicles || !this.isPassenger()) && this.isAlive();
|
||||||
@@ -3134,9 +3763,15 @@
|
}
|
||||||
|
@@ -3134,9 +3770,15 @@
|
||||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,7 +1258,7 @@
|
|||||||
|
|
||||||
return entity != null;
|
return entity != null;
|
||||||
}
|
}
|
||||||
@@ -3187,7 +3822,7 @@
|
@@ -3187,7 +3829,7 @@
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected void fixupDimensions() {
|
protected void fixupDimensions() {
|
||||||
@ -1264,7 +1267,7 @@
|
|||||||
EntityDimensions entitysize = this.getDimensions(entitypose);
|
EntityDimensions entitysize = this.getDimensions(entitypose);
|
||||||
|
|
||||||
this.dimensions = entitysize;
|
this.dimensions = entitysize;
|
||||||
@@ -3196,7 +3831,7 @@
|
@@ -3196,7 +3838,7 @@
|
||||||
|
|
||||||
public void refreshDimensions() {
|
public void refreshDimensions() {
|
||||||
EntityDimensions entitysize = this.dimensions;
|
EntityDimensions entitysize = this.dimensions;
|
||||||
@ -1273,7 +1276,7 @@
|
|||||||
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
||||||
|
|
||||||
this.dimensions = entitysize1;
|
this.dimensions = entitysize1;
|
||||||
@@ -3258,10 +3893,29 @@
|
@@ -3258,10 +3900,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setBoundingBox(AABB boundingBox) {
|
public final void setBoundingBox(AABB boundingBox) {
|
||||||
@ -1305,7 +1308,7 @@
|
|||||||
return this.getDimensions(pose).eyeHeight();
|
return this.getDimensions(pose).eyeHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3335,7 +3989,7 @@
|
@@ -3335,7 +3996,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -1314,7 +1317,7 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3435,7 +4089,7 @@
|
@@ -3435,7 +4096,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isControlledByLocalInstance() {
|
public boolean isControlledByLocalInstance() {
|
||||||
@ -1323,7 +1326,7 @@
|
|||||||
|
|
||||||
if (entityliving instanceof Player entityhuman) {
|
if (entityliving instanceof Player entityhuman) {
|
||||||
return entityhuman.isLocalPlayer();
|
return entityhuman.isLocalPlayer();
|
||||||
@@ -3445,7 +4099,7 @@
|
@@ -3445,7 +4106,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isControlledByClient() {
|
public boolean isControlledByClient() {
|
||||||
@ -1332,7 +1335,7 @@
|
|||||||
|
|
||||||
return entityliving != null && entityliving.isControlledByClient();
|
return entityliving != null && entityliving.isControlledByClient();
|
||||||
}
|
}
|
||||||
@@ -3463,7 +4117,7 @@
|
@@ -3463,7 +4124,7 @@
|
||||||
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1341,14 +1344,13 @@
|
|||||||
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3488,9 +4142,38 @@
|
@@ -3489,8 +4150,37 @@
|
||||||
public int getFireImmuneTicks() {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ private final CommandSource commandSource = new CommandSource() {
|
+ private final CommandSource commandSource = new CommandSource() {
|
||||||
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void sendSystemMessage(Component message) {
|
+ public void sendSystemMessage(Component message) {
|
||||||
+ }
|
+ }
|
||||||
@ -1381,7 +1383,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
||||||
@@ -3550,7 +4233,12 @@
|
@@ -3550,7 +4240,12 @@
|
||||||
|
|
||||||
vec3d = vec3d.add(vec3d1);
|
vec3d = vec3d.add(vec3d1);
|
||||||
++k1;
|
++k1;
|
||||||
@ -1394,7 +1396,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3613,7 +4301,7 @@
|
@@ -3613,7 +4308,7 @@
|
||||||
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1403,7 +1405,7 @@
|
|||||||
return this.type.getDimensions();
|
return this.type.getDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3818,8 +4506,16 @@
|
@@ -3818,8 +4513,16 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setRemoved(Entity.RemovalReason reason) {
|
public final void setRemoved(Entity.RemovalReason reason) {
|
||||||
@ -1421,7 +1423,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.removalReason.shouldDestroy()) {
|
if (this.removalReason.shouldDestroy()) {
|
||||||
@@ -3827,8 +4523,8 @@
|
@@ -3827,8 +4530,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getPassengers().forEach(Entity::stopRiding);
|
this.getPassengers().forEach(Entity::stopRiding);
|
||||||
@ -1432,7 +1434,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unsetRemoved() {
|
public void unsetRemoved() {
|
||||||
@@ -3887,7 +4583,7 @@
|
@@ -3887,7 +4590,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3 getKnownMovement() {
|
public Vec3 getKnownMovement() {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
} else {
|
} else {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
RandomSource randomsource = world.getRandom();
|
RandomSource randomsource = world.getRandom();
|
||||||
@@ -157,13 +164,24 @@
|
@@ -157,13 +164,25 @@
|
||||||
((Mob) entity).finalizeSpawn(world, world.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, (SpawnGroupData) null);
|
((Mob) entity).finalizeSpawn(world, world.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, (SpawnGroupData) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- if (!world.tryAddFreshEntityWithPassengers(entity)) {
|
- if (!world.tryAddFreshEntityWithPassengers(entity)) {
|
||||||
|
+ entity.spawnedViaMobSpawner = true; // Paper
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
||||||
+ continue;
|
+ continue;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
public final class TrialSpawner {
|
public final class TrialSpawner {
|
||||||
|
|
||||||
@@ -219,14 +224,19 @@
|
@@ -219,13 +224,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
entityinsentient.setPersistenceRequired();
|
entityinsentient.setPersistenceRequired();
|
||||||
@ -24,17 +24,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- if (!world.tryAddFreshEntityWithPassengers(entity)) {
|
- if (!world.tryAddFreshEntityWithPassengers(entity)) {
|
||||||
|
+ entity.spawnedViaMobSpawner = true; // Paper
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callTrialSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callTrialSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
||||||
return Optional.empty();
|
+ return Optional.empty();
|
||||||
+ }
|
+ }
|
||||||
+ if (!world.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRIAL_SPAWNER)) {
|
+ if (!world.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRIAL_SPAWNER)) {
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ return Optional.empty();
|
return Optional.empty();
|
||||||
} else {
|
} else {
|
||||||
TrialSpawner.FlameParticle trialspawner_a = this.isOminous ? TrialSpawner.FlameParticle.OMINOUS : TrialSpawner.FlameParticle.NORMAL;
|
TrialSpawner.FlameParticle trialspawner_a = this.isOminous ? TrialSpawner.FlameParticle.OMINOUS : TrialSpawner.FlameParticle.NORMAL;
|
||||||
|
@@ -248,6 +259,15 @@
|
||||||
@@ -248,6 +258,15 @@
|
|
||||||
ObjectArrayList<ItemStack> objectarraylist = loottable.getRandomItems(lootparams);
|
ObjectArrayList<ItemStack> objectarraylist = loottable.getRandomItems(lootparams);
|
||||||
|
|
||||||
if (!objectarraylist.isEmpty()) {
|
if (!objectarraylist.isEmpty()) {
|
||||||
|
@ -1011,4 +1011,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
return originVector.toLocation(world);
|
return originVector.toLocation(world);
|
||||||
}
|
}
|
||||||
// Paper end - entity origin API
|
// Paper end - entity origin API
|
||||||
|
|
||||||
|
// Paper start - Entity#fromMobSpawner
|
||||||
|
@Override
|
||||||
|
public boolean fromMobSpawner() {
|
||||||
|
return this.getHandle().spawnedViaMobSpawner;
|
||||||
|
}
|
||||||
|
// Paper end - Entity#fromMobSpawner
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren