From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Video Date: Sun, 20 Mar 2022 04:39:09 -0600 Subject: [PATCH] Fixes crash exploit related to out of bounds Axolotl variants diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java index 2b8725087fd3bfeca7162bda2783fdacd13a8390..802c9c87df190dce09f9e703cedcb06874c58389 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -118,7 +118,7 @@ public class Axolotl extends Animal implements LerpingModel, Bucketable { @Override public void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); - this.setVariant(Axolotl.Variant.BY_ID[nbt.getInt("Variant")]); + this.setVariant(Axolotl.Variant.BY_ID[Math.min(Math.abs(nbt.getInt("Variant")), 4)]); // Scissors - Fixes out of bounds Axolotl variant exploit this.setFromBucket(nbt.getBoolean("FromBucket")); } @@ -361,7 +361,7 @@ public class Axolotl extends Animal implements LerpingModel, Bucketable { @Override public void loadFromBucketTag(CompoundTag nbt) { Bucketable.loadDefaultDataFromBucketTag(this, nbt); - this.setVariant(Axolotl.Variant.BY_ID[nbt.getInt("Variant")]); + this.setVariant(Axolotl.Variant.BY_ID[Math.min(Math.abs(nbt.getInt("Variant")), 4)]); // Scissors - Fix out-of-bounds Axolotl variant exploit if (nbt.contains("Age")) { this.setAge(nbt.getInt("Age")); }