Added Panda properties
This commit is contained in:
parent
747e6b92be
commit
4c8d25c4df
5 changed files with 42 additions and 7 deletions
11
api/src/main/java/lol/pyr/znpcsplus/util/PandaGene.java
Normal file
11
api/src/main/java/lol/pyr/znpcsplus/util/PandaGene.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package lol.pyr.znpcsplus.util;
|
||||
|
||||
public enum PandaGene {
|
||||
NORMAL,
|
||||
LAZY,
|
||||
WORRIED,
|
||||
PLAYFUL,
|
||||
BROWN,
|
||||
WEAK,
|
||||
AGGRESSIVE
|
||||
}
|
|
@ -273,6 +273,7 @@ public class ZNpcsPlus extends JavaPlugin {
|
|||
registerEnumParser(manager, LlamaVariant.class, incorrectUsageMessage);
|
||||
registerEnumParser(manager, MooshroomVariant.class, incorrectUsageMessage);
|
||||
registerEnumParser(manager, OcelotType.class, incorrectUsageMessage);
|
||||
registerEnumParser(manager, PandaGene.class, incorrectUsageMessage);
|
||||
|
||||
manager.registerCommand("npc", new MultiCommand(loadHelpMessage("root"))
|
||||
.addSubcommand("create", new CreateCommand(npcRegistry, typeRegistry))
|
||||
|
|
|
@ -67,6 +67,7 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
registerEnumSerializer(LlamaVariant.class);
|
||||
registerEnumSerializer(MooshroomVariant.class);
|
||||
registerEnumSerializer(OcelotType.class);
|
||||
registerEnumSerializer(PandaGene.class);
|
||||
|
||||
/*
|
||||
registerType("using_item", false); // TODO: fix it for 1.8 and add new property to use offhand item and riptide animation
|
||||
|
@ -96,12 +97,6 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
// Sniffer
|
||||
registerType("sniffer_state", null); // TODO: Nothing on wiki.vg, look in mc source
|
||||
|
||||
// Panda
|
||||
registerType("panda_sneezing", false); // TODO
|
||||
registerType("panda_rolling", false); // TODO
|
||||
registerType("panda_sitting", false); // TODO
|
||||
registerType("panda_on_back", false); // TODO
|
||||
|
||||
// Pig
|
||||
registerType("pig_saddle", false); // TODO
|
||||
|
||||
|
@ -399,6 +394,26 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
else mooshroomIndex = 15;
|
||||
register(new EncodedStringProperty<>("mooshroom_variant", MooshroomVariant.RED, mooshroomIndex, MooshroomVariant::getVariantName));
|
||||
|
||||
// Panda
|
||||
int pandaIndex;
|
||||
if (ver.isNewerThanOrEquals(ServerVersion.V_1_17)) pandaIndex = 20;
|
||||
else if (ver.isNewerThanOrEquals(ServerVersion.V_1_15)) pandaIndex = 19;
|
||||
else pandaIndex = 18;
|
||||
register(new EncodedByteProperty<>("panda_main_gene", PandaGene.NORMAL, pandaIndex++, obj -> (byte) obj.ordinal()));
|
||||
register(new EncodedByteProperty<>("panda_hidden_gene", PandaGene.NORMAL, pandaIndex++, obj -> (byte) obj.ordinal()));
|
||||
if (ver.isNewerThanOrEquals(ServerVersion.V_1_15)) {
|
||||
register(new BitsetProperty("panda_sneezing", pandaIndex, 0x02));
|
||||
register(new BitsetProperty("panda_rolling", pandaIndex, 0x04));
|
||||
register(new BitsetProperty("panda_sitting", pandaIndex, 0x08));
|
||||
register(new BitsetProperty("panda_on_back", pandaIndex, 0x10));
|
||||
linkProperties("panda_sneezing", "panda_rolling", "panda_sitting", "panda_on_back");
|
||||
} else {
|
||||
register(new BitsetProperty("panda_sneezing", pandaIndex, 0x02));
|
||||
register(new BitsetProperty("panda_eating", pandaIndex, 0x04));
|
||||
linkProperties("panda_sneezing", "panda_eating");
|
||||
}
|
||||
|
||||
|
||||
if (!ver.isNewerThanOrEquals(ServerVersion.V_1_15)) return;
|
||||
|
||||
register(new BitsetProperty("fox_faceplanted", foxIndex, 0x40));
|
||||
|
|
|
@ -144,6 +144,13 @@ public class NpcTypeImpl implements NpcType {
|
|||
addProperties("ocelot_type");
|
||||
}
|
||||
}
|
||||
if (EntityTypes.isTypeInstanceOf(type, EntityTypes.PANDA)) {
|
||||
if (version.isNewerThanOrEquals(ServerVersion.V_1_15)) {
|
||||
addProperties("panda_rolling", "panda_sitting", "panda_on_back");
|
||||
} else {
|
||||
addProperties("panda_eating");
|
||||
}
|
||||
}
|
||||
return new NpcTypeImpl(name, type, hologramOffset, new HashSet<>(allowedProperties), defaultProperties);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,7 +268,8 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
|
|||
.addProperties("hand", "fox_variant", "fox_sitting", "fox_crouching", "fox_sleeping", "fox_faceplanted"));
|
||||
|
||||
register(builder(p, "panda", EntityTypes.PANDA)
|
||||
.setHologramOffset(-0.725));
|
||||
.setHologramOffset(-0.725)
|
||||
.addProperties("panda_main_gene", "panda_hidden_gene", "panda_sneezing"));
|
||||
|
||||
register(builder(p, "pillager", EntityTypes.PILLAGER)
|
||||
.setHologramOffset(-0.025)
|
||||
|
|
Loading…
Reference in a new issue