From c5c912183354773896f488c985b1e8c0f5c066cd Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sun, 10 Dec 2023 13:43:18 -0600 Subject: [PATCH] add another --- build-data/dev-imports.txt | 3 +- .../0003-ResourceLocation-validation.patch | 44 ++++++++++--------- 2 files changed, 25 insertions(+), 22 deletions(-) rename patches/{unapplied => }/server/0003-ResourceLocation-validation.patch (87%) diff --git a/build-data/dev-imports.txt b/build-data/dev-imports.txt index 74f43a3..72a2c5f 100644 --- a/build-data/dev-imports.txt +++ b/build-data/dev-imports.txt @@ -9,4 +9,5 @@ # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java -minecraft net/minecraft/network/chat/HoverEvent \ No newline at end of file +minecraft net/minecraft/network/chat/HoverEvent +minecraft net/minecraft/world/entity/EntityType \ No newline at end of file diff --git a/patches/unapplied/server/0003-ResourceLocation-validation.patch b/patches/server/0003-ResourceLocation-validation.patch similarity index 87% rename from patches/unapplied/server/0003-ResourceLocation-validation.patch rename to patches/server/0003-ResourceLocation-validation.patch index bc946a2..bed355f 100644 --- a/patches/unapplied/server/0003-ResourceLocation-validation.patch +++ b/patches/server/0003-ResourceLocation-validation.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Video -Date: Sun, 13 Mar 2022 07:39:26 -0600 +From: Telesphoreo +Date: Sun, 10 Dec 2023 13:40:21 -0600 Subject: [PATCH] ResourceLocation validation @@ -44,10 +44,10 @@ index 1f55185814125c691288294d18bf1580461c8066..259d65f8e21f9cf99585d416eafdc967 } diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 73871f456a85bda1e51f54986d0e61fb629822e8..df16049a70061c7c38d72b188d054339f5434e03 100644 +index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..297a214a7833fd67640c94352671483bc4fc8dd5 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -589,7 +589,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -593,7 +593,7 @@ public class EntityType implements FeatureElement, EntityTypeT }), (entity) -> { entity.load(nbt); }, () -> { @@ -56,7 +56,7 @@ index 73871f456a85bda1e51f54986d0e61fb629822e8..df16049a70061c7c38d72b188d054339 }); } -@@ -608,7 +608,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -612,7 +612,7 @@ public class EntityType implements FeatureElement, EntityTypeT } public static Optional> by(CompoundTag nbt) { @@ -66,10 +66,10 @@ index 73871f456a85bda1e51f54986d0e61fb629822e8..df16049a70061c7c38d72b188d054339 @Nullable diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index d28c477171c1b6888a45175075017d960464b5cd..cc46185c05a735d4443b266423215f1f7a0c7741 100644 +index 5af48151159135b869ec4753bbcf79dd257c1570..6c4425c08ea4a4444bac50fe5cf587870d9576a5 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -619,7 +619,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -620,7 +620,7 @@ public abstract class Mob extends LivingEntity implements Targeting { this.setLeftHanded(nbt.getBoolean("LeftHanded")); if (nbt.contains("DeathLootTable", 8)) { @@ -97,7 +97,7 @@ index a18aadbf7ae83713e1f2b21553185d8000bc7699..f5ad7ddf13cbb6452c2927aef9b54eae // Paper start - cook speed API diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java -index 0425151e688966442340ea1cf892aff34ffe0791..244b04e0020b1bd1e7be34a1b6266a8ac75d29fc 100644 +index b5b1831631e233a96b6fd55972a8862b0f420da8..a086f12c09a5e38f63c8de118fcb5a6a30e40b52 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java @@ -199,7 +199,7 @@ public class BrushableBlockEntity extends BlockEntity { @@ -110,17 +110,17 @@ index 0425151e688966442340ea1cf892aff34ffe0791..244b04e0020b1bd1e7be34a1b6266a8a return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index 081691f9710ff1115e4308f79ed49fbc38941193..c29dfd15e147d5c4d9c9584ff7803c2a52009f0d 100644 +index 64875525df244db838560f5fefb7b1b07b0f1f51..fd490db7431404b0324e5ade474ec95d694aa489 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -@@ -46,7 +46,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc - protected boolean tryLoadLootTable(CompoundTag nbt) { +@@ -50,7 +50,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc + // Copied from super with changes, always check the original method this.lootableData.loadNbt(nbt); // Paper if (nbt.contains("LootTable", 8)) { -- this.lootTable = new ResourceLocation(nbt.getString("LootTable")); -+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Scissors - Validate loot tables +- this.setLootTable(new ResourceLocation(nbt.getString("LootTable"))); ++ this.setLootTable(ResourceLocation.tryParse((nbt.getString("LootTable")))); // Scissors - Validate loot tables try { org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.lootTable); } catch (IllegalArgumentException ex) { this.lootTable = null; } // Paper - validate - this.lootTableSeed = nbt.getLong("LootTableSeed"); + this.setLootTableSeed(nbt.getLong("LootTableSeed")); return false; // Paper - always load the items, table may still remain diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java index f6942cb3ef1f9ef03708d4bc932ea9aeb1c13894..8b32864bafb3c1948993688be8f639dd6492057e 100644 @@ -144,20 +144,21 @@ index f6942cb3ef1f9ef03708d4bc932ea9aeb1c13894..8b32864bafb3c1948993688be8f639dd @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java -index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..aa7fa17b9fb8519d8b57e27a5b422249b9b875d8 100644 +index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..a115a13ec911884a804800fc13f0347be1a30932 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java -@@ -33,8 +33,14 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo +@@ -33,8 +33,15 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo return null; // return empty loot table? } - NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable); - return Bukkit.getLootTable(key); + // Scissors start - Return a null loot table if the specified loot table is not valid -+ try { ++ try ++ { + NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable); + return Bukkit.getLootTable(key); -+ } catch (Exception ex) { ++ } catch (Exception exception) { + return null; + } + // Scissors end @@ -165,17 +166,18 @@ index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..aa7fa17b9fb8519d8b57e27a5b422249 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index b4e45d8e9851552f30c9c29d3d9671e1e9094c38..4e8e1a6b718d9ec8720efb648ab023e9e39f67e3 100644 +index 5f6a1fb323782816f706ccf7df922cb203238302..21b4594379a5e904ad60f9c9512ace94e7ed5f68 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -@@ -80,8 +80,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { +@@ -80,8 +80,15 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { @Override public LootTable getLootTable() { - NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable()); - return Bukkit.getLootTable(key); + // Scissors start - Return a null loot table if the specified loot table is not valid -+ try { ++ try ++ { + NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable()); + return Bukkit.getLootTable(key); + } catch (Exception ex) {