Added evoker_spell property.
This commit is contained in:
parent
49c23a85a4
commit
8c83cb3428
13 changed files with 63 additions and 1 deletions
10
api/src/main/java/lol/pyr/znpcsplus/util/SpellType.java
Normal file
10
api/src/main/java/lol/pyr/znpcsplus/util/SpellType.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package lol.pyr.znpcsplus.util;
|
||||
|
||||
public enum SpellType {
|
||||
NONE,
|
||||
SUMMON_VEX,
|
||||
ATTACK,
|
||||
WOLOLO,
|
||||
DISAPPEAR,
|
||||
BLINDNESS,
|
||||
}
|
|
@ -284,6 +284,7 @@ public class ZNpcsPlus extends JavaPlugin {
|
|||
registerEnumParser(manager, CatVariant.class, incorrectUsageMessage);
|
||||
registerEnumParser(manager, CreeperState.class, incorrectUsageMessage);
|
||||
registerEnumParser(manager, ParrotVariant.class, incorrectUsageMessage);
|
||||
registerEnumParser(manager, SpellType.class, incorrectUsageMessage);
|
||||
|
||||
manager.registerCommand("npc", new MultiCommand(loadHelpMessage("root"))
|
||||
.addSubcommand("create", new CreateCommand(npcRegistry, typeRegistry))
|
||||
|
|
|
@ -125,6 +125,7 @@ public class PropertySetCommand implements CommandHandler {
|
|||
if (type == CreeperState.class) return context.suggestEnum(CreeperState.values());
|
||||
if (type == ParrotVariant.class) return context.suggestEnum(ParrotVariant.values());
|
||||
if (type == BlockState.class) return context.suggestLiteral("hand", "looking_at", "block");
|
||||
if (type == SpellType.class) return context.suggestEnum(SpellType.values());
|
||||
}
|
||||
else if (context.argSize() == 4) {
|
||||
if (type == BlockState.class) {
|
||||
|
|
|
@ -38,6 +38,7 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
registerEnumSerializer(CatVariant.class);
|
||||
registerEnumSerializer(CreeperState.class);
|
||||
registerEnumSerializer(ParrotVariant.class);
|
||||
registerEnumSerializer(SpellType.class);
|
||||
|
||||
registerType("glow", NamedTextColor.class);
|
||||
registerType("fire", false);
|
||||
|
@ -118,6 +119,9 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
registerType("enderman_screaming", false); // TODO
|
||||
registerType("enderman_staring", false); // TODO
|
||||
|
||||
// Evoker
|
||||
registerType("evoker_spell", SpellType.NONE);
|
||||
|
||||
// Pufferfish
|
||||
registerType("puff_state", null); // TODO: Make a puff state enum class
|
||||
|
||||
|
|
|
@ -73,4 +73,7 @@ public interface MetadataFactory {
|
|||
EntityData endermanHeldBlock(int heldBlock);
|
||||
EntityData endermanScreaming(boolean screaming);
|
||||
EntityData endermanStaring(boolean staring);
|
||||
|
||||
// Evoker
|
||||
EntityData evokerSpell(int spell);
|
||||
}
|
||||
|
|
|
@ -13,4 +13,9 @@ public class V1_11MetadataFactory extends V1_10MetadataFactory {
|
|||
public EntityData usingItem(boolean usingItem, boolean offHand, boolean riptide) {
|
||||
return newEntityData(6, EntityDataTypes.BYTE, (byte) ((usingItem ? 0x01 : 0) | (offHand ? 0x02 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData evokerSpell(int spell) {
|
||||
return newEntityData(12, EntityDataTypes.BYTE, (byte) spell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,9 @@ public class V1_12MetadataFactory extends V1_11MetadataFactory {
|
|||
public EntityData createShoulderEntityRight(int index, ParrotVariant variant) {
|
||||
return newEntityData(index, EntityDataTypes.NBT, variant == ParrotVariant.NONE ? new NBTCompound() : new ParrotNBTCompound(variant).getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData evokerSpell(int spell) {
|
||||
return newEntityData(13, EntityDataTypes.BYTE, (byte) spell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,4 +114,19 @@ public class V1_14MetadataFactory extends V1_13MetadataFactory {
|
|||
public EntityData creeperCharged(boolean charged) {
|
||||
return newEntityData(15, EntityDataTypes.BOOLEAN, charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData evokerSpell(int spell) {
|
||||
return newEntityData(15, EntityDataTypes.BYTE, (byte) spell);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public EntityData foxVariant(int variant) {
|
||||
// return newEntityData(15, EntityDataTypes.INT, variant);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EntityData foxProperties(boolean sitting, boolean crouching, boolean sleeping, boolean facePlanted) {
|
||||
// return newEntityData(16, EntityDataTypes.BYTE, (byte) ((sitting ? 0x01 : 0) | (crouching ? 0x04 : 0) | (sleeping ? 0x20 : 0)));
|
||||
// }
|
||||
|
|
|
@ -98,4 +98,9 @@ public class V1_15MetadataFactory extends V1_14MetadataFactory {
|
|||
public EntityData creeperCharged(boolean charged) {
|
||||
return newEntityData(16, EntityDataTypes.BOOLEAN, charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData evokerSpell(int spell) {
|
||||
return newEntityData(16, EntityDataTypes.BYTE, (byte) spell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,4 +158,9 @@ public class V1_17MetadataFactory extends V1_16MetadataFactory {
|
|||
public EntityData endermanStaring(boolean staring) {
|
||||
return newEntityData(18, EntityDataTypes.BOOLEAN, staring);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData evokerSpell(int spell) {
|
||||
return newEntityData(17, EntityDataTypes.BYTE, (byte) spell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,6 +180,11 @@ public class V1_8MetadataFactory implements MetadataFactory {
|
|||
return newEntityData(18, EntityDataTypes.BOOLEAN, staring);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData evokerSpell(int spell) {
|
||||
throw new UnsupportedOperationException("The evoker spell entity data isn't supported on this version");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityData silent(boolean enabled) {
|
||||
return newEntityData(4, EntityDataTypes.BYTE, (byte) (enabled ? 1 : 0));
|
||||
|
|
|
@ -193,7 +193,8 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
|
|||
if (!version.isNewerThanOrEquals(ServerVersion.V_1_11)) return;
|
||||
|
||||
register(builder(p, "evoker", EntityTypes.EVOKER)
|
||||
.setHologramOffset(-0.025));
|
||||
.setHologramOffset(-0.025)
|
||||
.addProperties("evoker_spell"));
|
||||
|
||||
register(builder(p, "llama", EntityTypes.LLAMA)
|
||||
.setHologramOffset(-0.105));
|
||||
|
|
|
@ -195,6 +195,8 @@ public class V1_8PacketFactory implements PacketFactory {
|
|||
);
|
||||
add(data, metadataFactory.endermanScreaming(properties.getProperty(propertyRegistry.getByName("enderman_screaming", Boolean.class))));
|
||||
add(data, metadataFactory.endermanStaring(properties.getProperty(propertyRegistry.getByName("enderman_staring", Boolean.class))));
|
||||
} else if (entity.getType().equals(EntityTypes.EVOKER)) {
|
||||
add(data, metadataFactory.evokerSpell(properties.getProperty(propertyRegistry.getByName("evoker_spell", SpellType.class)).ordinal()));
|
||||
}
|
||||
|
||||
if (properties.getProperty(propertyRegistry.getByName("dinnerbone", Boolean.class))) {
|
||||
|
|
Loading…
Reference in a new issue