properly override push/knockback methods

This prevent the creaking from being pushed with knockback
enchant when it can't move
This commit is contained in:
Lulu13022002
2024-12-04 21:05:57 +01:00
parent f93c8c78db
commit 7d18cb068e
4 changed files with 68 additions and 9 deletions

View File

@@ -111,12 +111,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
if (nbt.contains("DeathLootTable", 8)) {
- this.lootTable = Optional.of(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("DeathLootTable"))));
- } else {
- this.lootTable = Optional.empty();
+ this.lootTable = Optional.ofNullable(ResourceLocation.tryParse(nbt.getString("DeathLootTable"))).map((rs) -> ResourceKey.create(Registries.LOOT_TABLE, rs)); // Paper - Validate ResourceLocation } else {
+ this.lootTable = Optional.ofNullable(ResourceLocation.tryParse(nbt.getString("DeathLootTable"))).map((rs) -> ResourceKey.create(Registries.LOOT_TABLE, rs)); // Paper - Validate ResourceLocation
} else {
this.lootTable = Optional.empty();
}
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java