added Wolf properties and sitting property for tameable

This commit is contained in:
D3v1s0m 2023-10-02 10:24:31 +05:30
parent b1b10a04ee
commit e7601f8e4b
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1
3 changed files with 35 additions and 14 deletions

@ -99,10 +99,6 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
// Guardian
registerType("is_elder", false); // TODO: ensure it only works till 1.10. Note: index is wrong on wiki.vg
// Wolf
registerType("wolf_collar_color", DyeColor.RED); // TODO
registerType("wolf_angry", false); // TODO
// Show Golem
registerType("pumpkin", true); // TODO
@ -144,14 +140,15 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
linkProperties("glow", "fire", "invisible");
register(new BooleanProperty("silent", 4, false, legacyBooleans));
final int tamedIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) tamedIndex = 17;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_15)) tamedIndex = 16;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_14)) tamedIndex = 15;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_10)) tamedIndex = 13;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_9)) tamedIndex = 12;
else tamedIndex = 16;
register(new BitsetProperty("tamed", tamedIndex, 0x04));
final int tameableIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) tameableIndex = 17;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_15)) tameableIndex = 16;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_14)) tameableIndex = 15;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_10)) tameableIndex = 13;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_9)) tameableIndex = 12;
else tameableIndex = 16;
register(new BitsetProperty("sitting", tameableIndex, 0x01));
register(new BitsetProperty("tamed", tameableIndex, 0x04));
int potionIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) potionIndex = 10;
@ -348,6 +345,27 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
register(new EncodedByteProperty<>("sheep_color", DyeColor.WHITE, sheepIndex, DyeColor::getWoolData));
register(new BitsetProperty("sheep_sheared", sheepIndex, 0x10, false, legacyBooleans)); // no need to link because sheep_sheared is only visible when sheep_color is WHITE
// Wolf
int wolfIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) wolfIndex = 19;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_15)) wolfIndex = 18;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_10)) wolfIndex = 16;
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_9)) wolfIndex = 15;
else wolfIndex = 19;
register(new BooleanProperty("wolf_begging", wolfIndex++, false, legacyBooleans));
if (legacyBooleans) {
// noinspection deprecation
register(new EncodedByteProperty<>("wolf_collar", DyeColor.BLUE, wolfIndex++, DyeColor::getDyeData));
} else register(new EncodedIntegerProperty<>("wolf_collar", DyeColor.RED, wolfIndex++, Enum::ordinal));
if (ver.isNewerThanOrEquals(ServerVersion.V_1_16)) {
register(new EncodedIntegerProperty<>("wolf_angry", false, wolfIndex, b -> b ? 1 : 0));
linkProperties("tamed", "sitting");
}
else {
register(new BitsetProperty("wolf_angry", tameableIndex, 0x02));
linkProperties("wolf_angry", "tamed", "sitting");
}
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_10)) return;
// Polar Bear
int polarBearIndex;

@ -158,6 +158,9 @@ public class NpcTypeImpl implements NpcType {
addProperties("panda_eating");
}
}
if (EntityTypes.isTypeInstanceOf(type, EntityTypes.ABSTRACT_TAMEABLE_ANIMAL)) {
addProperties("tamed", "sitting");
}
return new NpcTypeImpl(name, type, hologramOffset, new HashSet<>(allowedProperties), defaultProperties);
}
}

@ -156,7 +156,7 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
register(builder(p, "wolf", EntityTypes.WOLF)
.setHologramOffset(-1.125)
.addProperties("tamed"));
.addProperties("wolf_begging", "wolf_collar", "wolf_angry"));
register(builder(p, "zombie", EntityTypes.ZOMBIE)
.setHologramOffset(-0.025)
@ -269,7 +269,7 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
register(builder(p, "cat", EntityTypes.CAT)
.setHologramOffset(-1.275)
.addProperties("cat_variant", "cat_laying", "cat_relaxed", "cat_collar", "tamed"));
.addProperties("cat_variant", "cat_laying", "cat_relaxed", "cat_collar"));
register(builder(p, "fox", EntityTypes.FOX)
.setHologramOffset(-1.275)