mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-27 07:05:39 +00:00
55 lines
2.9 KiB
Diff
55 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Telesphoreo <me@telesphoreo.me>
|
|
Date: Sat, 10 Dec 2022 23:02:48 -0600
|
|
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
|
|
index 168b60fda38a7172f4473017ccc42447b36faab2..9f01b0f18bf656a7ab62f07cc98aaded96432665 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
@@ -145,7 +145,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
|
|
}
|
|
|
|
public void setPotionType(String string) {
|
|
- this.setPotion(BuiltInRegistries.POTION.get(new ResourceLocation(string)));
|
|
+ this.setPotion(BuiltInRegistries.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
|
|
index ceacc0d383e2ee674783d3c0a7df0a951595faca..32b2558fca4642373f7794449e89bfe275c5cf0d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
@@ -588,7 +588,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
|
}), (entity) -> {
|
|
entity.load(nbt);
|
|
}, () -> {
|
|
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
|
+ /*EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));*/ // Scissors - Don't log invalid entities
|
|
});
|
|
}
|
|
|
|
@@ -607,7 +607,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
|
}
|
|
|
|
public static Optional<EntityType<?>> by(CompoundTag nbt) {
|
|
- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id")));
|
|
+ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id")));
|
|
}
|
|
|
|
@Nullable
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..9a64944c6769ced4d82b8edbbc045b870a256cb9 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
@@ -615,7 +615,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
|
|
|
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
|
|
if (nbt.contains("DeathLootTable", 8)) {
|
|
- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable"));
|
|
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable"));
|
|
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
|
|
}
|
|
|