Improve horse armor patch in 1.8->1.9 (#3773)

This commit is contained in:
EnZaXD 2024-04-05 15:46:20 +02:00 committed by GitHub
parent 868a5bd24e
commit 5569caf610
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -175,12 +175,14 @@ public class EntityTracker1_9 extends EntityTrackerBase {
}
}
//ECHOPET Patch
if (type == EntityType.HORSE) {
// Wrong metadata value from EchoPet, patch since it's discontinued. (https://github.com/DSH105/EchoPet/blob/06947a8b08ce40be9a518c2982af494b3b99d140/modules/API/src/main/java/com/dsh105/echopet/compat/api/entity/HorseArmour.java#L22)
if (metadata.id() == 16 && (int) metadata.getValue() == Integer.MIN_VALUE)
// 1.8 can handle out of range values and will just not show any armor, 1.9+ clients will get
// exceptions and won't render the entity at all
if (type == EntityType.HORSE && metadata.id() == 16) {
final int value = metadata.value();
if (value < 0 || value > 3) { // no armor, iron armor, gold armor and diamond armor
metadata.setValue(0);
}
}
if (type == EntityType.PLAYER) {
if (metadata.id() == 0) {