mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
50 lines
3.5 KiB
Diff
50 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
Date: Tue, 1 Mar 2016 23:58:50 -0600
|
|
Subject: [PATCH] Configurable top of nether void damage
|
|
|
|
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 9f3598371c854ec74f3b5752c9779d6c0d99ec39..450a55fd1b01ac67d911d152a04a3dee3aa0a2e9 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -720,7 +720,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
}
|
|
|
|
public void checkBelowWorld() {
|
|
- if (this.getY() < (double) (this.level().getMinBuildHeight() - 64)) {
|
|
+ // Paper start - Configurable nether ceiling damage
|
|
+ if (this.getY() < (double) (this.level.getMinBuildHeight() - 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
|
|
this.onBelowWorld();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
index 02e3322ec41108fe9275510e2daa833d180353dc..0762bb248b3bd43a06e89aa1893a6189f0e13866 100644
|
|
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
|
@@ -55,7 +55,7 @@ public class PortalForcer {
|
|
Optional<PoiRecord> optional = villageplace.getInSquare((holder) -> {
|
|
return holder.is(PoiTypes.NETHER_PORTAL);
|
|
}, blockposition, i, PoiManager.Occupancy.ANY).filter((villageplacerecord) -> {
|
|
- return worldborder.isWithinBounds(villageplacerecord.getPos());
|
|
+ return worldborder.isWithinBounds(villageplacerecord.getPos()) && !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> villageplacerecord.getPos().getY() >= v)); // Paper - don't teleport into void damage
|
|
}).sorted(Comparator.comparingDouble((PoiRecord villageplacerecord) -> { // CraftBukkit - decompile error
|
|
return villageplacerecord.getPos().distSqr(blockposition);
|
|
}).thenComparingInt((villageplacerecord) -> {
|
|
@@ -90,6 +90,11 @@ public class PortalForcer {
|
|
BlockPos blockposition2 = null;
|
|
WorldBorder worldborder = this.level.getWorldBorder();
|
|
int i = Math.min(this.level.getMaxBuildHeight(), this.level.getMinBuildHeight() + this.level.getLogicalHeight()) - 1;
|
|
+ // Paper start - if ceiling void damage is enabled, 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
|
|
BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable();
|
|
Iterator iterator = BlockPos.spiralAround(blockposition, createRadius, Direction.EAST, Direction.SOUTH).iterator(); // CraftBukkit
|
|
|