mirror of
https://github.com/PaperMC/Paper.git
synced 2025-04-29 07:04:51 +02:00
Configurable Entity Despawn Time
This commit is contained in:
parent
7294ae3022
commit
b2d8133382
1 changed files with 109 additions and 99 deletions
|
@ -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
|
||||
|
@ -99,7 +99,7 @@
|
|||
+ public int next(int bits) {
|
||||
+ return super.next(bits);
|
||||
+ }
|
||||
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt(int origin, int bound) {
|
||||
+ return net.minecraft.world.level.levelgen.BitRandomSource.super.nextInt(origin, bound);
|
||||
|
@ -181,7 +181,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,68 @@
|
||||
@@ -253,15 +397,78 @@
|
||||
private final List<Entity.Movement> movementThisTick;
|
||||
private final Set<BlockState> blocksInside;
|
||||
private final LongSet visitedBlocks;
|
||||
|
@ -217,6 +217,7 @@
|
|||
+ private UUID originWorld;
|
||||
+ public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
+ public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
+ private final int despawnTime; // Paper - entity despawn time limit
|
||||
|
||||
+ public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
+ this.origin = location.toVector();
|
||||
|
@ -249,8 +250,9 @@
|
|||
+
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
+ this.despawnTime = type == EntityType.PLAYER ? -1 : world.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit
|
||||
this.passengers = ImmutableList.of();
|
||||
@@ -261,7 +466,7 @@
|
||||
this.deltaMovement = Vec3.ZERO;
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
|
@ -259,7 +261,7 @@
|
|||
this.remainingFireTicks = -this.getFireImmuneTicks();
|
||||
this.fluidHeight = new Object2DoubleArrayMap(2);
|
||||
this.fluidOnEyes = new HashSet();
|
||||
@@ -284,6 +489,13 @@
|
||||
@@ -284,6 +491,13 @@
|
||||
this.position = Vec3.ZERO;
|
||||
this.blockPosition = BlockPos.ZERO;
|
||||
this.chunkPosition = ChunkPos.ZERO;
|
||||
|
@ -273,7 +275,7 @@
|
|||
SynchedEntityData.Builder datawatcher_a = new SynchedEntityData.Builder(this);
|
||||
|
||||
datawatcher_a.define(Entity.DATA_SHARED_FLAGS_ID, (byte) 0);
|
||||
@@ -292,7 +504,7 @@
|
||||
@@ -292,7 +506,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);
|
||||
|
@ -282,7 +284,7 @@
|
|||
datawatcher_a.define(Entity.DATA_TICKS_FROZEN, 0);
|
||||
this.defineSynchedData(datawatcher_a);
|
||||
this.entityData = datawatcher_a.build();
|
||||
@@ -362,20 +574,36 @@
|
||||
@@ -362,12 +576,18 @@
|
||||
}
|
||||
|
||||
public void kill(ServerLevel world) {
|
||||
|
@ -295,16 +297,15 @@
|
|||
- this.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.discard(null);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public final void discard(EntityRemoveEvent.Cause cause) {
|
||||
+ this.remove(Entity.RemovalReason.DISCARDED, cause);
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
protected abstract void defineSynchedData(SynchedEntityData.Builder builder);
|
||||
}
|
||||
|
||||
public SynchedEntityData getEntityData() {
|
||||
protected abstract void defineSynchedData(SynchedEntityData.Builder builder);
|
||||
@@ -376,6 +596,16 @@
|
||||
return this.entityData;
|
||||
}
|
||||
|
||||
|
@ -321,7 +322,7 @@
|
|||
public boolean equals(Object object) {
|
||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||
}
|
||||
@@ -385,22 +613,39 @@
|
||||
@@ -385,22 +615,39 @@
|
||||
}
|
||||
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
|
@ -366,7 +367,7 @@
|
|||
return this.getPose() == pose;
|
||||
}
|
||||
|
||||
@@ -417,6 +662,33 @@
|
||||
@@ -417,6 +664,33 @@
|
||||
}
|
||||
|
||||
public void setRot(float yaw, float pitch) {
|
||||
|
@ -400,7 +401,7 @@
|
|||
this.setYRot(yaw % 360.0F);
|
||||
this.setXRot(pitch % 360.0F);
|
||||
}
|
||||
@@ -426,8 +698,8 @@
|
||||
@@ -426,8 +700,8 @@
|
||||
}
|
||||
|
||||
public void setPos(double x, double y, double z) {
|
||||
|
@ -411,7 +412,16 @@
|
|||
}
|
||||
|
||||
protected final AABB makeBoundingBox() {
|
||||
@@ -462,10 +734,20 @@
|
||||
@@ -459,13 +733,29 @@
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
+ // Paper start - entity despawn time limit
|
||||
+ if (this.despawnTime >= 0 && this.tickCount >= this.despawnTime) {
|
||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - entity despawn time limit
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
|
@ -432,7 +442,7 @@
|
|||
this.inBlockState = null;
|
||||
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
||||
this.stopRiding();
|
||||
@@ -475,7 +757,7 @@
|
||||
@@ -475,7 +765,7 @@
|
||||
--this.boardingCooldown;
|
||||
}
|
||||
|
||||
|
@ -441,7 +451,7 @@
|
|||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -502,7 +784,7 @@
|
||||
@@ -502,7 +792,7 @@
|
||||
this.setRemainingFireTicks(this.remainingFireTicks - 1);
|
||||
}
|
||||
|
||||
|
@ -450,7 +460,7 @@
|
|||
this.setTicksFrozen(0);
|
||||
this.level().levelEvent((Player) null, 1009, this.blockPosition, 1);
|
||||
}
|
||||
@@ -514,6 +796,10 @@
|
||||
@@ -514,6 +804,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
|
@ -461,7 +471,7 @@
|
|||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -525,7 +811,7 @@
|
||||
@@ -525,7 +819,7 @@
|
||||
world = this.level();
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
if (this instanceof Leashable) {
|
||||
|
@ -470,7 +480,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -537,7 +823,12 @@
|
||||
@@ -537,7 +831,12 @@
|
||||
}
|
||||
|
||||
public void checkBelowWorld() {
|
||||
|
@ -484,7 +494,7 @@
|
|||
this.onBelowWorld();
|
||||
}
|
||||
|
||||
@@ -568,15 +859,32 @@
|
||||
@@ -568,15 +867,32 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
|
@ -519,7 +529,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -587,9 +895,25 @@
|
||||
@@ -587,9 +903,25 @@
|
||||
}
|
||||
|
||||
public final void igniteForSeconds(float seconds) {
|
||||
|
@ -546,7 +556,7 @@
|
|||
public void igniteForTicks(int ticks) {
|
||||
if (this.remainingFireTicks < ticks) {
|
||||
this.setRemainingFireTicks(ticks);
|
||||
@@ -610,7 +934,7 @@
|
||||
@@ -610,7 +942,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
|
@ -555,7 +565,7 @@
|
|||
}
|
||||
|
||||
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
||||
@@ -672,6 +996,7 @@
|
||||
@@ -672,6 +1004,7 @@
|
||||
}
|
||||
|
||||
public void move(MoverType type, Vec3 movement) {
|
||||
|
@ -563,13 +573,10 @@
|
|||
if (this.noPhysics) {
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
@@ -747,8 +1072,30 @@
|
||||
@@ -750,6 +1083,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (movement.y != vec3d1.y) {
|
||||
block.updateEntityMovementAfterFallOn(this.level(), this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) {
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
|
@ -583,18 +590,19 @@
|
|||
+ bl = bl.getRelative(BlockFace.SOUTH);
|
||||
+ } else if (movement.z < vec3d1.z) {
|
||||
+ bl = bl.getRelative(BlockFace.NORTH);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ 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 +1260,7 @@
|
||||
|
||||
@@ -913,7 +1268,7 @@
|
||||
}
|
||||
|
||||
protected BlockPos getOnPos(float offset) {
|
||||
|
@ -603,10 +611,12 @@
|
|||
BlockPos blockposition = (BlockPos) this.mainSupportingBlockPos.get();
|
||||
|
||||
if (offset <= 1.0E-5F) {
|
||||
@@ -1133,6 +1480,20 @@
|
||||
return SoundEvents.GENERIC_SPLASH;
|
||||
}
|
||||
@@ -1131,7 +1486,21 @@
|
||||
|
||||
protected SoundEvent getSwimHighSpeedSplashSound() {
|
||||
return SoundEvents.GENERIC_SPLASH;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - Add delegate methods
|
||||
+ public SoundEvent getSwimSound0() {
|
||||
+ return this.getSwimSound();
|
||||
|
@ -618,13 +628,12 @@
|
|||
+
|
||||
+ public SoundEvent getSwimHighSpeedSplashSound0() {
|
||||
+ return this.getSwimHighSpeedSplashSound();
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) {
|
||||
this.movementThisTick.add(new Entity.Movement(oldPos, newPos));
|
||||
}
|
||||
@@ -1599,6 +1960,7 @@
|
||||
@@ -1599,6 +1968,7 @@
|
||||
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
|
||||
this.yRotO = this.getYRot();
|
||||
this.xRotO = this.getXRot();
|
||||
|
@ -632,7 +641,7 @@
|
|||
}
|
||||
|
||||
public void absMoveTo(double x, double y, double z) {
|
||||
@@ -1609,6 +1971,7 @@
|
||||
@@ -1609,6 +1979,7 @@
|
||||
this.yo = y;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, y, d4);
|
||||
|
@ -640,7 +649,7 @@
|
|||
}
|
||||
|
||||
public void moveTo(Vec3 pos) {
|
||||
@@ -1628,11 +1991,19 @@
|
||||
@@ -1628,11 +1999,19 @@
|
||||
}
|
||||
|
||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
||||
|
@ -660,7 +669,7 @@
|
|||
}
|
||||
|
||||
public final void setOldPosAndRot() {
|
||||
@@ -1701,6 +2072,7 @@
|
||||
@@ -1701,6 +2080,7 @@
|
||||
public void push(Entity entity) {
|
||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
|
@ -668,7 +677,7 @@
|
|||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = Mth.absMax(d0, d1);
|
||||
@@ -1737,7 +2109,21 @@
|
||||
@@ -1737,7 +2117,21 @@
|
||||
}
|
||||
|
||||
public void push(double deltaX, double deltaY, double deltaZ) {
|
||||
|
@ -691,7 +700,7 @@
|
|||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -1858,9 +2244,21 @@
|
||||
@@ -1858,9 +2252,21 @@
|
||||
}
|
||||
|
||||
public boolean isPushable() {
|
||||
|
@ -713,7 +722,7 @@
|
|||
public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
|
||||
if (entityKilled instanceof ServerPlayer) {
|
||||
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
|
||||
@@ -1889,74 +2287,133 @@
|
||||
@@ -1889,74 +2295,133 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(CompoundTag nbt) {
|
||||
|
@ -870,7 +879,7 @@
|
|||
}
|
||||
|
||||
ListTag nbttaglist;
|
||||
@@ -1972,10 +2429,10 @@
|
||||
@@ -1972,10 +2437,10 @@
|
||||
nbttaglist.add(StringTag.valueOf(s));
|
||||
}
|
||||
|
||||
|
@ -883,7 +892,7 @@
|
|||
if (this.isVehicle()) {
|
||||
nbttaglist = new ListTag();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1984,17 +2441,44 @@
|
||||
@@ -1984,17 +2449,44 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
CompoundTag nbttagcompound1 = new CompoundTag();
|
||||
|
||||
|
@ -931,7 +940,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
||||
@@ -2079,7 +2563,72 @@
|
||||
@@ -2079,7 +2571,72 @@
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
|
@ -1004,7 +1013,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -2101,6 +2650,12 @@
|
||||
@@ -2101,6 +2658,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1026,7 @@
|
|||
protected abstract void readAdditionalSaveData(CompoundTag nbt);
|
||||
|
||||
protected abstract void addAdditionalSaveData(CompoundTag nbt);
|
||||
@@ -2150,12 +2705,60 @@
|
||||
@@ -2150,12 +2713,60 @@
|
||||
|
||||
@Nullable
|
||||
public ItemEntity spawnAtLocation(ServerLevel world, ItemStack stack, float yOffset) {
|
||||
|
@ -1080,7 +1089,7 @@
|
|||
world.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2184,7 +2787,16 @@
|
||||
@@ -2184,7 +2795,16 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == player) {
|
||||
if (!this.level().isClientSide()) {
|
||||
|
@ -1098,7 +1107,7 @@
|
|||
leashable.removeLeash();
|
||||
} else {
|
||||
leashable.dropLeash();
|
||||
@@ -2200,6 +2812,14 @@
|
||||
@@ -2200,6 +2820,14 @@
|
||||
|
||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
|
@ -1113,7 +1122,7 @@
|
|||
leashable.setLeashedTo(player, true);
|
||||
}
|
||||
|
||||
@@ -2265,15 +2885,15 @@
|
||||
@@ -2265,15 +2893,15 @@
|
||||
}
|
||||
|
||||
public boolean showVehicleHealth() {
|
||||
|
@ -1132,7 +1141,7 @@
|
|||
return false;
|
||||
} else {
|
||||
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
||||
@@ -2285,11 +2905,32 @@
|
||||
@@ -2285,11 +2913,32 @@
|
||||
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1166,7 +1175,7 @@
|
|||
this.vehicle = entity;
|
||||
this.vehicle.addPassenger(this);
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
@@ -2314,19 +2955,30 @@
|
||||
@@ -2314,19 +2963,30 @@
|
||||
}
|
||||
|
||||
public void removeVehicle() {
|
||||
|
@ -1199,7 +1208,7 @@
|
|||
protected void addPassenger(Entity passenger) {
|
||||
if (passenger.getVehicle() != this) {
|
||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||
@@ -2349,21 +3001,53 @@
|
||||
@@ -2349,21 +3009,53 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1259,7 +1268,7 @@
|
|||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity passenger) {
|
||||
@@ -2464,7 +3148,7 @@
|
||||
@@ -2464,7 +3156,7 @@
|
||||
if (teleporttransition != null) {
|
||||
ServerLevel worldserver1 = teleporttransition.newLevel();
|
||||
|
||||
|
@ -1268,7 +1277,7 @@
|
|||
this.teleport(teleporttransition);
|
||||
}
|
||||
}
|
||||
@@ -2547,7 +3231,7 @@
|
||||
@@ -2547,7 +3239,7 @@
|
||||
}
|
||||
|
||||
public boolean isCrouching() {
|
||||
|
@ -1277,7 +1286,7 @@
|
|||
}
|
||||
|
||||
public boolean isSprinting() {
|
||||
@@ -2563,7 +3247,7 @@
|
||||
@@ -2563,7 +3255,7 @@
|
||||
}
|
||||
|
||||
public boolean isVisuallySwimming() {
|
||||
|
@ -1286,7 +1295,7 @@
|
|||
}
|
||||
|
||||
public boolean isVisuallyCrawling() {
|
||||
@@ -2571,6 +3255,13 @@
|
||||
@@ -2571,6 +3263,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean swimming) {
|
||||
|
@ -1300,7 +1309,7 @@
|
|||
this.setSharedFlag(4, swimming);
|
||||
}
|
||||
|
||||
@@ -2609,6 +3300,7 @@
|
||||
@@ -2609,6 +3308,7 @@
|
||||
|
||||
@Nullable
|
||||
public PlayerTeam getTeam() {
|
||||
|
@ -1308,7 +1317,7 @@
|
|||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||
}
|
||||
|
||||
@@ -2624,8 +3316,12 @@
|
||||
@@ -2624,8 +3324,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1331,7 @@
|
|||
}
|
||||
|
||||
public boolean getSharedFlag(int index) {
|
||||
@@ -2644,7 +3340,7 @@
|
||||
@@ -2644,7 +3348,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -1331,7 +1340,7 @@
|
|||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2652,7 +3348,18 @@
|
||||
@@ -2652,7 +3356,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int air) {
|
||||
|
@ -1351,18 +1360,19 @@
|
|||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2679,11 +3386,44 @@
|
||||
@@ -2679,11 +3394,44 @@
|
||||
|
||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
- if (this.remainingFireTicks == 0) {
|
||||
- this.igniteForSeconds(8.0F);
|
||||
+ // CraftBukkit start
|
||||
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
|
||||
+ final org.bukkit.entity.Entity stormBukkitEntity = lightning.getBukkitEntity();
|
||||
+ final PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.remainingFireTicks == 0) {
|
||||
- this.igniteForSeconds(8.0F);
|
||||
+ if (this.remainingFireTicks == 0) {
|
||||
+ // CraftBukkit start - Call a combust event when lightning strikes
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8.0F);
|
||||
+ pluginManager.callEvent(entityCombustEvent);
|
||||
|
@ -1398,7 +1408,7 @@
|
|||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean drag) {
|
||||
@@ -2713,7 +3453,7 @@
|
||||
@@ -2713,7 +3461,7 @@
|
||||
this.resetFallDistance();
|
||||
}
|
||||
|
||||
|
@ -1407,7 +1417,7 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
@@ -2818,7 +3558,7 @@
|
||||
@@ -2818,7 +3566,7 @@
|
||||
public String toString() {
|
||||
String s = this.level() == null ? "~NULL~" : this.level().toString();
|
||||
|
||||
|
@ -1416,7 +1426,7 @@
|
|||
}
|
||||
|
||||
public final boolean isInvulnerableToBase(DamageSource damageSource) {
|
||||
@@ -2838,6 +3578,13 @@
|
||||
@@ -2838,6 +3586,13 @@
|
||||
}
|
||||
|
||||
public void restoreFrom(Entity original) {
|
||||
|
@ -1430,7 +1440,7 @@
|
|||
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
|
||||
|
||||
nbttagcompound.remove("Dimension");
|
||||
@@ -2850,8 +3597,57 @@
|
||||
@@ -2850,8 +3605,57 @@
|
||||
public Entity teleport(TeleportTransition teleportTarget) {
|
||||
Level world = this.level();
|
||||
|
||||
|
@ -1488,7 +1498,7 @@
|
|||
ServerLevel worldserver1 = teleportTarget.newLevel();
|
||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||
|
||||
@@ -2918,10 +3714,19 @@
|
||||
@@ -2918,10 +3722,19 @@
|
||||
gameprofilerfiller.pop();
|
||||
return null;
|
||||
} else {
|
||||
|
@ -1509,7 +1519,7 @@
|
|||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -2947,7 +3752,7 @@
|
||||
@@ -2947,7 +3760,7 @@
|
||||
}
|
||||
|
||||
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
||||
|
@ -1518,7 +1528,7 @@
|
|||
Iterator iterator = this.getIndirectPassengers().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -2995,9 +3800,17 @@
|
||||
@@ -2995,9 +3808,17 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
|
@ -1539,7 +1549,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -3006,11 +3819,34 @@
|
||||
@@ -3006,11 +3827,34 @@
|
||||
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
|
@ -1574,7 +1584,7 @@
|
|||
if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) {
|
||||
Iterator iterator = this.getPassengers().iterator();
|
||||
|
||||
@@ -3134,10 +3970,16 @@
|
||||
@@ -3134,10 +3978,16 @@
|
||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
|
@ -1594,7 +1604,7 @@
|
|||
return entity != null;
|
||||
}
|
||||
|
||||
@@ -3187,7 +4029,7 @@
|
||||
@@ -3187,7 +4037,7 @@
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
protected void fixupDimensions() {
|
||||
|
@ -1603,7 +1613,7 @@
|
|||
EntityDimensions entitysize = this.getDimensions(entitypose);
|
||||
|
||||
this.dimensions = entitysize;
|
||||
@@ -3196,7 +4038,7 @@
|
||||
@@ -3196,7 +4046,7 @@
|
||||
|
||||
public void refreshDimensions() {
|
||||
EntityDimensions entitysize = this.dimensions;
|
||||
|
@ -1612,7 +1622,7 @@
|
|||
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
||||
|
||||
this.dimensions = entitysize1;
|
||||
@@ -3258,10 +4100,29 @@
|
||||
@@ -3258,10 +4108,29 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
|
@ -1644,7 +1654,7 @@
|
|||
return this.getDimensions(pose).eyeHeight();
|
||||
}
|
||||
|
||||
@@ -3300,7 +4161,14 @@
|
||||
@@ -3300,7 +4169,14 @@
|
||||
|
||||
public void startSeenByPlayer(ServerPlayer player) {}
|
||||
|
||||
|
@ -1660,7 +1670,7 @@
|
|||
|
||||
public float rotate(Rotation rotation) {
|
||||
float f = Mth.wrapDegrees(this.getYRot());
|
||||
@@ -3335,7 +4203,7 @@
|
||||
@@ -3335,7 +4211,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -1669,7 +1679,7 @@
|
|||
return null;
|
||||
}
|
||||
|
||||
@@ -3373,20 +4241,34 @@
|
||||
@@ -3373,20 +4249,34 @@
|
||||
}
|
||||
|
||||
private Stream<Entity> getIndirectPassengersStream() {
|
||||
|
@ -1704,7 +1714,7 @@
|
|||
return () -> {
|
||||
return this.getIndirectPassengersStream().iterator();
|
||||
};
|
||||
@@ -3399,6 +4281,7 @@
|
||||
@@ -3399,6 +4289,7 @@
|
||||
}
|
||||
|
||||
public boolean hasExactlyOnePlayerPassenger() {
|
||||
|
@ -1712,7 +1722,7 @@
|
|||
return this.countPlayerPassengers() == 1;
|
||||
}
|
||||
|
||||
@@ -3435,7 +4318,7 @@
|
||||
@@ -3435,7 +4326,7 @@
|
||||
}
|
||||
|
||||
public boolean isControlledByLocalInstance() {
|
||||
|
@ -1721,7 +1731,7 @@
|
|||
|
||||
if (entityliving instanceof Player entityhuman) {
|
||||
return entityhuman.isLocalPlayer();
|
||||
@@ -3445,7 +4328,7 @@
|
||||
@@ -3445,7 +4336,7 @@
|
||||
}
|
||||
|
||||
public boolean isControlledByClient() {
|
||||
|
@ -1730,7 +1740,7 @@
|
|||
|
||||
return entityliving != null && entityliving.isControlledByClient();
|
||||
}
|
||||
@@ -3463,7 +4346,7 @@
|
||||
@@ -3463,7 +4354,7 @@
|
||||
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
||||
}
|
||||
|
||||
|
@ -1739,7 +1749,7 @@
|
|||
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
||||
}
|
||||
|
||||
@@ -3489,8 +4372,37 @@
|
||||
@@ -3489,8 +4380,37 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1778,7 +1788,7 @@
|
|||
}
|
||||
|
||||
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
||||
@@ -3551,6 +4463,11 @@
|
||||
@@ -3551,6 +4471,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
@ -1790,7 +1800,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -3613,7 +4530,7 @@
|
||||
@@ -3613,7 +4538,7 @@
|
||||
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
||||
}
|
||||
|
||||
|
@ -1799,7 +1809,7 @@
|
|||
return this.type.getDimensions();
|
||||
}
|
||||
|
||||
@@ -3714,7 +4631,39 @@
|
||||
@@ -3714,7 +4639,39 @@
|
||||
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
||||
}
|
||||
|
||||
|
@ -1839,7 +1849,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 +4681,12 @@
|
||||
@@ -3732,6 +4689,12 @@
|
||||
this.levelCallback.onMove();
|
||||
}
|
||||
|
||||
|
@ -1852,7 +1862,7 @@
|
|||
}
|
||||
|
||||
public void checkDespawn() {}
|
||||
@@ -3818,8 +4773,17 @@
|
||||
@@ -3818,8 +4781,17 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason reason) {
|
||||
|
@ -1871,7 +1881,7 @@
|
|||
}
|
||||
|
||||
if (this.removalReason.shouldDestroy()) {
|
||||
@@ -3827,14 +4791,30 @@
|
||||
@@ -3827,14 +4799,30 @@
|
||||
}
|
||||
|
||||
this.getPassengers().forEach(Entity::stopRiding);
|
||||
|
@ -1904,7 +1914,7 @@
|
|||
@Override
|
||||
public void setLevelCallback(EntityInLevelCallback changeListener) {
|
||||
this.levelCallback = changeListener;
|
||||
@@ -3887,7 +4867,7 @@
|
||||
@@ -3887,7 +4875,7 @@
|
||||
}
|
||||
|
||||
public Vec3 getKnownMovement() {
|
||||
|
@ -1913,7 +1923,7 @@
|
|||
|
||||
if (entityliving instanceof Player entityhuman) {
|
||||
if (this.isAlive()) {
|
||||
@@ -3962,4 +4942,14 @@
|
||||
@@ -3962,4 +4950,14 @@
|
||||
|
||||
void accept(Entity entity, double x, double y, double z);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue