diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java index eb377464..7b992bd6 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/MetaIndex.java @@ -33,14 +33,14 @@ public class MetaIndex { /** * The color of the Area Effect Cloud as RGB integer */ - public static MetaIndex AREA_EFFECT_CLOUD_COLOR = new MetaIndex<>(AreaEffectCloudWatcher.class, 1, - Color.BLACK.asRGB()); + public static MetaIndex AREA_EFFECT_CLOUD_COLOR = + new MetaIndex<>(AreaEffectCloudWatcher.class, 1, Color.BLACK.asRGB()); /** * Ignore radius and show effect as single point, not area */ - public static MetaIndex AREA_EFFECT_IGNORE_RADIUS = new MetaIndex<>(AreaEffectCloudWatcher.class, 2, - false); + public static MetaIndex AREA_EFFECT_IGNORE_RADIUS = + new MetaIndex<>(AreaEffectCloudWatcher.class, 2, false); /** * The type of particle to display @@ -53,12 +53,12 @@ public class MetaIndex { public static MetaIndex AREA_EFFECT_PARTICLE_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 3, 0); @NmsRemovedIn(NmsVersion.v1_13) - public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_1_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 4, - 0); + public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_1_OLD = + new MetaIndex<>(AreaEffectCloudWatcher.class, 4, 0); @NmsRemovedIn(NmsVersion.v1_13) - public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_2_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 5, - 0); + public static MetaIndex AREA_EFFECT_PARTICLE_PARAM_2_OLD = + new MetaIndex<>(AreaEffectCloudWatcher.class, 5, 0); /** * The size of the area @@ -68,26 +68,26 @@ public class MetaIndex { /** * Armorstand body eular vector */ - public static MetaIndex ARMORSTAND_BODY = new MetaIndex<>(ArmorStandWatcher.class, 2, - new Vector3F(0, 0, 0)); + public static MetaIndex ARMORSTAND_BODY = + new MetaIndex<>(ArmorStandWatcher.class, 2, new Vector3F(0, 0, 0)); /** * Armorstand head eular vector */ - public static MetaIndex ARMORSTAND_HEAD = new MetaIndex<>(ArmorStandWatcher.class, 1, - new Vector3F(0, 0, 0)); + public static MetaIndex ARMORSTAND_HEAD = + new MetaIndex<>(ArmorStandWatcher.class, 1, new Vector3F(0, 0, 0)); /** * Armorstand left arm eular vector */ - public static MetaIndex ARMORSTAND_LEFT_ARM = new MetaIndex<>(ArmorStandWatcher.class, 3, - new Vector3F(-10, 0, -10)); + public static MetaIndex ARMORSTAND_LEFT_ARM = + new MetaIndex<>(ArmorStandWatcher.class, 3, new Vector3F(-10, 0, -10)); /** * Armorstand left leg eular vector */ - public static MetaIndex ARMORSTAND_LEFT_LEG = new MetaIndex<>(ArmorStandWatcher.class, 5, - new Vector3F(-1, 0, -1)); + public static MetaIndex ARMORSTAND_LEFT_LEG = + new MetaIndex<>(ArmorStandWatcher.class, 5, new Vector3F(-1, 0, -1)); /** * Armorstand metadata @@ -97,14 +97,14 @@ public class MetaIndex { /** * Armorstand right arm eular vector */ - public static MetaIndex ARMORSTAND_RIGHT_ARM = new MetaIndex<>(ArmorStandWatcher.class, 4, - new Vector3F(-15, 0, 10)); + public static MetaIndex ARMORSTAND_RIGHT_ARM = + new MetaIndex<>(ArmorStandWatcher.class, 4, new Vector3F(-15, 0, 10)); /** * Armorstand right leg eular vector */ - public static MetaIndex ARMORSTAND_RIGHT_LEG = new MetaIndex<>(ArmorStandWatcher.class, 6, - new Vector3F(1, 0, 1)); + public static MetaIndex ARMORSTAND_RIGHT_LEG = + new MetaIndex<>(ArmorStandWatcher.class, 6, new Vector3F(1, 0, 1)); /** * If the arrow is a critical strike @@ -188,8 +188,8 @@ public class MetaIndex { /** * No visible effect */ - public static MetaIndex DOLPHIN_TREASURE_POS = new MetaIndex<>(DolphinWatcher.class, 0, - BlockPosition.ORIGIN); + public static MetaIndex DOLPHIN_TREASURE_POS = + new MetaIndex<>(DolphinWatcher.class, 0, BlockPosition.ORIGIN); /** * No visible effect */ @@ -203,11 +203,11 @@ public class MetaIndex { /** * The itemstack of the dropped item, must be set */ - public static MetaIndex DROPPED_ITEM = new MetaIndex<>(DroppedItemWatcher.class, 0, - new ItemStack(Material.AIR)); + public static MetaIndex DROPPED_ITEM = + new MetaIndex<>(DroppedItemWatcher.class, 0, new ItemStack(Material.AIR)); - public static MetaIndex> ENDER_CRYSTAL_BEAM = new MetaIndex<>(EnderCrystalWatcher.class, 0, - Optional.empty()); + public static MetaIndex> ENDER_CRYSTAL_BEAM = + new MetaIndex<>(EnderCrystalWatcher.class, 0, Optional.empty()); /** * If the ender crystal has a plate @@ -217,8 +217,8 @@ public class MetaIndex { public static MetaIndex ENDER_DRAGON_PHASE = new MetaIndex<>(EnderDragonWatcher.class, 0, 10); @NmsAddedIn(NmsVersion.v1_14) - public static MetaIndex ENDER_SIGNAL_ITEM = new MetaIndex<>(EnderSignalWatcher.class, 0, - new ItemStack(Material.AIR)); + public static MetaIndex ENDER_SIGNAL_ITEM = + new MetaIndex<>(EnderSignalWatcher.class, 0, new ItemStack(Material.AIR)); /** * If the enderman is screaming @@ -231,8 +231,8 @@ public class MetaIndex { /** * What block the enderman is holding */ - public static MetaIndex> ENDERMAN_ITEM = new MetaIndex<>(EndermanWatcher.class, 0, - Optional.empty()); + public static MetaIndex> ENDERMAN_ITEM = + new MetaIndex<>(EndermanWatcher.class, 0, Optional.empty()); public static MetaIndex ENTITY_AIR_TICKS = new MetaIndex<>(FlagWatcher.class, 1, 300); @@ -240,8 +240,8 @@ public class MetaIndex { * The custom name of the entity, empty if not set */ @NmsAddedIn(NmsVersion.v1_13) - public static MetaIndex> ENTITY_CUSTOM_NAME = new MetaIndex<>(FlagWatcher.class, 2, - Optional.empty()); + public static MetaIndex> ENTITY_CUSTOM_NAME = + new MetaIndex<>(FlagWatcher.class, 2, Optional.empty()); /** * The custom name of the entity, empty if not set */ @@ -275,12 +275,12 @@ public class MetaIndex { @NmsAddedIn(NmsVersion.v1_14) public static MetaIndex ENTITY_POSE = new MetaIndex<>(FlagWatcher.class, 6, EntityPose.STANDING); - public static MetaIndex FALLING_BLOCK_POSITION = new MetaIndex<>(FallingBlockWatcher.class, 0, - BlockPosition.ORIGIN); + public static MetaIndex FALLING_BLOCK_POSITION = + new MetaIndex<>(FallingBlockWatcher.class, 0, BlockPosition.ORIGIN); @NmsAddedIn(NmsVersion.v1_14) - public static MetaIndex FIREBALL_ITEM = new MetaIndex<>(FireballWatcher.class, 0, - new ItemStack(Material.AIR)); + public static MetaIndex FIREBALL_ITEM = + new MetaIndex<>(FireballWatcher.class, 0, new ItemStack(Material.AIR)); public static MetaIndex FIREWORK_ITEM = new MetaIndex<>(FireworkWatcher.class, 0, new ItemStack(NmsVersion.v1_13.isSupported() ? Material.FIREWORK_ROCKET : Material.AIR)); @@ -291,8 +291,8 @@ public class MetaIndex { public static MetaIndex FIREWORK_ATTACHED_ENTITY_OLD = new MetaIndex<>(FireworkWatcher.class, 1, 0); @NmsAddedIn(NmsVersion.v1_14) - public static MetaIndex FIREWORK_ATTACHED_ENTITY = new MetaIndex<>(FireworkWatcher.class, 1, - OptionalInt.empty()); + public static MetaIndex FIREWORK_ATTACHED_ENTITY = + new MetaIndex<>(FireworkWatcher.class, 1, OptionalInt.empty()); @NmsAddedIn(NmsVersion.v1_14) public static MetaIndex FIREWORK_SHOT_AT_ANGLE = new MetaIndex<>(FireworkWatcher.class, 2, false); @@ -338,8 +338,8 @@ public class MetaIndex { /** * If horse has chest, set for donkey */ - public static MetaIndex HORSE_CHESTED_CARRYING_CHEST = new MetaIndex<>(ChestedHorseWatcher.class, 0, - false); + public static MetaIndex HORSE_CHESTED_CARRYING_CHEST = + new MetaIndex<>(ChestedHorseWatcher.class, 0, false); @NmsRemovedIn(NmsVersion.v1_14) public static MetaIndex HORSE_ARMOR = new MetaIndex<>(HorseWatcher.class, 1, 0); @@ -356,8 +356,8 @@ public class MetaIndex { /** * Owner of the horse, no visual effect */ - public static MetaIndex> HORSE_OWNER = new MetaIndex<>(AbstractHorseWatcher.class, 1, - Optional.empty()); + public static MetaIndex> HORSE_OWNER = + new MetaIndex<>(AbstractHorseWatcher.class, 1, Optional.empty()); @NmsAddedIn(NmsVersion.v1_14) public static MetaIndex ILLAGER_SPELL = new MetaIndex<>(IllagerWizardWatcher.class, 0, (byte) 0); @@ -375,8 +375,8 @@ public class MetaIndex { /** * The itemstack inside the itemframe */ - public static MetaIndex ITEMFRAME_ITEM = new MetaIndex<>(ItemFrameWatcher.class, 0, - new ItemStack(Material.AIR)); + public static MetaIndex ITEMFRAME_ITEM = + new MetaIndex<>(ItemFrameWatcher.class, 0, new ItemStack(Material.AIR)); /** * The itemstack rotation inside the itemframe @@ -415,8 +415,8 @@ public class MetaIndex { public static MetaIndex LIVING_STINGS = new MetaIndex<>(LivingWatcher.class, 5, 0); @NmsAddedIn(NmsVersion.v1_14) - public static MetaIndex> LIVING_BED_POSITION = new MetaIndex<>(LivingWatcher.class, 6, - Optional.empty()); + public static MetaIndex> LIVING_BED_POSITION = + new MetaIndex<>(LivingWatcher.class, 6, Optional.empty()); /** * If there is no carpet, -1. Otherwise it's a color enum value @@ -456,8 +456,8 @@ public class MetaIndex { */ public static MetaIndex MINECART_COMMAND_STRING = new MetaIndex<>(MinecartCommandWatcher.class, 0, ""); - public static MetaIndex MINECART_COMMAND_LAST_OUTPUT = new MetaIndex<>( - MinecartCommandWatcher.class, 1, WrappedChatComponent.fromText("")); + public static MetaIndex MINECART_COMMAND_LAST_OUTPUT = + new MetaIndex<>(MinecartCommandWatcher.class, 1, WrappedChatComponent.fromText("")); /** * If the minecart furnace is fueled and burning @@ -525,11 +525,11 @@ public class MetaIndex { public static MetaIndex PLAYER_SKIN = new MetaIndex<>(PlayerWatcher.class, 2, (byte) 127); - public static MetaIndex PLAYER_LEFT_SHOULDER_ENTITY = new MetaIndex<>(PlayerWatcher.class, 4, - NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None")); + public static MetaIndex PLAYER_LEFT_SHOULDER_ENTITY = + new MetaIndex<>(PlayerWatcher.class, 4, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None")); - public static MetaIndex PLAYER_RIGHT_SHOULDER_ENTITY = new MetaIndex<>(PlayerWatcher.class, 5, - NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None")); + public static MetaIndex PLAYER_RIGHT_SHOULDER_ENTITY = + new MetaIndex<>(PlayerWatcher.class, 5, NbtFactory.ofWrapper(NbtType.TAG_COMPOUND, "None")); public static MetaIndex POLAR_BEAR_STANDING = new MetaIndex<>(PolarBearWatcher.class, 0, false); @@ -542,8 +542,8 @@ public class MetaIndex { public static MetaIndex SHEEP_WOOL = new MetaIndex<>(SheepWatcher.class, 0, (byte) 0); - public static MetaIndex> SHULKER_ATTACHED = new MetaIndex<>(ShulkerWatcher.class, 1, - Optional.empty()); + public static MetaIndex> SHULKER_ATTACHED = + new MetaIndex<>(ShulkerWatcher.class, 1, Optional.empty()); public static MetaIndex SHULKER_COLOR = new MetaIndex<>(ShulkerWatcher.class, 3, (byte) 16); @@ -569,17 +569,17 @@ public class MetaIndex { public static MetaIndex SPIDER_CLIMB = new MetaIndex<>(SpiderWatcher.class, 0, (byte) 0); - public static MetaIndex SPLASH_POTION_ITEM = new MetaIndex<>(SplashPotionWatcher.class, 0, - new ItemStack(Material.SPLASH_POTION)); + public static MetaIndex SPLASH_POTION_ITEM = + new MetaIndex<>(SplashPotionWatcher.class, 0, new ItemStack(Material.SPLASH_POTION)); public static MetaIndex TAMEABLE_META = new MetaIndex<>(TameableWatcher.class, 0, (byte) 0); - public static MetaIndex> TAMEABLE_OWNER = new MetaIndex<>(TameableWatcher.class, 1, - Optional.empty()); + public static MetaIndex> TAMEABLE_OWNER = + new MetaIndex<>(TameableWatcher.class, 1, Optional.empty()); @NmsAddedIn(NmsVersion.v1_14) - public static MetaIndex THROWABLE_ITEM = new MetaIndex<>(ThrowableWatcher.class, 0, - new ItemStack(Material.AIR)); + public static MetaIndex THROWABLE_ITEM = + new MetaIndex<>(ThrowableWatcher.class, 0, new ItemStack(Material.AIR)); public static MetaIndex TIPPED_ARROW_COLOR = new MetaIndex<>(TippedArrowWatcher.class, 0, -1); @@ -592,15 +592,15 @@ public class MetaIndex { public static MetaIndex TROPICAL_FISH_VARIANT = new MetaIndex<>(TropicalFishWatcher.class, 0, 0); - public static MetaIndex TURTLE_HOME_POSITION = new MetaIndex<>(TurtleWatcher.class, 0, - BlockPosition.ORIGIN); + public static MetaIndex TURTLE_HOME_POSITION = + new MetaIndex<>(TurtleWatcher.class, 0, BlockPosition.ORIGIN); public static MetaIndex TURTLE_HAS_EGG = new MetaIndex<>(TurtleWatcher.class, 1, false); public static MetaIndex TURTLE_UNKNOWN_3 = new MetaIndex<>(TurtleWatcher.class, 2, false); - public static MetaIndex TURTLE_TRAVEL_POSITION = new MetaIndex<>(TurtleWatcher.class, 3, - BlockPosition.ORIGIN); + public static MetaIndex TURTLE_TRAVEL_POSITION = + new MetaIndex<>(TurtleWatcher.class, 3, BlockPosition.ORIGIN); public static MetaIndex TURTLE_UNKNOWN_1 = new MetaIndex<>(TurtleWatcher.class, 4, false); @@ -655,8 +655,8 @@ public class MetaIndex { public static MetaIndex ZOMBIE_PLACEHOLDER = new MetaIndex<>(ZombieWatcher.class, 1, 0); @NmsRemovedIn(NmsVersion.v1_14) - public static MetaIndex ZOMBIE_VILLAGER_PROFESSION_OLD = new MetaIndex<>(ZombieVillagerWatcher.class, 1, - 0); + public static MetaIndex ZOMBIE_VILLAGER_PROFESSION_OLD = + new MetaIndex<>(ZombieVillagerWatcher.class, 1, 0); @NmsAddedIn(NmsVersion.v1_14) public static MetaIndex ZOMBIE_VILLAGER_PROFESSION = new MetaIndex<>(ZombieVillagerWatcher.class, 1, @@ -694,8 +694,9 @@ public class MetaIndex { private static void orderMetaIndexes() { for (MetaIndex flagType : values()) { - if (flagType.getFlagWatcher() == FlagWatcher.class) + if (flagType.getFlagWatcher() == FlagWatcher.class) { continue; + } flagType._index += getNoIndexes(ReflectionManager.getSuperClass(flagType.getFlagWatcher())); } @@ -710,8 +711,10 @@ public class MetaIndex { HashMap maxValues = new HashMap<>(); for (MetaIndex type : values()) { - if (maxValues.containsKey(type.getFlagWatcher()) && maxValues.get(type.getFlagWatcher()) > type.getIndex()) + if (maxValues.containsKey(type.getFlagWatcher()) && + maxValues.get(type.getFlagWatcher()) > type.getIndex()) { continue; + } maxValues.put(type.getFlagWatcher(), type.getIndex()); } @@ -723,11 +726,13 @@ public class MetaIndex { MetaIndex found = null; for (MetaIndex type : values()) { - if (type.getIndex() != i) + if (type.getIndex() != i) { continue; + } - if (!ReflectionManager.isAssignableFrom(entry.getKey(), type.getFlagWatcher())) + if (!ReflectionManager.isAssignableFrom(entry.getKey(), type.getFlagWatcher())) { continue; + } if (found != null) { DisguiseUtilities.getLogger().severe(entry.getKey().getSimpleName() + @@ -740,8 +745,9 @@ public class MetaIndex { found = type; } - if (found != null) + if (found != null) { continue; + } DisguiseUtilities.getLogger() .severe(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i); @@ -762,15 +768,19 @@ public class MetaIndex { try { for (Field field : MetaIndex.class.getFields()) { - if (field.getType() != MetaIndex.class) + if (field.getType() != MetaIndex.class) { continue; + } MetaIndex index = (MetaIndex) field.get(null); - toPrint.add(index.toString()); + try { + toPrint.add(index.toString()); + } catch (Exception ex) { + ex.printStackTrace(); + } } - } - catch (Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); } @@ -797,11 +807,13 @@ public class MetaIndex { */ public static MetaIndex getMetaIndex(Class watcherClass, int flagNo) { for (MetaIndex type : values()) { - if (type.getIndex() != flagNo) + if (type.getIndex() != flagNo) { continue; + } - if (!ReflectionManager.isAssignableFrom(watcherClass, type.getFlagWatcher())) + if (!ReflectionManager.isAssignableFrom(watcherClass, type.getFlagWatcher())) { continue; + } return type; } @@ -817,8 +829,9 @@ public class MetaIndex { ArrayList list = new ArrayList<>(); for (MetaIndex type : values()) { - if (type == null || !ReflectionManager.isAssignableFrom(watcherClass, type.getFlagWatcher())) + if (type == null || !ReflectionManager.isAssignableFrom(watcherClass, type.getFlagWatcher())) { continue; + } list.add(type); } @@ -832,8 +845,9 @@ public class MetaIndex { int found = 0; for (MetaIndex type : values()) { - if (type.getFlagWatcher() != c) + if (type.getFlagWatcher() != c) { continue; + } found++; } @@ -865,8 +879,7 @@ public class MetaIndex { return (MetaIndex) field.get(null); } - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { e.printStackTrace(); } @@ -885,8 +898,7 @@ public class MetaIndex { return field.getName(); } - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { e.printStackTrace(); } @@ -934,8 +946,9 @@ public class MetaIndex { _values = new MetaIndex[0]; for (Field field : MetaIndex.class.getFields()) { - if (field.getType() != MetaIndex.class) + if (field.getType() != MetaIndex.class) { continue; + } MetaIndex index = (MetaIndex) field.get(null); @@ -944,16 +957,16 @@ public class MetaIndex { continue; } - if (index == null) + if (index == null) { continue; + } _values = Arrays.copyOf(_values, _values.length + 1); _values[_values.length - 1] = index; index.serializer = DisguiseUtilities.getSerializer(index); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -968,10 +981,8 @@ public class MetaIndex { field.set(null, metaIndex); return true; - } - catch (NoSuchFieldException ignored) { - } - catch (Exception ex) { + } catch (NoSuchFieldException ignored) { + } catch (Exception ex) { ex.printStackTrace(); } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/sounds/DisguiseSoundEnums.java b/src/main/java/me/libraryaddict/disguise/utilities/sounds/DisguiseSoundEnums.java index 006f232a..66e5487e 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/sounds/DisguiseSoundEnums.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/sounds/DisguiseSoundEnums.java @@ -116,6 +116,8 @@ public enum DisguiseSoundEnums { new Sound[]{Sound.ENTITY_MAGMA_CUBE_DEATH, Sound.ENTITY_MAGMA_CUBE_DEATH_SMALL}, null, Sound.ENTITY_MAGMA_CUBE_SQUISH, Sound.ENTITY_MAGMA_CUBE_SQUISH_SMALL), + MINECART(null, Sound.ENTITY_MINECART_RIDING, null, null, Sound.ENTITY_MINECART_INSIDE), + MULE(Sound.ENTITY_MULE_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_MULE_DEATH, Sound.ENTITY_MULE_AMBIENT, Sound.ENTITY_MULE_CHEST),