Configurable top of nether void damage

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Zach Brown
2016-03-01 23:58:50 -06:00
parent 0255317409
commit b8b1eef98c
2 changed files with 94 additions and 76 deletions

View File

@@ -61,7 +61,7 @@
+// CraftBukkit end +// CraftBukkit end
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder { public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
+
+ // CraftBukkit start + // CraftBukkit start
+ private static final int CURRENT_LEVEL = 2; + private static final int CURRENT_LEVEL = 2;
+ static boolean isLevelAtLeast(CompoundTag tag, int level) { + static boolean isLevelAtLeast(CompoundTag tag, int level) {
@@ -76,7 +76,7 @@
+ } + }
+ return this.bukkitEntity; + return this.bukkitEntity;
+ } + }
+
+ // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir() + // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
+ public int getDefaultMaxAirSupply() { + public int getDefaultMaxAirSupply() {
+ return Entity.TOTAL_AIR_SUPPLY; + return Entity.TOTAL_AIR_SUPPLY;
@@ -125,7 +125,7 @@
+ 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();
@@ -144,7 +144,7 @@
+ public float getBukkitYaw() { + public float getBukkitYaw() {
+ return this.yRot; + return this.yRot;
+ } + }
+
+ public boolean isChunkLoaded() { + public boolean isChunkLoaded() {
+ return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); + return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4);
+ } + }
@@ -340,7 +340,20 @@
} }
} }
@@ -568,15 +756,32 @@ @@ -537,7 +725,11 @@
}
public void checkBelowWorld() {
- if (this.getY() < (double) (this.level().getMinY() - 64)) {
+ // Paper start - Configurable nether ceiling damage
+ if (this.getY() < (double) (this.level.getMinY() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
+ && 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 +760,32 @@
public void lavaHurt() { public void lavaHurt() {
if (!this.fireImmune()) { if (!this.fireImmune()) {
@@ -375,7 +388,7 @@
} }
} }
@@ -587,9 +792,25 @@ @@ -587,9 +796,25 @@
} }
public final void igniteForSeconds(float seconds) { public final void igniteForSeconds(float seconds) {
@@ -402,7 +415,7 @@
public void igniteForTicks(int ticks) { public void igniteForTicks(int ticks) {
if (this.remainingFireTicks < ticks) { if (this.remainingFireTicks < ticks) {
this.setRemainingFireTicks(ticks); this.setRemainingFireTicks(ticks);
@@ -610,7 +831,7 @@ @@ -610,7 +835,7 @@
} }
protected void onBelowWorld() { protected void onBelowWorld() {
@@ -411,10 +424,13 @@
} }
public boolean isFree(double offsetX, double offsetY, double offsetZ) { public boolean isFree(double offsetX, double offsetY, double offsetZ) {
@@ -750,6 +971,28 @@ @@ -747,8 +972,30 @@
}
}
if (movement.y != vec3d1.y) {
block.updateEntityMovementAfterFallOn(this.level(), this);
+ }
+ }
+
+ // CraftBukkit start + // CraftBukkit start
+ if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) { + if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) {
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + Vehicle vehicle = (Vehicle) this.getBukkitEntity();
@@ -433,14 +449,13 @@
+ if (!bl.getType().isAir()) { + if (!bl.getType().isAir()) {
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl); + VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl);
+ this.level.getCraftServer().getPluginManager().callEvent(event); + this.level.getCraftServer().getPluginManager().callEvent(event);
+ } }
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
Entity.MovementEmission entity_movementemission = this.getMovementEmission(); Entity.MovementEmission entity_movementemission = this.getMovementEmission();
@@ -1131,7 +1378,21 @@
@@ -1131,7 +1374,21 @@
protected SoundEvent getSwimHighSpeedSplashSound() { protected SoundEvent getSwimHighSpeedSplashSound() {
return SoundEvents.GENERIC_SPLASH; return SoundEvents.GENERIC_SPLASH;
@@ -462,7 +477,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 +1866,7 @@ @@ -1609,6 +1870,7 @@
this.yo = y; this.yo = y;
this.zo = d4; this.zo = d4;
this.setPos(d3, y, d4); this.setPos(d3, y, d4);
@@ -470,21 +485,20 @@
} }
public void moveTo(Vec3 pos) { public void moveTo(Vec3 pos) {
@@ -1859,7 +2117,13 @@ @@ -1861,6 +2123,12 @@
public boolean isPushable() {
return false; return false;
+ } }
+
+ // CraftBukkit start - collidable API + // CraftBukkit start - collidable API
+ public boolean canCollideWithBukkit(Entity entity) { + public boolean canCollideWithBukkit(Entity entity) {
+ return this.isPushable(); + return this.isPushable();
} + }
+ // CraftBukkit end + // CraftBukkit end
+
public void awardKillScore(Entity entityKilled, DamageSource damageSource) { public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
if (entityKilled instanceof ServerPlayer) { if (entityKilled instanceof ServerPlayer) {
@@ -1889,16 +2153,22 @@ CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
@@ -1889,16 +2157,22 @@
} }
public boolean saveAsPassenger(CompoundTag nbt) { public boolean saveAsPassenger(CompoundTag nbt) {
@@ -510,7 +524,7 @@
return true; return true;
} }
} }
@@ -1909,54 +2179,98 @@ @@ -1909,54 +2183,98 @@
} }
public CompoundTag saveWithoutId(CompoundTag nbt) { public CompoundTag saveWithoutId(CompoundTag nbt) {
@@ -629,7 +643,7 @@
} }
ListTag nbttaglist; ListTag nbttaglist;
@@ -1972,10 +2286,10 @@ @@ -1972,10 +2290,10 @@
nbttaglist.add(StringTag.valueOf(s)); nbttaglist.add(StringTag.valueOf(s));
} }
@@ -642,7 +656,7 @@
if (this.isVehicle()) { if (this.isVehicle()) {
nbttaglist = new ListTag(); nbttaglist = new ListTag();
iterator = this.getPassengers().iterator(); iterator = this.getPassengers().iterator();
@@ -1984,17 +2298,31 @@ @@ -1984,17 +2302,31 @@
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
CompoundTag nbttagcompound1 = new CompoundTag(); CompoundTag nbttagcompound1 = new CompoundTag();
@@ -677,7 +691,7 @@
} 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 +2408,64 @@ @@ -2080,6 +2412,64 @@
} else { } else {
throw new IllegalStateException("Entity has invalid position"); throw new IllegalStateException("Entity has invalid position");
} }
@@ -742,7 +756,7 @@
} 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 +2487,12 @@ @@ -2101,6 +2491,12 @@
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null; return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
} }
@@ -755,7 +769,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 +2545,22 @@ @@ -2153,9 +2549,22 @@
if (stack.isEmpty()) { if (stack.isEmpty()) {
return null; return null;
} else { } else {
@@ -778,7 +792,7 @@
world.addFreshEntity(entityitem); world.addFreshEntity(entityitem);
return entityitem; return entityitem;
} }
@@ -2184,6 +2589,12 @@ @@ -2184,6 +2593,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()) {
@@ -791,7 +805,7 @@
if (player.hasInfiniteMaterials()) { if (player.hasInfiniteMaterials()) {
leashable.removeLeash(); leashable.removeLeash();
} else { } else {
@@ -2200,6 +2611,13 @@ @@ -2200,6 +2615,13 @@
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) { if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
@@ -805,7 +819,7 @@
leashable.setLeashedTo(player, true); leashable.setLeashedTo(player, true);
} }
@@ -2265,7 +2683,7 @@ @@ -2265,7 +2687,7 @@
} }
public boolean showVehicleHealth() { public boolean showVehicleHealth() {
@@ -814,7 +828,7 @@
} }
public boolean startRiding(Entity entity, boolean force) { public boolean startRiding(Entity entity, boolean force) {
@@ -2273,7 +2691,7 @@ @@ -2273,7 +2695,7 @@
return false; return false;
} else if (!entity.couldAcceptPassenger()) { } else if (!entity.couldAcceptPassenger()) {
return false; return false;
@@ -823,7 +837,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 +2703,32 @@ @@ -2285,11 +2707,32 @@
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) { if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false; return false;
} else { } else {
@@ -857,7 +871,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 +2757,7 @@ @@ -2318,7 +2761,7 @@
Entity entity = this.vehicle; Entity entity = this.vehicle;
this.vehicle = null; this.vehicle = null;
@@ -866,7 +880,7 @@
} }
} }
@@ -2349,21 +2788,50 @@ @@ -2349,21 +2792,50 @@
} }
} }
@@ -923,7 +937,7 @@
} }
protected boolean canAddPassenger(Entity passenger) { protected boolean canAddPassenger(Entity passenger) {
@@ -2464,7 +2932,7 @@ @@ -2464,7 +2936,7 @@
if (teleporttransition != null) { if (teleporttransition != null) {
ServerLevel worldserver1 = teleporttransition.newLevel(); ServerLevel worldserver1 = teleporttransition.newLevel();
@@ -932,7 +946,7 @@
this.teleport(teleporttransition); this.teleport(teleporttransition);
} }
} }
@@ -2547,7 +3015,7 @@ @@ -2547,7 +3019,7 @@
} }
public boolean isCrouching() { public boolean isCrouching() {
@@ -941,7 +955,7 @@
} }
public boolean isSprinting() { public boolean isSprinting() {
@@ -2563,7 +3031,7 @@ @@ -2563,7 +3035,7 @@
} }
public boolean isVisuallySwimming() { public boolean isVisuallySwimming() {
@@ -950,7 +964,7 @@
} }
public boolean isVisuallyCrawling() { public boolean isVisuallyCrawling() {
@@ -2571,6 +3039,13 @@ @@ -2571,6 +3043,13 @@
} }
public void setSwimming(boolean swimming) { public void setSwimming(boolean swimming) {
@@ -964,7 +978,7 @@
this.setSharedFlag(4, swimming); this.setSharedFlag(4, swimming);
} }
@@ -2624,8 +3099,12 @@ @@ -2624,8 +3103,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false; return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
} }
@@ -978,7 +992,7 @@
} }
public boolean getSharedFlag(int index) { public boolean getSharedFlag(int index) {
@@ -2644,7 +3123,7 @@ @@ -2644,7 +3127,7 @@
} }
public int getMaxAirSupply() { public int getMaxAirSupply() {
@@ -987,7 +1001,7 @@
} }
public int getAirSupply() { public int getAirSupply() {
@@ -2652,7 +3131,18 @@ @@ -2652,7 +3135,18 @@
} }
public void setAirSupply(int air) { public void setAirSupply(int air) {
@@ -1007,7 +1021,7 @@
} }
public int getTicksFrozen() { public int getTicksFrozen() {
@@ -2679,11 +3169,40 @@ @@ -2679,11 +3173,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);
@@ -1050,7 +1064,7 @@
} }
public void onAboveBubbleCol(boolean drag) { public void onAboveBubbleCol(boolean drag) {
@@ -2713,7 +3232,7 @@ @@ -2713,7 +3236,7 @@
this.resetFallDistance(); this.resetFallDistance();
} }
@@ -1059,7 +1073,7 @@
return true; return true;
} }
@@ -2852,6 +3371,18 @@ @@ -2852,6 +3375,18 @@
if (world instanceof ServerLevel worldserver) { if (world instanceof ServerLevel worldserver) {
if (!this.isRemoved()) { if (!this.isRemoved()) {
@@ -1078,7 +1092,7 @@
ServerLevel worldserver1 = teleportTarget.newLevel(); ServerLevel worldserver1 = teleportTarget.newLevel();
boolean flag = worldserver1.dimension() != worldserver.dimension(); boolean flag = worldserver1.dimension() != worldserver.dimension();
@@ -2920,8 +3451,12 @@ @@ -2920,8 +3455,12 @@
} else { } else {
entity.restoreFrom(this); entity.restoreFrom(this);
this.removeAfterChangingDimensions(); this.removeAfterChangingDimensions();
@@ -1092,7 +1106,7 @@
Iterator iterator1 = list1.iterator(); Iterator iterator1 = list1.iterator();
while (iterator1.hasNext()) { while (iterator1.hasNext()) {
@@ -2947,7 +3482,7 @@ @@ -2947,7 +3486,7 @@
} }
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) { private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
@@ -1101,7 +1115,7 @@
Iterator iterator = this.getIndirectPassengers().iterator(); Iterator iterator = this.getIndirectPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -2995,8 +3530,9 @@ @@ -2995,8 +3534,9 @@
} }
protected void removeAfterChangingDimensions() { protected void removeAfterChangingDimensions() {
@@ -1112,7 +1126,7 @@
leashable.removeLeash(); leashable.removeLeash();
} }
@@ -3006,6 +3542,20 @@ @@ -3006,6 +3546,20 @@
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose())); return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
} }
@@ -1133,7 +1147,7 @@
public boolean canUsePortal(boolean allowVehicles) { public boolean canUsePortal(boolean allowVehicles) {
return (allowVehicles || !this.isPassenger()) && this.isAlive(); return (allowVehicles || !this.isPassenger()) && this.isAlive();
} }
@@ -3134,10 +3684,16 @@ @@ -3134,10 +3688,16 @@
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE); return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
} }
@@ -1153,7 +1167,7 @@
return entity != null; return entity != null;
} }
@@ -3187,7 +3743,7 @@ @@ -3187,7 +3747,7 @@
/** @deprecated */ /** @deprecated */
@Deprecated @Deprecated
protected void fixupDimensions() { protected void fixupDimensions() {
@@ -1162,7 +1176,7 @@
EntityDimensions entitysize = this.getDimensions(entitypose); EntityDimensions entitysize = this.getDimensions(entitypose);
this.dimensions = entitysize; this.dimensions = entitysize;
@@ -3196,7 +3752,7 @@ @@ -3196,7 +3756,7 @@
public void refreshDimensions() { public void refreshDimensions() {
EntityDimensions entitysize = this.dimensions; EntityDimensions entitysize = this.dimensions;
@@ -1171,7 +1185,7 @@
EntityDimensions entitysize1 = this.getDimensions(entitypose); EntityDimensions entitysize1 = this.getDimensions(entitypose);
this.dimensions = entitysize1; this.dimensions = entitysize1;
@@ -3258,10 +3814,29 @@ @@ -3258,10 +3818,29 @@
} }
public final void setBoundingBox(AABB boundingBox) { public final void setBoundingBox(AABB boundingBox) {
@@ -1203,7 +1217,7 @@
return this.getDimensions(pose).eyeHeight(); return this.getDimensions(pose).eyeHeight();
} }
@@ -3335,7 +3910,7 @@ @@ -3335,7 +3914,7 @@
} }
@Nullable @Nullable
@@ -1212,7 +1226,7 @@
return null; return null;
} }
@@ -3435,7 +4010,7 @@ @@ -3435,7 +4014,7 @@
} }
public boolean isControlledByLocalInstance() { public boolean isControlledByLocalInstance() {
@@ -1221,7 +1235,7 @@
if (entityliving instanceof Player entityhuman) { if (entityliving instanceof Player entityhuman) {
return entityhuman.isLocalPlayer(); return entityhuman.isLocalPlayer();
@@ -3445,7 +4020,7 @@ @@ -3445,7 +4024,7 @@
} }
public boolean isControlledByClient() { public boolean isControlledByClient() {
@@ -1230,7 +1244,7 @@
return entityliving != null && entityliving.isControlledByClient(); return entityliving != null && entityliving.isControlledByClient();
} }
@@ -3463,7 +4038,7 @@ @@ -3463,7 +4042,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);
} }
@@ -1239,11 +1253,10 @@
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ()); return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
} }
@@ -3488,9 +4063,38 @@ @@ -3489,8 +4068,37 @@
public int getFireImmuneTicks() {
return 1; return 1;
} }
+
+ // CraftBukkit start + // CraftBukkit start
+ private final CommandSource commandSource = new CommandSource() { + private final CommandSource commandSource = new CommandSource() {
+ +
@@ -1255,7 +1268,7 @@
+ public CommandSender getBukkitSender(CommandSourceStack wrapper) { + public CommandSender getBukkitSender(CommandSourceStack wrapper) {
+ return Entity.this.getBukkitEntity(); + return Entity.this.getBukkitEntity();
+ } + }
+
+ @Override + @Override
+ public boolean acceptsSuccess() { + public boolean acceptsSuccess() {
+ return ((ServerLevel) Entity.this.level()).getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK); + return ((ServerLevel) Entity.this.level()).getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK);
@@ -1279,7 +1292,7 @@
} }
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) { public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
@@ -3551,6 +4155,11 @@ @@ -3551,6 +4159,11 @@
vec3d = vec3d.add(vec3d1); vec3d = vec3d.add(vec3d1);
++k1; ++k1;
} }
@@ -1291,7 +1304,7 @@
} }
} }
} }
@@ -3613,7 +4222,7 @@ @@ -3613,7 +4226,7 @@
return new ClientboundAddEntityPacket(this, entityTrackerEntry); return new ClientboundAddEntityPacket(this, entityTrackerEntry);
} }
@@ -1300,7 +1313,7 @@
return this.type.getDimensions(); return this.type.getDimensions();
} }
@@ -3818,8 +4427,16 @@ @@ -3818,8 +4431,16 @@
@Override @Override
public final void setRemoved(Entity.RemovalReason reason) { public final void setRemoved(Entity.RemovalReason reason) {
@@ -1318,7 +1331,7 @@
} }
if (this.removalReason.shouldDestroy()) { if (this.removalReason.shouldDestroy()) {
@@ -3827,8 +4444,8 @@ @@ -3827,8 +4448,8 @@
} }
this.getPassengers().forEach(Entity::stopRiding); this.getPassengers().forEach(Entity::stopRiding);
@@ -1329,7 +1342,7 @@
} }
public void unsetRemoved() { public void unsetRemoved() {
@@ -3887,7 +4504,7 @@ @@ -3887,7 +4508,7 @@
} }
public Vec3 getKnownMovement() { public Vec3 getKnownMovement() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/portal/PortalForcer.java --- a/net/minecraft/world/level/portal/PortalForcer.java
+++ b/net/minecraft/world/level/portal/PortalForcer.java +++ b/net/minecraft/world/level/portal/PortalForcer.java
@@ -43,24 +43,36 @@ @@ -43,33 +43,50 @@
} }
public Optional<BlockPos> findClosestPortalPosition(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) { public Optional<BlockPos> findClosestPortalPosition(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
@@ -25,7 +25,7 @@
- Objects.requireNonNull(worldBorder); - Objects.requireNonNull(worldBorder);
- return stream.filter(worldBorder::isWithinBounds).filter((blockposition1) -> { - return stream.filter(worldBorder::isWithinBounds).filter((blockposition1) -> {
+ Objects.requireNonNull(worldborder); + Objects.requireNonNull(worldborder);
+ return stream.filter(worldborder::isWithinBounds).filter((blockposition1) -> { + return stream.filter(worldborder::isWithinBounds).filter(pos -> !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> pos.getY() >= v))).filter((blockposition1) -> { // Paper - Configurable nether ceiling damage
return this.level.getBlockState(blockposition1).hasProperty(BlockStateProperties.HORIZONTAL_AXIS); return this.level.getBlockState(blockposition1).hasProperty(BlockStateProperties.HORIZONTAL_AXIS);
- }).min(Comparator.comparingDouble((blockposition1) -> { - }).min(Comparator.comparingDouble((blockposition1) -> {
- return blockposition1.distSqr(pos); - return blockposition1.distSqr(pos);
@@ -46,9 +46,14 @@
double d0 = -1.0D; double d0 = -1.0D;
BlockPos blockposition1 = null; BlockPos blockposition1 = null;
double d1 = -1.0D; double d1 = -1.0D;
@@ -68,8 +80,8 @@ BlockPos blockposition2 = null;
WorldBorder worldborder = this.level.getWorldBorder(); WorldBorder worldborder = this.level.getWorldBorder();
int i = Math.min(this.level.getMaxY(), this.level.getMinY() + this.level.getLogicalHeight() - 1); int i = Math.min(this.level.getMaxY(), this.level.getMinY() + this.level.getLogicalHeight() - 1);
+ // Paper start - Configurable nether ceiling damage; make sure the max height doesn't exceed the void damage height
+ if (this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.enabled()) {
+ i = Math.min(i, this.level.paperConfig().environment.netherCeilingVoidDamageHeight.intValue() - 1);
+ }
+ // Paper end - Configurable nether ceiling damage
boolean flag = true; boolean flag = true;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable(); - BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable();
- Iterator iterator = BlockPos.spiralAround(pos, 16, Direction.EAST, Direction.SOUTH).iterator(); - Iterator iterator = BlockPos.spiralAround(pos, 16, Direction.EAST, Direction.SOUTH).iterator();
@@ -57,7 +62,7 @@
int j; int j;
int k; int k;
@@ -95,7 +107,7 @@ @@ -95,7 +112,7 @@
if (i1 <= 0 || i1 >= 3) { if (i1 <= 0 || i1 >= 3) {
blockposition_mutableblockposition1.setY(k); blockposition_mutableblockposition1.setY(k);
if (this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, 0)) { if (this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, 0)) {
@@ -66,7 +71,7 @@
if (this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, -1) && this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, 1) && (d0 == -1.0D || d0 > d2)) { if (this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, -1) && this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, 1) && (d0 == -1.0D || d0 > d2)) {
d0 = d2; d0 = d2;
@@ -122,6 +134,7 @@ @@ -122,6 +139,7 @@
int j1; int j1;
int k1; int k1;
@@ -74,7 +79,7 @@
if (d0 == -1.0D) { if (d0 == -1.0D) {
j1 = Math.max(this.level.getMinY() - -1, 70); j1 = Math.max(this.level.getMinY() - -1, 70);
k1 = i - 9; k1 = i - 9;
@@ -129,7 +142,7 @@ @@ -129,7 +147,7 @@
return Optional.empty(); return Optional.empty();
} }
@@ -83,7 +88,7 @@
blockposition1 = worldborder.clampToBounds(blockposition1); blockposition1 = worldborder.clampToBounds(blockposition1);
Direction enumdirection1 = enumdirection.getClockWise(); Direction enumdirection1 = enumdirection.getClockWise();
@@ -139,7 +152,7 @@ @@ -139,7 +157,7 @@
BlockState iblockdata = i1 < 0 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState(); BlockState iblockdata = i1 < 0 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState();
blockposition_mutableblockposition.setWithOffset(blockposition1, l * enumdirection.getStepX() + k * enumdirection1.getStepX(), i1, l * enumdirection.getStepZ() + k * enumdirection1.getStepZ()); blockposition_mutableblockposition.setWithOffset(blockposition1, l * enumdirection.getStepX() + k * enumdirection1.getStepX(), i1, l * enumdirection.getStepZ() + k * enumdirection1.getStepZ());
@@ -92,7 +97,7 @@
} }
} }
} }
@@ -149,20 +162,30 @@ @@ -149,20 +167,30 @@
for (k1 = -1; k1 < 4; ++k1) { for (k1 = -1; k1 < 4; ++k1) {
if (j1 == -1 || j1 == 2 || k1 == -1 || k1 == 3) { if (j1 == -1 || j1 == 2 || k1 == -1 || k1 == 3) {
blockposition_mutableblockposition.setWithOffset(blockposition1, j1 * enumdirection.getStepX(), k1, j1 * enumdirection.getStepZ()); blockposition_mutableblockposition.setWithOffset(blockposition1, j1 * enumdirection.getStepX(), k1, j1 * enumdirection.getStepZ());