feat: Creaking NPC Type and its properties

This commit is contained in:
D3v1s0m 2024-12-12 14:30:22 +04:00
parent 8aed2ba5dc
commit 7fbe42e207
No known key found for this signature in database
GPG key ID: FA1F770C7B1D40C1
3 changed files with 21 additions and 0 deletions

View file

@ -667,6 +667,16 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
// Bogged
register(new BooleanProperty("bogged_sheared", 16, false, legacyBooleans));
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_21_2)) return;
// Creaking
register(new BooleanProperty("creaking_active", 17, false, legacyBooleans));
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_21_4)) return;
// Creaking
register(new BooleanProperty("creaking_crumbling", 18, false, legacyBooleans));
}
private void registerSerializer(PropertySerializer<?> serializer) {

View file

@ -176,6 +176,11 @@ public class NpcTypeImpl implements NpcType {
addProperties("wolf_variant");
}
}
if (version.isNewerThanOrEquals(ServerVersion.V_1_21_4)) {
if (EntityTypes.isTypeInstanceOf(type, EntityTypes.CREAKING)) {
addProperties("creaking_crumbling");
}
}
return new NpcTypeImpl(name, type, hologramOffset, new HashSet<>(allowedProperties), defaultProperties);
}
}

View file

@ -386,6 +386,12 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
register(builder(p, "breeze", EntityTypes.BREEZE)
.setHologramOffset(-0.205));
if (!version.isNewerThanOrEquals(ServerVersion.V_1_21_2)) return;
register(builder(p, "creaking", EntityTypes.CREAKING)
.setHologramOffset(0.725)
.addProperties("creaking_active"));
}
public Collection<NpcType> getAll() {