mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-30 16:16:00 +00:00
55 lines
2.8 KiB
Diff
55 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Video <videogamesm12@gmail.com>
|
|
Date: Fri, 22 Apr 2022 01:19:49 -0500
|
|
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 2481c50d8eb58a003e30e2d957b877bce5123a3a..6b284666eae8b7e0ef8f54dfe9311a0979b420fe 100644
|
|
--- 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 {
|
|
}
|
|
|
|
public void setPotionType(String string) {
|
|
- 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
|
|
index ac0f0a4da4282c13f6e1f37710cb615d66b8ef2c..e789bcb0c426651a48fb3c78e885c6e3fafb0416 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
@@ -518,7 +518,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
|
}), (entity) -> {
|
|
entity.load(nbt);
|
|
}, () -> {
|
|
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
|
+ // Scissors - Don't log invalid entities
|
|
});
|
|
}
|
|
|
|
@@ -537,7 +537,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
|
}
|
|
|
|
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
|
|
index 3646b969fa51b9683ab4137e530c3a6f6fc6c465..286e9a8d3673be3a7fef2af6402e025d3058f6e7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
@@ -579,7 +579,7 @@ public abstract class Mob extends LivingEntity {
|
|
|
|
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");
|
|
}
|
|
|