implement hoglin

This commit is contained in:
Pyrbu 2023-08-07 22:35:33 +02:00
parent 551b989240
commit 3741b76189
5 changed files with 7 additions and 31 deletions

@ -76,17 +76,9 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
registerType("axolotl_variant", 0); registerType("axolotl_variant", 0);
registerType("playing_dead", false); // TODO fix disabling registerType("playing_dead", false); // TODO fix disabling
// Bat
registerType("hanging", false);
// Blaze // Blaze
registerType("blaze_on_fire", false); registerType("blaze_on_fire", false);
// Cat
registerType("cat_variant", CatVariant.BLACK);
registerType("cat_lying", false);
registerType("cat_collar_color", DyeColor.RED);
// Creeper // Creeper
registerType("creeper_state", CreeperState.IDLE); registerType("creeper_state", CreeperState.IDLE);
registerType("creeper_charged", false); registerType("creeper_charged", false);
@ -105,9 +97,6 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
// Guardian // Guardian
registerType("is_elder", false); // TODO: ensure it only works till 1.10. Note: index is wrong on wiki.vg registerType("is_elder", false); // TODO: ensure it only works till 1.10. Note: index is wrong on wiki.vg
// Piglin / Hoglin
registerType("immune_to_zombification", true);
// Pufferfish // Pufferfish
registerType("puff_state", null); // TODO: Make a puff state enum class registerType("puff_state", null); // TODO: Make a puff state enum class
@ -318,6 +307,13 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
register(new BitsetProperty("has_nectar", beeIndex++, 0x08)); register(new BitsetProperty("has_nectar", beeIndex++, 0x08));
register(new EncodedIntegerProperty<>("angry", false, beeIndex, enabled -> enabled ? 1 : 0)); register(new EncodedIntegerProperty<>("angry", false, beeIndex, enabled -> enabled ? 1 : 0));
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_16)) return;
final int zombificationIndex;
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) zombificationIndex = 17;
else zombificationIndex = 16;
register(new BooleanProperty("immune_to_zombification", zombificationIndex, false, legacyBooleans));
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_17)) return; if (!ver.isNewerThanOrEquals(ServerVersion.V_1_17)) return;
// Goat // Goat

@ -51,9 +51,6 @@ public interface MetadataFactory {
// Frog // Frog
EntityData frogVariant(int variant); EntityData frogVariant(int variant);
// Hoglin
EntityData hoglinImmuneToZombification(boolean immuneToZombification);
// Villager // Villager
EntityData villagerData(int type, int profession, int level); EntityData villagerData(int type, int profession, int level);
} }

@ -1,13 +1,6 @@
package lol.pyr.znpcsplus.metadata; package lol.pyr.znpcsplus.metadata;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
@Deprecated @Deprecated
public class V1_16MetadataFactory extends V1_15MetadataFactory { public class V1_16MetadataFactory extends V1_15MetadataFactory {
@Override
public EntityData hoglinImmuneToZombification(boolean immuneToZombification) {
return newEntityData(16, EntityDataTypes.BOOLEAN, immuneToZombification);
}
} }

@ -69,11 +69,6 @@ public class V1_17MetadataFactory extends V1_16MetadataFactory {
return newEntityData(17, EntityDataTypes.BYTE, (byte) spell); return newEntityData(17, EntityDataTypes.BYTE, (byte) spell);
} }
@Override
public EntityData hoglinImmuneToZombification(boolean immuneToZombification) {
return newEntityData(17, EntityDataTypes.BOOLEAN, immuneToZombification);
}
@Override @Override
public EntityData villagerData(int type, int profession, int level) { public EntityData villagerData(int type, int profession, int level) {
return newEntityData(18, EntityDataTypes.VILLAGER_DATA, new VillagerData(type, profession, level)); return newEntityData(18, EntityDataTypes.VILLAGER_DATA, new VillagerData(type, profession, level));

@ -79,11 +79,6 @@ public class V1_8MetadataFactory implements MetadataFactory {
throw new UnsupportedOperationException("The frog variant entity data isn't supported on this version"); throw new UnsupportedOperationException("The frog variant entity data isn't supported on this version");
} }
@Override
public EntityData hoglinImmuneToZombification(boolean immuneToZombification) {
throw new UnsupportedOperationException("The hoglin zombification entity data isn't supported on this version");
}
@Override @Override
public EntityData villagerData(int type, int profession, int level) { public EntityData villagerData(int type, int profession, int level) {
return newEntityData(16, EntityDataTypes.INT, profession); return newEntityData(16, EntityDataTypes.INT, profession);