mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Void damage configuration API
This commit is contained in:
parent
411498e394
commit
66e26ebe48
3 changed files with 125 additions and 75 deletions
|
@ -411,21 +411,19 @@
|
|||
}
|
||||
|
||||
protected final AABB makeBoundingBox() {
|
||||
@@ -460,12 +732,22 @@
|
||||
|
||||
public void tick() {
|
||||
@@ -462,10 +734,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();
|
||||
|
||||
|
@ -472,20 +470,21 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -537,7 +823,11 @@
|
||||
@@ -537,7 +823,12 @@
|
||||
}
|
||||
|
||||
public void checkBelowWorld() {
|
||||
- if (this.getY() < (double) (this.level().getMinY() - 64)) {
|
||||
+ if (!this.level.getWorld().isVoidDamageEnabled()) return; // Paper - check if void damage is enabled on the world
|
||||
+ // Paper start - Configurable nether ceiling damage
|
||||
+ if (this.getY() < (double) (this.level.getMinY() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
|
||||
+ if (this.getY() < (double) (this.level.getMinY() + this.level.getWorld().getVoidDamageMinBuildHeightOffset()) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER // Paper - use configured min build height offset
|
||||
+ && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
|
||||
+ && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
|
||||
+ // Paper end - Configurable nether ceiling damage
|
||||
this.onBelowWorld();
|
||||
}
|
||||
|
||||
@@ -568,15 +858,32 @@
|
||||
@@ -568,15 +859,32 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
|
@ -520,7 +519,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -587,9 +894,25 @@
|
||||
@@ -587,9 +895,25 @@
|
||||
}
|
||||
|
||||
public final void igniteForSeconds(float seconds) {
|
||||
|
@ -547,7 +546,7 @@
|
|||
public void igniteForTicks(int ticks) {
|
||||
if (this.remainingFireTicks < ticks) {
|
||||
this.setRemainingFireTicks(ticks);
|
||||
@@ -610,7 +933,7 @@
|
||||
@@ -610,7 +934,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
|
@ -556,7 +555,7 @@
|
|||
}
|
||||
|
||||
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
||||
@@ -672,6 +995,7 @@
|
||||
@@ -672,6 +996,7 @@
|
||||
}
|
||||
|
||||
public void move(MoverType type, Vec3 movement) {
|
||||
|
@ -564,7 +563,7 @@
|
|||
if (this.noPhysics) {
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
@@ -747,8 +1071,30 @@
|
||||
@@ -747,8 +1072,30 @@
|
||||
|
||||
if (movement.y != vec3d1.y) {
|
||||
block.updateEntityMovementAfterFallOn(this.level(), this);
|
||||
|
@ -595,7 +594,7 @@
|
|||
|
||||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
||||
@@ -913,7 +1259,7 @@
|
||||
@@ -913,7 +1260,7 @@
|
||||
}
|
||||
|
||||
protected BlockPos getOnPos(float offset) {
|
||||
|
@ -604,7 +603,7 @@
|
|||
BlockPos blockposition = (BlockPos) this.mainSupportingBlockPos.get();
|
||||
|
||||
if (offset <= 1.0E-5F) {
|
||||
@@ -1133,6 +1479,20 @@
|
||||
@@ -1133,6 +1480,20 @@
|
||||
return SoundEvents.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
|
@ -625,7 +624,7 @@
|
|||
public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) {
|
||||
this.movementThisTick.add(new Entity.Movement(oldPos, newPos));
|
||||
}
|
||||
@@ -1599,6 +1959,7 @@
|
||||
@@ -1599,6 +1960,7 @@
|
||||
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
|
||||
this.yRotO = this.getYRot();
|
||||
this.xRotO = this.getXRot();
|
||||
|
@ -633,7 +632,7 @@
|
|||
}
|
||||
|
||||
public void absMoveTo(double x, double y, double z) {
|
||||
@@ -1609,6 +1970,7 @@
|
||||
@@ -1609,6 +1971,7 @@
|
||||
this.yo = y;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, y, d4);
|
||||
|
@ -641,7 +640,7 @@
|
|||
}
|
||||
|
||||
public void moveTo(Vec3 pos) {
|
||||
@@ -1628,11 +1990,19 @@
|
||||
@@ -1628,11 +1991,19 @@
|
||||
}
|
||||
|
||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
||||
|
@ -661,7 +660,7 @@
|
|||
}
|
||||
|
||||
public final void setOldPosAndRot() {
|
||||
@@ -1701,6 +2071,7 @@
|
||||
@@ -1701,6 +2072,7 @@
|
||||
public void push(Entity entity) {
|
||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
|
@ -669,7 +668,7 @@
|
|||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = Mth.absMax(d0, d1);
|
||||
@@ -1737,7 +2108,21 @@
|
||||
@@ -1737,7 +2109,21 @@
|
||||
}
|
||||
|
||||
public void push(double deltaX, double deltaY, double deltaZ) {
|
||||
|
@ -692,7 +691,7 @@
|
|||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -1858,9 +2243,21 @@
|
||||
@@ -1858,9 +2244,21 @@
|
||||
}
|
||||
|
||||
public boolean isPushable() {
|
||||
|
@ -714,7 +713,7 @@
|
|||
public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
|
||||
if (entityKilled instanceof ServerPlayer) {
|
||||
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
|
||||
@@ -1889,74 +2286,133 @@
|
||||
@@ -1889,74 +2287,133 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(CompoundTag nbt) {
|
||||
|
@ -871,7 +870,7 @@
|
|||
}
|
||||
|
||||
ListTag nbttaglist;
|
||||
@@ -1972,10 +2428,10 @@
|
||||
@@ -1972,10 +2429,10 @@
|
||||
nbttaglist.add(StringTag.valueOf(s));
|
||||
}
|
||||
|
||||
|
@ -884,7 +883,7 @@
|
|||
if (this.isVehicle()) {
|
||||
nbttaglist = new ListTag();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1984,17 +2440,44 @@
|
||||
@@ -1984,17 +2441,44 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
CompoundTag nbttagcompound1 = new CompoundTag();
|
||||
|
||||
|
@ -932,10 +931,11 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
||||
@@ -2080,6 +2563,71 @@
|
||||
@@ -2079,7 +2563,72 @@
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ // Spigot start
|
||||
|
@ -948,7 +948,7 @@
|
|||
+ // SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ if (nbt.contains("Bukkit.MaxAirSupply")) {
|
||||
+ this.maxAirTicks = nbt.getInt("Bukkit.MaxAirSupply");
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1004,7 +1004,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -2101,6 +2649,12 @@
|
||||
@@ -2101,6 +2650,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1017,7 @@
|
|||
protected abstract void readAdditionalSaveData(CompoundTag nbt);
|
||||
|
||||
protected abstract void addAdditionalSaveData(CompoundTag nbt);
|
||||
@@ -2150,12 +2704,60 @@
|
||||
@@ -2150,12 +2705,60 @@
|
||||
|
||||
@Nullable
|
||||
public ItemEntity spawnAtLocation(ServerLevel world, ItemStack stack, float yOffset) {
|
||||
|
@ -1080,7 +1080,7 @@
|
|||
world.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2184,7 +2786,16 @@
|
||||
@@ -2184,7 +2787,16 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == player) {
|
||||
if (!this.level().isClientSide()) {
|
||||
|
@ -1098,7 +1098,7 @@
|
|||
leashable.removeLeash();
|
||||
} else {
|
||||
leashable.dropLeash();
|
||||
@@ -2200,6 +2811,14 @@
|
||||
@@ -2200,6 +2812,14 @@
|
||||
|
||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
|
@ -1113,7 +1113,7 @@
|
|||
leashable.setLeashedTo(player, true);
|
||||
}
|
||||
|
||||
@@ -2265,15 +2884,15 @@
|
||||
@@ -2265,15 +2885,15 @@
|
||||
}
|
||||
|
||||
public boolean showVehicleHealth() {
|
||||
|
@ -1132,7 +1132,7 @@
|
|||
return false;
|
||||
} else {
|
||||
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
||||
@@ -2285,11 +2904,32 @@
|
||||
@@ -2285,11 +2905,32 @@
|
||||
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1166,7 +1166,7 @@
|
|||
this.vehicle = entity;
|
||||
this.vehicle.addPassenger(this);
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
@@ -2314,19 +2954,30 @@
|
||||
@@ -2314,19 +2955,30 @@
|
||||
}
|
||||
|
||||
public void removeVehicle() {
|
||||
|
@ -1199,7 +1199,7 @@
|
|||
protected void addPassenger(Entity passenger) {
|
||||
if (passenger.getVehicle() != this) {
|
||||
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||
@@ -2349,21 +3000,53 @@
|
||||
@@ -2349,21 +3001,53 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1259,7 +1259,7 @@
|
|||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity passenger) {
|
||||
@@ -2464,7 +3147,7 @@
|
||||
@@ -2464,7 +3148,7 @@
|
||||
if (teleporttransition != null) {
|
||||
ServerLevel worldserver1 = teleporttransition.newLevel();
|
||||
|
||||
|
@ -1268,7 +1268,7 @@
|
|||
this.teleport(teleporttransition);
|
||||
}
|
||||
}
|
||||
@@ -2547,7 +3230,7 @@
|
||||
@@ -2547,7 +3231,7 @@
|
||||
}
|
||||
|
||||
public boolean isCrouching() {
|
||||
|
@ -1277,7 +1277,7 @@
|
|||
}
|
||||
|
||||
public boolean isSprinting() {
|
||||
@@ -2563,7 +3246,7 @@
|
||||
@@ -2563,7 +3247,7 @@
|
||||
}
|
||||
|
||||
public boolean isVisuallySwimming() {
|
||||
|
@ -1286,7 +1286,7 @@
|
|||
}
|
||||
|
||||
public boolean isVisuallyCrawling() {
|
||||
@@ -2571,6 +3254,13 @@
|
||||
@@ -2571,6 +3255,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean swimming) {
|
||||
|
@ -1300,7 +1300,7 @@
|
|||
this.setSharedFlag(4, swimming);
|
||||
}
|
||||
|
||||
@@ -2609,6 +3299,7 @@
|
||||
@@ -2609,6 +3300,7 @@
|
||||
|
||||
@Nullable
|
||||
public PlayerTeam getTeam() {
|
||||
|
@ -1308,7 +1308,7 @@
|
|||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||
}
|
||||
|
||||
@@ -2624,8 +3315,12 @@
|
||||
@@ -2624,8 +3316,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1322,7 @@
|
|||
}
|
||||
|
||||
public boolean getSharedFlag(int index) {
|
||||
@@ -2644,7 +3339,7 @@
|
||||
@@ -2644,7 +3340,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -1331,7 +1331,7 @@
|
|||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2652,7 +3347,18 @@
|
||||
@@ -2652,7 +3348,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int air) {
|
||||
|
@ -1351,7 +1351,7 @@
|
|||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2679,11 +3385,44 @@
|
||||
@@ -2679,11 +3386,44 @@
|
||||
|
||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
|
@ -1398,7 +1398,7 @@
|
|||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean drag) {
|
||||
@@ -2713,7 +3452,7 @@
|
||||
@@ -2713,7 +3453,7 @@
|
||||
this.resetFallDistance();
|
||||
}
|
||||
|
||||
|
@ -1407,7 +1407,7 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
@@ -2818,7 +3557,7 @@
|
||||
@@ -2818,7 +3558,7 @@
|
||||
public String toString() {
|
||||
String s = this.level() == null ? "~NULL~" : this.level().toString();
|
||||
|
||||
|
@ -1416,7 +1416,7 @@
|
|||
}
|
||||
|
||||
public final boolean isInvulnerableToBase(DamageSource damageSource) {
|
||||
@@ -2838,6 +3577,13 @@
|
||||
@@ -2838,6 +3578,13 @@
|
||||
}
|
||||
|
||||
public void restoreFrom(Entity original) {
|
||||
|
@ -1430,7 +1430,7 @@
|
|||
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
|
||||
|
||||
nbttagcompound.remove("Dimension");
|
||||
@@ -2850,8 +3596,57 @@
|
||||
@@ -2850,8 +3597,57 @@
|
||||
public Entity teleport(TeleportTransition teleportTarget) {
|
||||
Level world = this.level();
|
||||
|
||||
|
@ -1488,7 +1488,7 @@
|
|||
ServerLevel worldserver1 = teleportTarget.newLevel();
|
||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||
|
||||
@@ -2918,10 +3713,19 @@
|
||||
@@ -2918,10 +3714,19 @@
|
||||
gameprofilerfiller.pop();
|
||||
return null;
|
||||
} else {
|
||||
|
@ -1509,7 +1509,7 @@
|
|||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -2947,7 +3751,7 @@
|
||||
@@ -2947,7 +3752,7 @@
|
||||
}
|
||||
|
||||
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
||||
|
@ -1518,7 +1518,7 @@
|
|||
Iterator iterator = this.getIndirectPassengers().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -2995,9 +3799,17 @@
|
||||
@@ -2995,9 +3800,17 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
|
@ -1539,7 +1539,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -3006,11 +3818,34 @@
|
||||
@@ -3006,11 +3819,34 @@
|
||||
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
|
@ -1574,7 +1574,7 @@
|
|||
if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) {
|
||||
Iterator iterator = this.getPassengers().iterator();
|
||||
|
||||
@@ -3134,10 +3969,16 @@
|
||||
@@ -3134,10 +3970,16 @@
|
||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
|
@ -1594,7 +1594,7 @@
|
|||
return entity != null;
|
||||
}
|
||||
|
||||
@@ -3187,7 +4028,7 @@
|
||||
@@ -3187,7 +4029,7 @@
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
protected void fixupDimensions() {
|
||||
|
@ -1603,7 +1603,7 @@
|
|||
EntityDimensions entitysize = this.getDimensions(entitypose);
|
||||
|
||||
this.dimensions = entitysize;
|
||||
@@ -3196,7 +4037,7 @@
|
||||
@@ -3196,7 +4038,7 @@
|
||||
|
||||
public void refreshDimensions() {
|
||||
EntityDimensions entitysize = this.dimensions;
|
||||
|
@ -1612,7 +1612,7 @@
|
|||
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
||||
|
||||
this.dimensions = entitysize1;
|
||||
@@ -3258,10 +4099,29 @@
|
||||
@@ -3258,10 +4100,29 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB boundingBox) {
|
||||
|
@ -1644,7 +1644,7 @@
|
|||
return this.getDimensions(pose).eyeHeight();
|
||||
}
|
||||
|
||||
@@ -3300,7 +4160,14 @@
|
||||
@@ -3300,7 +4161,14 @@
|
||||
|
||||
public void startSeenByPlayer(ServerPlayer player) {}
|
||||
|
||||
|
@ -1660,7 +1660,7 @@
|
|||
|
||||
public float rotate(Rotation rotation) {
|
||||
float f = Mth.wrapDegrees(this.getYRot());
|
||||
@@ -3335,7 +4202,7 @@
|
||||
@@ -3335,7 +4203,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -1669,7 +1669,7 @@
|
|||
return null;
|
||||
}
|
||||
|
||||
@@ -3373,20 +4240,34 @@
|
||||
@@ -3373,20 +4241,34 @@
|
||||
}
|
||||
|
||||
private Stream<Entity> getIndirectPassengersStream() {
|
||||
|
@ -1704,7 +1704,7 @@
|
|||
return () -> {
|
||||
return this.getIndirectPassengersStream().iterator();
|
||||
};
|
||||
@@ -3399,6 +4280,7 @@
|
||||
@@ -3399,6 +4281,7 @@
|
||||
}
|
||||
|
||||
public boolean hasExactlyOnePlayerPassenger() {
|
||||
|
@ -1712,7 +1712,7 @@
|
|||
return this.countPlayerPassengers() == 1;
|
||||
}
|
||||
|
||||
@@ -3435,7 +4317,7 @@
|
||||
@@ -3435,7 +4318,7 @@
|
||||
}
|
||||
|
||||
public boolean isControlledByLocalInstance() {
|
||||
|
@ -1721,7 +1721,7 @@
|
|||
|
||||
if (entityliving instanceof Player entityhuman) {
|
||||
return entityhuman.isLocalPlayer();
|
||||
@@ -3445,7 +4327,7 @@
|
||||
@@ -3445,7 +4328,7 @@
|
||||
}
|
||||
|
||||
public boolean isControlledByClient() {
|
||||
|
@ -1730,7 +1730,7 @@
|
|||
|
||||
return entityliving != null && entityliving.isControlledByClient();
|
||||
}
|
||||
@@ -3463,7 +4345,7 @@
|
||||
@@ -3463,7 +4346,7 @@
|
||||
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
||||
}
|
||||
|
||||
|
@ -1739,7 +1739,7 @@
|
|||
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
||||
}
|
||||
|
||||
@@ -3489,8 +4371,37 @@
|
||||
@@ -3489,8 +4372,37 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1778,7 +1778,7 @@
|
|||
}
|
||||
|
||||
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
||||
@@ -3551,6 +4462,11 @@
|
||||
@@ -3551,6 +4463,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
@ -1790,7 +1790,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -3613,7 +4529,7 @@
|
||||
@@ -3613,7 +4530,7 @@
|
||||
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
||||
}
|
||||
|
||||
|
@ -1799,7 +1799,7 @@
|
|||
return this.type.getDimensions();
|
||||
}
|
||||
|
||||
@@ -3714,7 +4630,39 @@
|
||||
@@ -3714,7 +4631,39 @@
|
||||
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
||||
}
|
||||
|
||||
|
@ -1839,7 +1839,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 +4680,12 @@
|
||||
@@ -3732,6 +4681,12 @@
|
||||
this.levelCallback.onMove();
|
||||
}
|
||||
|
||||
|
@ -1852,7 +1852,7 @@
|
|||
}
|
||||
|
||||
public void checkDespawn() {}
|
||||
@@ -3818,8 +4772,17 @@
|
||||
@@ -3818,8 +4773,17 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason reason) {
|
||||
|
@ -1871,7 +1871,7 @@
|
|||
}
|
||||
|
||||
if (this.removalReason.shouldDestroy()) {
|
||||
@@ -3827,14 +4790,30 @@
|
||||
@@ -3827,14 +4791,30 @@
|
||||
}
|
||||
|
||||
this.getPassengers().forEach(Entity::stopRiding);
|
||||
|
@ -1904,7 +1904,7 @@
|
|||
@Override
|
||||
public void setLevelCallback(EntityInLevelCallback changeListener) {
|
||||
this.levelCallback = changeListener;
|
||||
@@ -3887,7 +4866,7 @@
|
||||
@@ -3887,7 +4867,7 @@
|
||||
}
|
||||
|
||||
public Vec3 getKnownMovement() {
|
||||
|
@ -1913,7 +1913,7 @@
|
|||
|
||||
if (entityliving instanceof Player entityhuman) {
|
||||
if (this.isAlive()) {
|
||||
@@ -3962,4 +4941,14 @@
|
||||
@@ -3962,4 +4942,14 @@
|
||||
|
||||
void accept(Entity entity, double x, double y, double z);
|
||||
}
|
||||
|
|
|
@ -1356,6 +1356,15 @@
|
|||
this.setHealth(0.0F);
|
||||
this.die(this.damageSources().generic());
|
||||
}
|
||||
@@ -2083,7 +2704,7 @@
|
||||
|
||||
@Override
|
||||
protected void onBelowWorld() {
|
||||
- this.hurt(this.damageSources().fellOutOfWorld(), 4.0F);
|
||||
+ this.hurt(this.damageSources().fellOutOfWorld(), this.level().getWorld().getVoidDamageAmount()); // Paper - use configured void damage amount
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
@@ -2182,6 +2803,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
||||
|
@ -1755,7 +1764,7 @@
|
|||
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
|
||||
+ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
+ Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE);
|
||||
|
@ -1779,7 +1788,7 @@
|
|||
+ }
|
||||
+ // Paper end
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
}
|
||||
|
|
|
@ -168,6 +168,41 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||
private final Object2IntOpenHashMap<SpawnCategory> spawnCategoryLimit = new Object2IntOpenHashMap<>();
|
||||
private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftWorld.DATA_TYPE_REGISTRY);
|
||||
private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers
|
||||
// Paper start - void damage configuration
|
||||
private boolean voidDamageEnabled;
|
||||
private float voidDamageAmount;
|
||||
private double voidDamageMinBuildHeightOffset;
|
||||
|
||||
@Override
|
||||
public boolean isVoidDamageEnabled() {
|
||||
return this.voidDamageEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVoidDamageEnabled(final boolean enabled) {
|
||||
this.voidDamageEnabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getVoidDamageAmount() {
|
||||
return this.voidDamageAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVoidDamageAmount(float voidDamageAmount) {
|
||||
this.voidDamageAmount = voidDamageAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoidDamageMinBuildHeightOffset() {
|
||||
return this.voidDamageMinBuildHeightOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVoidDamageMinBuildHeightOffset(double minBuildHeightOffset) {
|
||||
this.voidDamageMinBuildHeightOffset = minBuildHeightOffset;
|
||||
}
|
||||
// Paper end - void damage configuration
|
||||
|
||||
// Paper start - Provide fast information methods
|
||||
@Override
|
||||
|
@ -268,6 +303,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||
}
|
||||
}
|
||||
// Paper end - per world spawn limits
|
||||
|
||||
// Paper start - per world void damage height
|
||||
this.voidDamageEnabled = this.world.paperConfig().environment.voidDamageAmount.enabled();
|
||||
this.voidDamageMinBuildHeightOffset = this.world.paperConfig().environment.voidDamageMinBuildHeightOffset;
|
||||
this.voidDamageAmount = (float) this.world.paperConfig().environment.voidDamageAmount.or(0);
|
||||
// Paper end - per world void damage height
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue