2022-04-22 06:17:57 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2022-04-22 06:20:00 +00:00
|
|
|
From: Telesphoreo <me@telesphoreo.me>
|
|
|
|
Date: Fri, 22 Apr 2022 01:19:49 -0500
|
2022-04-22 06:17:57 +00:00
|
|
|
Subject: [PATCH] Even more resource location validation
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
2022-04-22 06:20:00 +00:00
|
|
|
index 2481c50d8eb58a003e30e2d957b877bce5123a3a..6b284666eae8b7e0ef8f54dfe9311a0979b420fe 100644
|
2022-04-22 06:17:57 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
|
|
@@ -143,7 +143,7 @@ public class AreaEffectCloud extends Entity {
|
|
|
|
}
|
|
|
|
|
2022-04-22 06:20:00 +00:00
|
|
|
public void setPotionType(String string) {
|
2022-04-22 06:17:57 +00:00
|
|
|
- this.setPotion(Registry.POTION.get(new ResourceLocation(string)));
|
|
|
|
+ this.setPotion(Registry.POTION.get(ResourceLocation.tryParse(string))); // Scissors - Validate resource locations
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
2022-04-22 06:20:00 +00:00
|
|
|
index 79abd84696ef099f6b12ddeaa6e398f18c53316a..7070b64c0c66b5c9d09bf7764ce506f4461dbac5 100644
|
2022-04-22 06:17:57 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
2022-04-22 06:20:00 +00:00
|
|
|
@@ -514,7 +514,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
2022-04-22 06:17:57 +00:00
|
|
|
}), (entity) -> {
|
|
|
|
entity.load(nbt);
|
|
|
|
}, () -> {
|
|
|
|
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
|
|
|
+ // Scissors - Don't log invalid entities
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-04-22 06:20:00 +00:00
|
|
|
@@ -538,7 +538,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
2022-04-22 06:17:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Optional<EntityType<?>> by(CompoundTag nbt) {
|
|
|
|
- return Registry.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id")));
|
|
|
|
+ return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); // Scissors - Validate resource locations
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
2022-05-10 04:45:38 +00:00
|
|
|
index e3227a806d9e19923783122ea94ae19e7dbe71da..473dba5213f6aed7573e970119f4b6ad0e4f6367 100644
|
2022-04-22 06:17:57 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
2022-05-10 04:45:38 +00:00
|
|
|
@@ -572,7 +572,7 @@ public abstract class Mob extends LivingEntity {
|
2022-04-22 06:17:57 +00:00
|
|
|
|
|
|
|
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
|
|
|
|
if (nbt.contains("DeathLootTable", 8)) {
|
|
|
|
- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable"));
|
|
|
|
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); // Scissors - Validate resource locations
|
|
|
|
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
|
|
|
|
}
|
|
|
|
|