Do not create nether portals that delete undestroyable blocks

Fixes https://github.com/PaperMC/Paper/issues/5773
Dieser Commit ist enthalten in:
Spottedleaf 2021-09-07 15:10:48 -07:00
Ursprung 295703efb6
Commit c3d50184eb

Datei anzeigen

@ -170,3 +170,21 @@ index a087eec747bb355afd627c6042d20440c3e43e1b..bea9c7ac0fe08c3ca3309e8311f192cc
} }
public boolean isSolidRender(BlockGetter world, BlockPos pos) { public boolean isSolidRender(BlockGetter world, BlockPos pos) {
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 d5ba2e679ed1858ea18e18feffce50544ae036c2..ca3e143e641933fa6b9499bbaaa1836877d90c52 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -209,6 +209,13 @@ public class PortalForcer {
for (int j = -1; j < 3; ++j) {
for (int k = -1; k < 4; ++k) {
temp.setWithOffset((Vec3i) pos, portalDirection.getStepX() * j + enumdirection1.getStepX() * distanceOrthogonalToPortal, k, portalDirection.getStepZ() * j + enumdirection1.getStepZ() * distanceOrthogonalToPortal);
+ // Paper start - prevent destroying unbreakable blocks
+ if (!com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits) {
+ if (!this.level.getBlockState(temp).isDestroyable()) {
+ return false;
+ }
+ }
+ // Paper end - prevent destroying unbreakable blocks
if (k < 0 && !this.level.getBlockState(temp).getMaterial().isSolid()) {
return false;
}