Scissors/patches/server/0041-Fix-exploit-where-paintings-are-able-to-spawn-out-of.patch
2023-06-11 02:06:44 -05:00

39 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
Date: Sat, 20 Aug 2022 03:01:56 +0100
Subject: [PATCH] Fix exploit where paintings are able to spawn out of bounds
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
index ad222b622979716efdb0ea14cbf2cbcb4acf2e74..33b97f0738fbc4a54a174e9419275770e4513ca0 100644
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
@@ -30,7 +30,7 @@ public class ScissorsConfig
Discord: https://discord.com/invite/mtVQcHn58h
Website: https://scissors.gg/\s
- Docs: https://scissors.gg/javadoc/1.18.2/\s
+ Docs: https://javadoc.scissors.gg/1.18.2/\s
""";
private static final Pattern SPACE = Pattern.compile(" ");
private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 2805ebfe4ffe769bcde778a1225b3101c91538d8..3c4bfad55e438c5e723ef58c9cc24908af9e0846 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -265,7 +265,13 @@ public abstract class HangingEntity extends Entity {
@Override
public void readAdditionalSaveData(CompoundTag nbt) {
- this.pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
+ // Scissors start - Fix exploit where paintings are able to spawn out of bounds
+ final BlockPos pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
+ if (this.level.isLoadedAndInBounds(pos))
+ {
+ this.pos = pos;
+ }
+ // Scissors end
}
public abstract int getWidth();