Add 1.12 support
This commit is contained in:
parent
a74a9061e1
commit
a581decbe0
@ -3,25 +3,28 @@ package me.libraryaddict.disguise.disguisetypes;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public enum AnimalColor {
|
||||
BLACK(DyeColor.BLACK, Material.INK_SAC),
|
||||
BLUE(DyeColor.BLUE, Material.LAPIS_LAZULI),
|
||||
BROWN(DyeColor.BROWN, Material.COCOA_BEANS),
|
||||
CYAN(DyeColor.CYAN, Material.CYAN_DYE),
|
||||
GRAY(DyeColor.GRAY, Material.GRAY_DYE),
|
||||
BLACK(DyeColor.BLACK,
|
||||
NmsVersion.v1_13.isSupported() ? Material.getMaterial("INK_SAC") : Material.getMaterial("INK_SACK")),
|
||||
BLUE(DyeColor.BLUE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LAPIS_LAZULI") : null),
|
||||
BROWN(DyeColor.BROWN, NmsVersion.v1_13.isSupported() ? Material.getMaterial("COCOA_BEANS") : null),
|
||||
CYAN(DyeColor.CYAN, NmsVersion.v1_13.isSupported() ? Material.getMaterial("CYAN_DYE") : null),
|
||||
GRAY(DyeColor.GRAY, NmsVersion.v1_13.isSupported() ? Material.getMaterial("GRAY_DYE") : null),
|
||||
GREEN(DyeColor.GREEN,
|
||||
NmsVersion.v1_14.isSupported() ? Material.getMaterial("GREEN_DYE") : Material.getMaterial("CATCUS_GREEN")),
|
||||
LIGHT_BLUE(DyeColor.LIGHT_BLUE, Material.LIGHT_BLUE_DYE),
|
||||
LIME(DyeColor.LIME, Material.LIME_DYE),
|
||||
MAGENTA(DyeColor.MAGENTA, Material.MAGENTA_DYE),
|
||||
ORANGE(DyeColor.ORANGE, Material.ORANGE_DYE),
|
||||
PINK(DyeColor.PINK, Material.PINK_DYE),
|
||||
PURPLE(DyeColor.PURPLE, Material.PURPLE_DYE),
|
||||
LIGHT_BLUE(DyeColor.LIGHT_BLUE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIGHT_BLUE_DYE") : null),
|
||||
LIME(DyeColor.LIME, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIME_DYE") : null),
|
||||
MAGENTA(DyeColor.MAGENTA, NmsVersion.v1_13.isSupported() ? Material.getMaterial("MAGENTA_DYE") : null),
|
||||
ORANGE(DyeColor.ORANGE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("ORANGE_DYE") : null),
|
||||
PINK(DyeColor.PINK, NmsVersion.v1_13.isSupported() ? Material.getMaterial("PINK_DYE") : null),
|
||||
PURPLE(DyeColor.PURPLE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("PURPLE_DYE") : null),
|
||||
RED(DyeColor.RED,
|
||||
NmsVersion.v1_14.isSupported() ? Material.getMaterial("RED_DYE") : Material.getMaterial("ROSE_RED")),
|
||||
LIGHT_GRAY(DyeColor.LIGHT_GRAY, Material.LIGHT_GRAY_DYE),
|
||||
WHITE(DyeColor.WHITE, Material.BONE_MEAL),
|
||||
LIGHT_GRAY(DyeColor.valueOf(NmsVersion.v1_13.isSupported() ? "LIGHT_GRAY" : "SILVER"),
|
||||
NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIGHT_GRAY_DYE") : null),
|
||||
WHITE(DyeColor.WHITE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("BONE_MEAL") : null),
|
||||
YELLOW(DyeColor.YELLOW, NmsVersion.v1_14.isSupported() ? Material.getMaterial("YELLOW_DYE") :
|
||||
Material.getMaterial("DANDELION_YELLOW"));
|
||||
|
||||
@ -55,6 +58,18 @@ public enum AnimalColor {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AnimalColor getColorByItem(ItemStack itemStack) {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
return getColorByMaterial(itemStack.getType());
|
||||
}
|
||||
|
||||
if (itemStack.getType().name().matches("(WOOL)|(CARPET)|(INK_SACK?)")) {
|
||||
return getColorByWool(itemStack.getDurability());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static AnimalColor getColorByMaterial(Material material) {
|
||||
for (AnimalColor color : values()) {
|
||||
if (color.getDyeMaterial() != material) {
|
||||
@ -96,7 +111,7 @@ public enum AnimalColor {
|
||||
|
||||
AnimalColor(DyeColor color, Material material) {
|
||||
dyeColor = color;
|
||||
this.material = material;
|
||||
this.material = NmsVersion.v1_13.isSupported() ? material : Material.getMaterial("INK_SACK");
|
||||
}
|
||||
|
||||
public Material getDyeMaterial() {
|
||||
|
@ -217,6 +217,10 @@ public class FlagWatcher {
|
||||
}
|
||||
|
||||
public String getCustomName() {
|
||||
if (!NmsVersion.v1_13.isSupported()) {
|
||||
return getData(MetaIndex.ENTITY_CUSTOM_NAME_OLD);
|
||||
}
|
||||
|
||||
Optional<WrappedChatComponent> optional = getData(MetaIndex.ENTITY_CUSTOM_NAME);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@ -230,16 +234,27 @@ public class FlagWatcher {
|
||||
|
||||
public void setCustomName(String name) {
|
||||
if (Strings.isNullOrEmpty(name)) {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
setData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.empty());
|
||||
} else {
|
||||
setData(MetaIndex.ENTITY_CUSTOM_NAME_OLD, "");
|
||||
}
|
||||
} else {
|
||||
if (name.length() > 64) {
|
||||
name = name.substring(0, 64);
|
||||
}
|
||||
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
setData(MetaIndex.ENTITY_CUSTOM_NAME, Optional.of(WrappedChatComponent.fromText(name)));
|
||||
} else {
|
||||
setData(MetaIndex.ENTITY_CUSTOM_NAME_OLD, name);
|
||||
}
|
||||
|
||||
}
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
sendData(MetaIndex.ENTITY_CUSTOM_NAME);
|
||||
} else {
|
||||
sendData(MetaIndex.ENTITY_CUSTOM_NAME_OLD);
|
||||
}
|
||||
}
|
||||
|
||||
protected TargetedDisguise getDisguise() {
|
||||
|
@ -45,8 +45,20 @@ public class MetaIndex<Y> {
|
||||
/**
|
||||
* The type of particle to display
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<WrappedParticle> AREA_EFFECT_PARTICLE = new MetaIndex<>(AreaEffectCloudWatcher.class, 3,
|
||||
WrappedParticle.create(Particle.SPELL_MOB, null));
|
||||
NmsVersion.v1_13.isSupported() ? WrappedParticle.create(Particle.SPELL_MOB, null) : null);
|
||||
|
||||
@NmsRemovedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<Integer> AREA_EFFECT_PARTICLE_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 3, 0);
|
||||
|
||||
@NmsRemovedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<Integer> AREA_EFFECT_PARTICLE_PARAM_1_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 4,
|
||||
0);
|
||||
|
||||
@NmsRemovedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<Integer> AREA_EFFECT_PARTICLE_PARAM_2_OLD = new MetaIndex<>(AreaEffectCloudWatcher.class, 5,
|
||||
0);
|
||||
|
||||
/**
|
||||
* The size of the area
|
||||
@ -102,6 +114,7 @@ public class MetaIndex<Y> {
|
||||
/**
|
||||
* The shooter of the arrow, no visible effect if set
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<Optional<UUID>> ARROW_UUID = new MetaIndex<>(ArrowWatcher.class, 1, Optional.empty());
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@ -141,6 +154,7 @@ public class MetaIndex<Y> {
|
||||
*/
|
||||
public static MetaIndex<Integer> BOAT_TYPE = new MetaIndex<>(BoatWatcher.class, 3, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<Integer> BOAT_SHAKE = new MetaIndex<>(BoatWatcher.class, 6, 0);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_14)
|
||||
@ -224,8 +238,14 @@ public class MetaIndex<Y> {
|
||||
/**
|
||||
* The custom name of the entity, empty if not set
|
||||
*/
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<Optional<WrappedChatComponent>> ENTITY_CUSTOM_NAME = new MetaIndex<>(FlagWatcher.class, 2,
|
||||
Optional.empty());
|
||||
/**
|
||||
* The custom name of the entity, empty if not set
|
||||
*/
|
||||
@NmsRemovedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<String> ENTITY_CUSTOM_NAME_OLD = new MetaIndex<>(FlagWatcher.class, 2, "");
|
||||
|
||||
/**
|
||||
* If custom name should always be visible even when not looked at
|
||||
@ -262,7 +282,7 @@ public class MetaIndex<Y> {
|
||||
new ItemStack(Material.AIR));
|
||||
|
||||
public static MetaIndex<ItemStack> FIREWORK_ITEM = new MetaIndex<>(FireworkWatcher.class, 0,
|
||||
new ItemStack(Material.FIREWORK_ROCKET));
|
||||
new ItemStack(NmsVersion.v1_13.isSupported() ? Material.FIREWORK_ROCKET : Material.AIR));
|
||||
|
||||
public static MetaIndex<Boolean> FISH_FROM_BUCKET = new MetaIndex<>(FishWatcher.class, 0, false);
|
||||
|
||||
@ -595,6 +615,7 @@ public class MetaIndex<Y> {
|
||||
|
||||
public static MetaIndex<Boolean> ZOMBIE_BABY = new MetaIndex<>(ZombieWatcher.class, 0, false);
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public static MetaIndex<Boolean> ZOMBIE_CONVERTING_DROWNED = new MetaIndex<>(ZombieWatcher.class, 2, false);
|
||||
|
||||
public static MetaIndex<Integer> ZOMBIE_PLACEHOLDER = new MetaIndex<>(ZombieWatcher.class, 1, 0);
|
||||
|
@ -1,12 +1,16 @@
|
||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||
import com.comphenix.protocol.wrappers.WrappedParticle;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import me.libraryaddict.disguise.utilities.parser.RandomDefaultValue;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import org.apache.commons.lang.math.RandomUtils;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
|
||||
/**
|
||||
@ -52,24 +56,49 @@ public class AreaEffectCloudWatcher extends FlagWatcher {
|
||||
sendData(MetaIndex.AREA_EFFECT_IGNORE_RADIUS);
|
||||
}
|
||||
|
||||
public void setParticle(WrappedParticle particle) {
|
||||
setData(MetaIndex.AREA_EFFECT_PARTICLE, particle);
|
||||
sendData(MetaIndex.AREA_EFFECT_PARTICLE);
|
||||
}
|
||||
|
||||
public void setParticle(Particle particle) {
|
||||
setParticle(WrappedParticle.create(particle, null));
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public <T> void setParticle(Particle particle, T particleData) {
|
||||
setParticle(WrappedParticle.create(particle, particleData));
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public WrappedParticle getParticle() {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
return getData(MetaIndex.AREA_EFFECT_PARTICLE);
|
||||
} else {
|
||||
// Item crack, block crack, block dust, falling dust
|
||||
int particleId = getData(MetaIndex.AREA_EFFECT_PARTICLE_OLD);
|
||||
Particle particle = Particle.values()[particleId];
|
||||
|
||||
return WrappedParticle.create(particle, null);
|
||||
}
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public void setParticle(WrappedParticle particle) {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
setData(MetaIndex.AREA_EFFECT_PARTICLE, particle);
|
||||
sendData(MetaIndex.AREA_EFFECT_PARTICLE);
|
||||
} else {
|
||||
setParticleType(particle.getParticle());
|
||||
}
|
||||
}
|
||||
|
||||
public Particle getParticleType() {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
return getParticle().getParticle();
|
||||
} else {
|
||||
return Particle.values()[getData(MetaIndex.AREA_EFFECT_PARTICLE_OLD)];
|
||||
}
|
||||
}
|
||||
|
||||
public void setParticleType(Particle particle) {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
setParticle(WrappedParticle.create(particle, null));
|
||||
} else {
|
||||
setData(MetaIndex.AREA_EFFECT_PARTICLE_OLD, particle.ordinal());
|
||||
|
||||
sendData(MetaIndex.AREA_EFFECT_PARTICLE_OLD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import org.bukkit.TreeSpecies;
|
||||
|
||||
public class BoatWatcher extends FlagWatcher {
|
||||
@ -21,39 +23,41 @@ public class BoatWatcher extends FlagWatcher {
|
||||
sendData(MetaIndex.BOAT_DAMAGE);
|
||||
}
|
||||
|
||||
public boolean isRightPaddling() {
|
||||
return getData(MetaIndex.BOAT_RIGHT_PADDLING);
|
||||
}
|
||||
|
||||
public void setRightPaddling(boolean rightPaddling) {
|
||||
setData(MetaIndex.BOAT_RIGHT_PADDLING, rightPaddling);
|
||||
sendData(MetaIndex.BOAT_RIGHT_PADDLING);
|
||||
}
|
||||
|
||||
public boolean isLeftPaddling() {
|
||||
return getData(MetaIndex.BOAT_LEFT_PADDLING);
|
||||
}
|
||||
|
||||
public void setLeftPaddling(boolean leftPaddling) {
|
||||
setData(MetaIndex.BOAT_LEFT_PADDLING, leftPaddling);
|
||||
sendData(MetaIndex.BOAT_LEFT_PADDLING);
|
||||
}
|
||||
|
||||
public boolean isRightPaddling() {
|
||||
return getData(MetaIndex.BOAT_RIGHT_PADDLING);
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public int getBoatShake() {
|
||||
return getData(MetaIndex.BOAT_SHAKE);
|
||||
}
|
||||
|
||||
public boolean isLeftPaddling() {
|
||||
return getData(MetaIndex.BOAT_LEFT_PADDLING);
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public void setBoatShake(int number) {
|
||||
setData(MetaIndex.BOAT_SHAKE, number);
|
||||
sendData(MetaIndex.BOAT_SHAKE);
|
||||
}
|
||||
|
||||
public TreeSpecies getBoatType() {
|
||||
return TreeSpecies.getByData(getData(MetaIndex.BOAT_TYPE).byteValue());
|
||||
}
|
||||
|
||||
public void setBoatType(TreeSpecies boatType) {
|
||||
setData(MetaIndex.BOAT_TYPE, (int) boatType.getData());
|
||||
sendData(MetaIndex.BOAT_TYPE);
|
||||
}
|
||||
|
||||
public void setBoatShake(int number) {
|
||||
setData(MetaIndex.BOAT_SHAKE, number);
|
||||
sendData(MetaIndex.BOAT_SHAKE);
|
||||
}
|
||||
|
||||
public int getBoatShake() {
|
||||
return getData(MetaIndex.BOAT_SHAKE);
|
||||
}
|
||||
|
||||
public TreeSpecies getBoatType() {
|
||||
return TreeSpecies.getByData(getData(MetaIndex.BOAT_TYPE).byteValue());
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsRemovedIn;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
|
||||
@ -32,10 +33,12 @@ public class ZombieWatcher extends InsentientWatcher {
|
||||
setBaby(true);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public boolean isConverting() {
|
||||
return getData(MetaIndex.ZOMBIE_CONVERTING_DROWNED);
|
||||
}
|
||||
|
||||
@NmsAddedIn(val = NmsVersion.v1_13)
|
||||
public void setConverting(boolean converting) {
|
||||
setData(MetaIndex.ZOMBIE_CONVERTING_DROWNED, converting);
|
||||
sendData(MetaIndex.ZOMBIE_CONVERTING_DROWNED);
|
||||
|
@ -1,233 +1,149 @@
|
||||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Only living disguises go in here!
|
||||
*/
|
||||
public enum DisguiseSound {
|
||||
ARMOR_STAND(Sound.ENTITY_ARMOR_STAND_HIT, null, Sound.ENTITY_ARMOR_STAND_BREAK, Sound.ENTITY_ARMOR_STAND_FALL,
|
||||
Sound.ENTITY_ARMOR_STAND_PLACE),
|
||||
ARMOR_STAND,
|
||||
|
||||
ARROW(null, null, null, null, Sound.ENTITY_ARROW_HIT, Sound.ENTITY_ARROW_SHOOT),
|
||||
ARROW,
|
||||
|
||||
BAT(Sound.ENTITY_BAT_HURT, null, Sound.ENTITY_BAT_DEATH, Sound.ENTITY_BAT_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
|
||||
Sound.ENTITY_BAT_LOOP, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_BAT_TAKEOFF),
|
||||
BAT,
|
||||
|
||||
BEE("ENTITY_BEE_HURT", null, "ENTITY_BEE_DEATH", null, "ENTITY_BEE_LOOP", "ENTITY_BEE_LOOP_AGGRESSIVE",
|
||||
"ENTITY_BEE_POLLINATE", "ENTITY_BEE_STING"),
|
||||
BEE,
|
||||
|
||||
BLAZE(Sound.ENTITY_BLAZE_HURT, null, Sound.ENTITY_BLAZE_DEATH, Sound.ENTITY_BLAZE_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_BLAZE_BURN,
|
||||
Sound.ENTITY_BLAZE_SHOOT),
|
||||
BLAZE,
|
||||
|
||||
BOAT(null, Sound.ENTITY_BOAT_PADDLE_WATER, null, null, Sound.ENTITY_BOAT_PADDLE_LAND),
|
||||
BOAT,
|
||||
|
||||
CAVE_SPIDER(Sound.ENTITY_SPIDER_HURT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH,
|
||||
Sound.ENTITY_SPIDER_AMBIENT),
|
||||
CAVE_SPIDER,
|
||||
|
||||
CHICKEN(Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_STEP, Sound.ENTITY_CHICKEN_DEATH,
|
||||
Sound.ENTITY_CHICKEN_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_CHICKEN_EGG,
|
||||
Sound.ENTITY_PLAYER_BIG_FALL),
|
||||
CHICKEN,
|
||||
|
||||
COD(Sound.ENTITY_COD_HURT, null, Sound.ENTITY_COD_DEATH, Sound.ENTITY_COD_AMBIENT, Sound.ENTITY_COD_FLOP,
|
||||
Sound.ENTITY_FISH_SWIM),
|
||||
COD,
|
||||
|
||||
COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_DEATH, Sound.ENTITY_COW_AMBIENT),
|
||||
COW,
|
||||
|
||||
CREEPER(Sound.ENTITY_CREEPER_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_CREEPER_DEATH, null,
|
||||
Sound.ENTITY_CREEPER_PRIMED),
|
||||
CREEPER,
|
||||
|
||||
DOLPHIN(Sound.ENTITY_DOLPHIN_HURT, Sound.ENTITY_DOLPHIN_SWIM, Sound.ENTITY_DOLPHIN_DEATH,
|
||||
new Sound[]{Sound.ENTITY_DOLPHIN_AMBIENT, Sound.ENTITY_DOLPHIN_AMBIENT_WATER}, Sound.ENTITY_DOLPHIN_ATTACK,
|
||||
Sound.ENTITY_DOLPHIN_EAT, Sound.ENTITY_DOLPHIN_SPLASH, Sound.ENTITY_DOLPHIN_PLAY, Sound.ENTITY_DOLPHIN_JUMP,
|
||||
Sound.ENTITY_FISH_SWIM),
|
||||
DOLPHIN,
|
||||
|
||||
DONKEY(Sound.ENTITY_DONKEY_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD,},
|
||||
Sound.ENTITY_DONKEY_DEATH, Sound.ENTITY_DONKEY_AMBIENT, Sound.ENTITY_HORSE_GALLOP,
|
||||
Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_DONKEY_CHEST),
|
||||
DONKEY,
|
||||
|
||||
DROWNED(new Sound[]{Sound.ENTITY_DROWNED_HURT, Sound.ENTITY_DROWNED_HURT_WATER},
|
||||
new Sound[]{Sound.ENTITY_DROWNED_STEP, Sound.ENTITY_DROWNED_SWIM},
|
||||
new Sound[]{Sound.ENTITY_DROWNED_DEATH, Sound.ENTITY_DROWNED_DEATH_WATER},
|
||||
new Sound[]{Sound.ENTITY_DROWNED_AMBIENT, Sound.ENTITY_DROWNED_AMBIENT_WATER}, Sound.ENTITY_DROWNED_SHOOT),
|
||||
DROWNED,
|
||||
|
||||
ELDER_GUARDIAN(new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_HURT, Sound.ENTITY_ELDER_GUARDIAN_HURT_LAND}, null,
|
||||
new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_DEATH, Sound.ENTITY_ELDER_GUARDIAN_DEATH_LAND},
|
||||
new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_AMBIENT, Sound.ENTITY_ELDER_GUARDIAN_AMBIENT_LAND},
|
||||
Sound.ENTITY_ELDER_GUARDIAN_FLOP),
|
||||
ELDER_GUARDIAN,
|
||||
|
||||
ENDER_DRAGON(Sound.ENTITY_ENDER_DRAGON_HURT, null, Sound.ENTITY_ENDER_DRAGON_DEATH,
|
||||
Sound.ENTITY_ENDER_DRAGON_AMBIENT, Sound.ENTITY_GENERIC_SMALL_FALL, Sound.ENTITY_GENERIC_BIG_FALL,
|
||||
Sound.ENTITY_ENDER_DRAGON_FLAP, Sound.ENTITY_ENDER_DRAGON_GROWL),
|
||||
ENDER_DRAGON,
|
||||
|
||||
ENDERMAN(Sound.ENTITY_ENDERMAN_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_ENDERMAN_DEATH,
|
||||
Sound.ENTITY_ENDERMAN_AMBIENT, Sound.ENTITY_ENDERMAN_SCREAM, Sound.ENTITY_ENDERMAN_TELEPORT,
|
||||
Sound.ENTITY_ENDERMAN_STARE),
|
||||
ENDERMAN,
|
||||
|
||||
ENDERMITE(Sound.ENTITY_ENDERMITE_HURT, Sound.ENTITY_ENDERMITE_STEP, Sound.ENTITY_ENDERMITE_DEATH,
|
||||
Sound.ENTITY_ENDERMITE_AMBIENT),
|
||||
ENDERMITE,
|
||||
|
||||
EVOKER(Sound.ENTITY_EVOKER_HURT, null, Sound.ENTITY_EVOKER_DEATH, Sound.ENTITY_EVOKER_AMBIENT,
|
||||
Sound.ENTITY_EVOKER_CAST_SPELL, Sound.ENTITY_EVOKER_PREPARE_ATTACK, Sound.ENTITY_EVOKER_PREPARE_SUMMON,
|
||||
Sound.ENTITY_EVOKER_PREPARE_WOLOLO),
|
||||
EVOKER,
|
||||
|
||||
EVOKER_FANGS(null, null, null, null, Sound.ENTITY_EVOKER_FANGS_ATTACK),
|
||||
EVOKER_FANGS,
|
||||
|
||||
GHAST(Sound.ENTITY_GHAST_HURT, null, Sound.ENTITY_GHAST_DEATH, Sound.ENTITY_GHAST_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_GHAST_SHOOT, Sound.ENTITY_PLAYER_BIG_FALL,
|
||||
Sound.ENTITY_GHAST_SCREAM, Sound.ENTITY_GHAST_WARN),
|
||||
GHAST,
|
||||
|
||||
GIANT(Sound.ENTITY_PLAYER_HURT, Sound.BLOCK_GRASS_STEP, null, null),
|
||||
GIANT,
|
||||
|
||||
GUARDIAN(new Sound[]{Sound.ENTITY_GUARDIAN_HURT, Sound.ENTITY_GUARDIAN_HURT_LAND}, null,
|
||||
new Sound[]{Sound.ENTITY_GUARDIAN_DEATH, Sound.ENTITY_GUARDIAN_DEATH_LAND},
|
||||
new Sound[]{Sound.ENTITY_GUARDIAN_AMBIENT, Sound.ENTITY_GUARDIAN_AMBIENT_LAND}, Sound.ENTITY_GUARDIAN_FLOP),
|
||||
GUARDIAN,
|
||||
|
||||
HORSE(Sound.ENTITY_HORSE_HURT, new Sound[]{Sound.ENTITY_HORSE_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
|
||||
Sound.ENTITY_HORSE_DEATH, Sound.ENTITY_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
|
||||
Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
||||
Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_HORSE_EAT, Sound.ENTITY_HORSE_BREATHE),
|
||||
HORSE,
|
||||
|
||||
HUSK(Sound.ENTITY_HUSK_HURT, Sound.ENTITY_HUSK_STEP, Sound.ENTITY_HUSK_DEATH, Sound.ENTITY_HUSK_AMBIENT,
|
||||
Sound.ENTITY_HUSK_CONVERTED_TO_ZOMBIE),
|
||||
HUSK,
|
||||
|
||||
ILLUSIONER(Sound.ENTITY_ILLUSIONER_HURT, null, Sound.ENTITY_ILLUSIONER_DEATH, Sound.ENTITY_ILLUSIONER_AMBIENT,
|
||||
Sound.ENTITY_ILLUSIONER_CAST_SPELL, Sound.ENTITY_ILLUSIONER_PREPARE_BLINDNESS,
|
||||
Sound.ENTITY_ILLUSIONER_PREPARE_MIRROR, Sound.ENTITY_ILLUSIONER_MIRROR_MOVE),
|
||||
ILLUSIONER,
|
||||
|
||||
IRON_GOLEM(Sound.ENTITY_IRON_GOLEM_HURT, Sound.ENTITY_IRON_GOLEM_STEP, Sound.ENTITY_IRON_GOLEM_DEATH,
|
||||
Sound.ENTITY_IRON_GOLEM_ATTACK),
|
||||
IRON_GOLEM,
|
||||
|
||||
LLAMA(Sound.ENTITY_LLAMA_HURT, Sound.ENTITY_LLAMA_STEP, Sound.ENTITY_LLAMA_DEATH, Sound.ENTITY_LLAMA_AMBIENT,
|
||||
Sound.ENTITY_LLAMA_ANGRY, Sound.ENTITY_LLAMA_CHEST, Sound.ENTITY_LLAMA_EAT, Sound.ENTITY_LLAMA_SWAG),
|
||||
LLAMA,
|
||||
|
||||
MAGMA_CUBE(Sound.ENTITY_MAGMA_CUBE_HURT, Sound.ENTITY_MAGMA_CUBE_JUMP,
|
||||
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),
|
||||
MAGMA_CUBE,
|
||||
|
||||
MULE(Sound.ENTITY_MULE_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_MULE_DEATH, Sound.ENTITY_MULE_AMBIENT,
|
||||
Sound.ENTITY_MULE_CHEST),
|
||||
MULE,
|
||||
|
||||
MUSHROOM_COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_DEATH, Sound.ENTITY_COW_AMBIENT),
|
||||
MUSHROOM_COW,
|
||||
|
||||
OCELOT(Sound.ENTITY_CAT_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_CAT_DEATH,
|
||||
new Sound[]{Sound.ENTITY_CAT_AMBIENT, Sound.ENTITY_CAT_PURR, Sound.ENTITY_CAT_PURREOW},
|
||||
Sound.ENTITY_CAT_HISS),
|
||||
OCELOT,
|
||||
|
||||
PARROT(Sound.ENTITY_PARROT_HURT, Sound.ENTITY_PARROT_STEP, Sound.ENTITY_PARROT_DEATH, Sound.ENTITY_PARROT_AMBIENT,
|
||||
Arrays.stream(Sound.values())
|
||||
.filter(sound -> sound.name().contains("PARROT_IMITATE") || sound == Sound.ENTITY_PARROT_EAT ||
|
||||
sound == Sound.ENTITY_PARROT_FLY).toArray(Sound[]::new)),
|
||||
PARROT,
|
||||
|
||||
PIG(Sound.ENTITY_PIG_HURT, Sound.ENTITY_PIG_STEP, Sound.ENTITY_PIG_DEATH, Sound.ENTITY_PIG_AMBIENT),
|
||||
PIG,
|
||||
|
||||
PIG_ZOMBIE(Sound.ENTITY_ZOMBIE_PIGMAN_HURT, null, Sound.ENTITY_ZOMBIE_PIGMAN_DEATH,
|
||||
Sound.ENTITY_ZOMBIE_PIGMAN_AMBIENT, Sound.ENTITY_ZOMBIE_PIGMAN_ANGRY),
|
||||
PIG_ZOMBIE,
|
||||
|
||||
PLAYER(Sound.ENTITY_PLAYER_HURT, Arrays.stream(Sound.values())
|
||||
.filter(sound -> sound.name().startsWith("BLOCK_") && sound.name().endsWith("_STEP")).toArray(Sound[]::new),
|
||||
Sound.ENTITY_PLAYER_DEATH, null),
|
||||
PLAYER,
|
||||
|
||||
PHANTOM(Sound.ENTITY_PHANTOM_HURT, new Sound[]{Sound.ENTITY_PHANTOM_FLAP, Sound.ENTITY_PHANTOM_SWOOP},
|
||||
Sound.ENTITY_PHANTOM_DEATH, Sound.ENTITY_PHANTOM_AMBIENT, Sound.ENTITY_PHANTOM_BITE),
|
||||
PHANTOM,
|
||||
|
||||
POLAR_BEAR(Sound.ENTITY_POLAR_BEAR_HURT, Sound.ENTITY_POLAR_BEAR_STEP, Sound.ENTITY_POLAR_BEAR_DEATH,
|
||||
new Sound[]{Sound.ENTITY_POLAR_BEAR_AMBIENT, Sound.ENTITY_POLAR_BEAR_AMBIENT_BABY},
|
||||
Sound.ENTITY_POLAR_BEAR_WARNING),
|
||||
POLAR_BEAR,
|
||||
|
||||
PUFFERFISH(Sound.ENTITY_PUFFER_FISH_HURT, null, Sound.ENTITY_PUFFER_FISH_DEATH, Sound.ENTITY_PUFFER_FISH_AMBIENT,
|
||||
Sound.ENTITY_PUFFER_FISH_BLOW_OUT, Sound.ENTITY_PUFFER_FISH_BLOW_UP, Sound.ENTITY_PUFFER_FISH_FLOP,
|
||||
Sound.ENTITY_PUFFER_FISH_STING, Sound.ENTITY_FISH_SWIM),
|
||||
PUFFERFISH,
|
||||
|
||||
RABBIT(Sound.ENTITY_RABBIT_HURT, Sound.ENTITY_RABBIT_JUMP, Sound.ENTITY_RABBIT_DEATH, Sound.ENTITY_RABBIT_AMBIENT,
|
||||
Sound.ENTITY_RABBIT_ATTACK),
|
||||
RABBIT,
|
||||
|
||||
SALMON(Sound.ENTITY_SALMON_HURT, null, Sound.ENTITY_SALMON_DEATH, Sound.ENTITY_SALMON_AMBIENT,
|
||||
Sound.ENTITY_SALMON_FLOP, Sound.ENTITY_FISH_SWIM),
|
||||
SALMON,
|
||||
|
||||
SHEEP(Sound.ENTITY_SHEEP_HURT, Sound.ENTITY_SHEEP_STEP, Sound.ENTITY_SHEEP_DEATH, Sound.ENTITY_SHEEP_AMBIENT,
|
||||
Sound.ENTITY_SHEEP_SHEAR),
|
||||
SHEEP,
|
||||
|
||||
SHULKER(new Sound[]{Sound.ENTITY_SHULKER_HURT, Sound.ENTITY_SHULKER_HURT_CLOSED}, null, Sound.ENTITY_SHULKER_DEATH,
|
||||
Sound.ENTITY_SHULKER_AMBIENT, Sound.ENTITY_SHULKER_OPEN, Sound.ENTITY_SHULKER_CLOSE,
|
||||
Sound.ENTITY_SHULKER_TELEPORT),
|
||||
SHULKER,
|
||||
|
||||
SILVERFISH(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_SILVERFISH_STEP, Sound.ENTITY_SILVERFISH_DEATH,
|
||||
Sound.ENTITY_SILVERFISH_AMBIENT),
|
||||
SILVERFISH,
|
||||
|
||||
SKELETON(Sound.ENTITY_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP, Sound.ENTITY_SKELETON_DEATH,
|
||||
Sound.ENTITY_SKELETON_AMBIENT),
|
||||
SKELETON,
|
||||
|
||||
SKELETON_HORSE(Sound.ENTITY_SKELETON_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
|
||||
Sound.ENTITY_SKELETON_HORSE_DEATH,
|
||||
new Sound[]{Sound.ENTITY_SKELETON_HORSE_AMBIENT, Sound.ENTITY_SKELETON_HORSE_AMBIENT_WATER},
|
||||
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_SKELETON_HORSE_GALLOP_WATER, Sound.ENTITY_SKELETON_HORSE_JUMP_WATER,
|
||||
Sound.ENTITY_SKELETON_HORSE_SWIM, Sound.ENTITY_SKELETON_HORSE_STEP_WATER),
|
||||
SKELETON_HORSE,
|
||||
|
||||
SLIME(new Sound[]{Sound.ENTITY_SLIME_HURT, Sound.ENTITY_SLIME_HURT_SMALL},
|
||||
new Sound[]{Sound.ENTITY_SLIME_JUMP, Sound.ENTITY_SLIME_JUMP_SMALL},
|
||||
new Sound[]{Sound.ENTITY_SLIME_DEATH, Sound.ENTITY_SLIME_DEATH_SMALL}, null, Sound.ENTITY_SLIME_ATTACK,
|
||||
Sound.ENTITY_SLIME_SQUISH, Sound.ENTITY_SLIME_SQUISH_SMALL),
|
||||
SLIME,
|
||||
|
||||
SNOWMAN(Sound.ENTITY_SNOW_GOLEM_HURT, null, Sound.ENTITY_SNOW_GOLEM_DEATH, Sound.ENTITY_SNOW_GOLEM_AMBIENT,
|
||||
Sound.ENTITY_SNOW_GOLEM_SHOOT),
|
||||
SNOWMAN,
|
||||
|
||||
SPIDER(Sound.ENTITY_SPIDER_HURT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH, Sound.ENTITY_SPIDER_AMBIENT),
|
||||
SPIDER,
|
||||
|
||||
STRAY(Sound.ENTITY_STRAY_HURT, Sound.ENTITY_STRAY_STEP, Sound.ENTITY_STRAY_DEATH, Sound.ENTITY_STRAY_AMBIENT),
|
||||
STRAY,
|
||||
|
||||
SQUID(Sound.ENTITY_SQUID_HURT, null, Sound.ENTITY_SQUID_DEATH, Sound.ENTITY_SQUID_AMBIENT,
|
||||
Sound.ENTITY_SQUID_SQUIRT, Sound.ENTITY_FISH_SWIM),
|
||||
SQUID,
|
||||
|
||||
TROPICAL_FISH(Sound.ENTITY_TROPICAL_FISH_HURT, null, Sound.ENTITY_TROPICAL_FISH_DEATH,
|
||||
Sound.ENTITY_TROPICAL_FISH_AMBIENT, Sound.ENTITY_TROPICAL_FISH_FLOP, Sound.ENTITY_FISH_SWIM),
|
||||
TROPICAL_FISH,
|
||||
|
||||
TURTLE(new Sound[]{Sound.ENTITY_TURTLE_HURT, Sound.ENTITY_TURTLE_HURT_BABY},
|
||||
new Sound[]{Sound.ENTITY_TURTLE_SHAMBLE, Sound.ENTITY_TURTLE_SHAMBLE_BABY},
|
||||
new Sound[]{Sound.ENTITY_TURTLE_DEATH, Sound.ENTITY_TURTLE_DEATH_BABY}, Sound.ENTITY_TURTLE_AMBIENT_LAND,
|
||||
Sound.ENTITY_TURTLE_LAY_EGG),
|
||||
TURTLE,
|
||||
|
||||
VEX(Sound.ENTITY_VEX_HURT, null, Sound.ENTITY_VEX_DEATH, Sound.ENTITY_VEX_AMBIENT, Sound.ENTITY_VEX_CHARGE),
|
||||
VEX,
|
||||
|
||||
VILLAGER(Sound.ENTITY_VILLAGER_HURT, null, Sound.ENTITY_VILLAGER_DEATH, Sound.ENTITY_VILLAGER_AMBIENT,
|
||||
Sound.ENTITY_VILLAGER_TRADE, Sound.ENTITY_VILLAGER_NO, Sound.ENTITY_VILLAGER_YES),
|
||||
VILLAGER,
|
||||
|
||||
VINDICATOR(Sound.ENTITY_VINDICATOR_HURT, null, Sound.ENTITY_VINDICATOR_DEATH, Sound.ENTITY_VINDICATOR_AMBIENT),
|
||||
VINDICATOR,
|
||||
|
||||
WITCH(Sound.ENTITY_WITCH_HURT, null, Sound.ENTITY_WITCH_DEATH, Sound.ENTITY_WITCH_AMBIENT),
|
||||
WITCH,
|
||||
|
||||
WITHER(Sound.ENTITY_WITHER_HURT, null, Sound.ENTITY_WITHER_DEATH, Sound.ENTITY_WITHER_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_WITHER_SPAWN, Sound.ENTITY_PLAYER_BIG_FALL,
|
||||
Sound.ENTITY_WITHER_SHOOT),
|
||||
WITHER,
|
||||
|
||||
WITHER_SKELETON(Sound.ENTITY_WITHER_SKELETON_HURT, Sound.ENTITY_WITHER_SKELETON_STEP,
|
||||
Sound.ENTITY_WITHER_SKELETON_DEATH, Sound.ENTITY_WITHER_SKELETON_AMBIENT),
|
||||
WITHER_SKELETON,
|
||||
|
||||
WOLF(Sound.ENTITY_WOLF_HURT, Sound.ENTITY_WOLF_STEP, Sound.ENTITY_WOLF_DEATH, Sound.ENTITY_WOLF_AMBIENT,
|
||||
Sound.ENTITY_WOLF_GROWL, Sound.ENTITY_WOLF_PANT, Sound.ENTITY_WOLF_HOWL, Sound.ENTITY_WOLF_SHAKE,
|
||||
Sound.ENTITY_WOLF_WHINE),
|
||||
WOLF,
|
||||
|
||||
ZOMBIE(Sound.ENTITY_ZOMBIE_HURT, Sound.ENTITY_ZOMBIE_STEP, Sound.ENTITY_ZOMBIE_DEATH, Sound.ENTITY_ZOMBIE_AMBIENT,
|
||||
Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR),
|
||||
ZOMBIE,
|
||||
|
||||
ZOMBIE_HORSE(Sound.ENTITY_ZOMBIE_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
|
||||
Sound.ENTITY_ZOMBIE_HORSE_DEATH, Sound.ENTITY_ZOMBIE_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP,
|
||||
Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
||||
Sound.ENTITY_HORSE_ANGRY),
|
||||
ZOMBIE_HORSE,
|
||||
|
||||
ZOMBIE_VILLAGER(Sound.ENTITY_ZOMBIE_VILLAGER_HURT, Sound.ENTITY_ZOMBIE_VILLAGER_STEP,
|
||||
Sound.ENTITY_ZOMBIE_VILLAGER_DEATH, Sound.ENTITY_ZOMBIE_VILLAGER_AMBIENT, Sound.ENTITY_ZOMBIE_INFECT,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR);
|
||||
ZOMBIE_VILLAGER;
|
||||
|
||||
public enum SoundType {
|
||||
CANCEL,
|
||||
@ -237,6 +153,38 @@ public enum DisguiseSound {
|
||||
STEP
|
||||
}
|
||||
|
||||
static {
|
||||
try (InputStream stream = LibsDisguises.getInstance().getResource("ANTI_PIRACY_ENCODED_WITH_SOUNDS")) {
|
||||
List<String> lines = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)).lines()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (String s : lines) {
|
||||
String[] spl = s.split(":", -1);
|
||||
|
||||
DisguiseSound sound = DisguiseSound.valueOf(spl[0]);
|
||||
|
||||
for (int i = 1; i <= SoundType.values().length; i++) {
|
||||
if (spl[i].isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] split = spl[i].split(",");
|
||||
|
||||
for (String sName : split) {
|
||||
try {
|
||||
sound.addSound(Sound.valueOf(sName), SoundType.values()[i - 1]);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static DisguiseSound getType(String name) {
|
||||
try {
|
||||
return valueOf(name);
|
||||
@ -249,17 +197,6 @@ public enum DisguiseSound {
|
||||
private float damageSoundVolume = 1F;
|
||||
private LinkedHashMap<Object, SoundType> disguiseSounds = new LinkedHashMap<>();
|
||||
|
||||
DisguiseSound(Object hurt, Object step, Object death, Object idle, Object... sounds) {
|
||||
addSound(hurt, SoundType.HURT);
|
||||
addSound(step, SoundType.STEP);
|
||||
addSound(death, SoundType.DEATH);
|
||||
addSound(idle, SoundType.IDLE);
|
||||
|
||||
for (Object obj : sounds) {
|
||||
addSound(obj, SoundType.CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
private Sound parseSound(String name) {
|
||||
try {
|
||||
return Sound.valueOf(name);
|
||||
|
@ -0,0 +1,272 @@
|
||||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import lombok.Getter;
|
||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.DisguiseSound.SoundType;
|
||||
|
||||
/**
|
||||
* Only living disguises go in here!
|
||||
*/
|
||||
public enum DisguiseSoundEnums {
|
||||
ARMOR_STAND(Sound.ENTITY_ARMOR_STAND_HIT, null, Sound.ENTITY_ARMOR_STAND_BREAK, Sound.ENTITY_ARMOR_STAND_FALL,
|
||||
Sound.ENTITY_ARMOR_STAND_PLACE),
|
||||
|
||||
ARROW(null, null, null, null, Sound.ENTITY_ARROW_HIT, Sound.ENTITY_ARROW_SHOOT),
|
||||
|
||||
BAT(Sound.ENTITY_BAT_HURT, null, Sound.ENTITY_BAT_DEATH, Sound.ENTITY_BAT_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
|
||||
Sound.ENTITY_BAT_LOOP, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_BAT_TAKEOFF),
|
||||
|
||||
BEE(Sound.ENTITY_BEE_HURT, null, Sound.ENTITY_BEE_DEATH, null, Sound.ENTITY_BEE_LOOP,
|
||||
Sound.ENTITY_BEE_LOOP_AGGRESSIVE, Sound.ENTITY_BEE_POLLINATE, Sound.ENTITY_BEE_STING),
|
||||
|
||||
BLAZE(Sound.ENTITY_BLAZE_HURT, null, Sound.ENTITY_BLAZE_DEATH, Sound.ENTITY_BLAZE_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_PLAYER_BIG_FALL, Sound.ENTITY_BLAZE_BURN,
|
||||
Sound.ENTITY_BLAZE_SHOOT),
|
||||
|
||||
BOAT(null, Sound.ENTITY_BOAT_PADDLE_WATER, null, null, Sound.ENTITY_BOAT_PADDLE_LAND),
|
||||
|
||||
CAVE_SPIDER(Sound.ENTITY_SPIDER_HURT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH,
|
||||
Sound.ENTITY_SPIDER_AMBIENT),
|
||||
|
||||
CHICKEN(Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_STEP, Sound.ENTITY_CHICKEN_DEATH,
|
||||
Sound.ENTITY_CHICKEN_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_CHICKEN_EGG,
|
||||
Sound.ENTITY_PLAYER_BIG_FALL),
|
||||
|
||||
COD(Sound.ENTITY_COD_HURT, null, Sound.ENTITY_COD_DEATH, Sound.ENTITY_COD_AMBIENT, Sound.ENTITY_COD_FLOP,
|
||||
Sound.ENTITY_FISH_SWIM),
|
||||
|
||||
COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_DEATH, Sound.ENTITY_COW_AMBIENT),
|
||||
|
||||
CREEPER(Sound.ENTITY_CREEPER_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_CREEPER_DEATH, null,
|
||||
Sound.ENTITY_CREEPER_PRIMED),
|
||||
|
||||
DOLPHIN(Sound.ENTITY_DOLPHIN_HURT, Sound.ENTITY_DOLPHIN_SWIM, Sound.ENTITY_DOLPHIN_DEATH,
|
||||
new Sound[]{Sound.ENTITY_DOLPHIN_AMBIENT, Sound.ENTITY_DOLPHIN_AMBIENT_WATER}, Sound.ENTITY_DOLPHIN_ATTACK,
|
||||
Sound.ENTITY_DOLPHIN_EAT, Sound.ENTITY_DOLPHIN_SPLASH, Sound.ENTITY_DOLPHIN_PLAY, Sound.ENTITY_DOLPHIN_JUMP,
|
||||
Sound.ENTITY_FISH_SWIM),
|
||||
|
||||
DONKEY(Sound.ENTITY_DONKEY_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD,},
|
||||
Sound.ENTITY_DONKEY_DEATH, Sound.ENTITY_DONKEY_AMBIENT, Sound.ENTITY_HORSE_GALLOP,
|
||||
Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_DONKEY_CHEST),
|
||||
|
||||
DROWNED(new Sound[]{Sound.ENTITY_DROWNED_HURT, Sound.ENTITY_DROWNED_HURT_WATER},
|
||||
new Sound[]{Sound.ENTITY_DROWNED_STEP, Sound.ENTITY_DROWNED_SWIM},
|
||||
new Sound[]{Sound.ENTITY_DROWNED_DEATH, Sound.ENTITY_DROWNED_DEATH_WATER},
|
||||
new Sound[]{Sound.ENTITY_DROWNED_AMBIENT, Sound.ENTITY_DROWNED_AMBIENT_WATER}, Sound.ENTITY_DROWNED_SHOOT),
|
||||
|
||||
ELDER_GUARDIAN(new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_HURT, Sound.ENTITY_ELDER_GUARDIAN_HURT_LAND}, null,
|
||||
new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_DEATH, Sound.ENTITY_ELDER_GUARDIAN_DEATH_LAND},
|
||||
new Sound[]{Sound.ENTITY_ELDER_GUARDIAN_AMBIENT, Sound.ENTITY_ELDER_GUARDIAN_AMBIENT_LAND},
|
||||
Sound.ENTITY_ELDER_GUARDIAN_FLOP),
|
||||
|
||||
ENDER_DRAGON(Sound.ENTITY_ENDER_DRAGON_HURT, null, Sound.ENTITY_ENDER_DRAGON_DEATH,
|
||||
Sound.ENTITY_ENDER_DRAGON_AMBIENT, Sound.ENTITY_GENERIC_SMALL_FALL, Sound.ENTITY_GENERIC_BIG_FALL,
|
||||
Sound.ENTITY_ENDER_DRAGON_FLAP, Sound.ENTITY_ENDER_DRAGON_GROWL),
|
||||
|
||||
ENDERMAN(Sound.ENTITY_ENDERMAN_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_ENDERMAN_DEATH,
|
||||
Sound.ENTITY_ENDERMAN_AMBIENT, Sound.ENTITY_ENDERMAN_SCREAM, Sound.ENTITY_ENDERMAN_TELEPORT,
|
||||
Sound.ENTITY_ENDERMAN_STARE),
|
||||
|
||||
ENDERMITE(Sound.ENTITY_ENDERMITE_HURT, Sound.ENTITY_ENDERMITE_STEP, Sound.ENTITY_ENDERMITE_DEATH,
|
||||
Sound.ENTITY_ENDERMITE_AMBIENT),
|
||||
|
||||
EVOKER(Sound.ENTITY_EVOKER_HURT, null, Sound.ENTITY_EVOKER_DEATH, Sound.ENTITY_EVOKER_AMBIENT,
|
||||
Sound.ENTITY_EVOKER_CAST_SPELL, Sound.ENTITY_EVOKER_PREPARE_ATTACK, Sound.ENTITY_EVOKER_PREPARE_SUMMON,
|
||||
Sound.ENTITY_EVOKER_PREPARE_WOLOLO),
|
||||
|
||||
EVOKER_FANGS(null, null, null, null, Sound.ENTITY_EVOKER_FANGS_ATTACK),
|
||||
|
||||
GHAST(Sound.ENTITY_GHAST_HURT, null, Sound.ENTITY_GHAST_DEATH, Sound.ENTITY_GHAST_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_GHAST_SHOOT, Sound.ENTITY_PLAYER_BIG_FALL,
|
||||
Sound.ENTITY_GHAST_SCREAM, Sound.ENTITY_GHAST_WARN),
|
||||
|
||||
GIANT(Sound.ENTITY_PLAYER_HURT, Sound.BLOCK_GRASS_STEP, null, null),
|
||||
|
||||
GUARDIAN(new Sound[]{Sound.ENTITY_GUARDIAN_HURT, Sound.ENTITY_GUARDIAN_HURT_LAND}, null,
|
||||
new Sound[]{Sound.ENTITY_GUARDIAN_DEATH, Sound.ENTITY_GUARDIAN_DEATH_LAND},
|
||||
new Sound[]{Sound.ENTITY_GUARDIAN_AMBIENT, Sound.ENTITY_GUARDIAN_AMBIENT_LAND}, Sound.ENTITY_GUARDIAN_FLOP),
|
||||
|
||||
HORSE(Sound.ENTITY_HORSE_HURT, new Sound[]{Sound.ENTITY_HORSE_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
|
||||
Sound.ENTITY_HORSE_DEATH, Sound.ENTITY_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
|
||||
Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
||||
Sound.ENTITY_HORSE_ANGRY, Sound.ENTITY_HORSE_EAT, Sound.ENTITY_HORSE_BREATHE),
|
||||
|
||||
HUSK(Sound.ENTITY_HUSK_HURT, Sound.ENTITY_HUSK_STEP, Sound.ENTITY_HUSK_DEATH, Sound.ENTITY_HUSK_AMBIENT,
|
||||
Sound.ENTITY_HUSK_CONVERTED_TO_ZOMBIE),
|
||||
|
||||
ILLUSIONER(Sound.ENTITY_ILLUSIONER_HURT, null, Sound.ENTITY_ILLUSIONER_DEATH, Sound.ENTITY_ILLUSIONER_AMBIENT,
|
||||
Sound.ENTITY_ILLUSIONER_CAST_SPELL, Sound.ENTITY_ILLUSIONER_PREPARE_BLINDNESS,
|
||||
Sound.ENTITY_ILLUSIONER_PREPARE_MIRROR, Sound.ENTITY_ILLUSIONER_MIRROR_MOVE),
|
||||
|
||||
IRON_GOLEM(Sound.ENTITY_IRON_GOLEM_HURT, Sound.ENTITY_IRON_GOLEM_STEP, Sound.ENTITY_IRON_GOLEM_DEATH,
|
||||
Sound.ENTITY_IRON_GOLEM_ATTACK),
|
||||
|
||||
LLAMA(Sound.ENTITY_LLAMA_HURT, Sound.ENTITY_LLAMA_STEP, Sound.ENTITY_LLAMA_DEATH, Sound.ENTITY_LLAMA_AMBIENT,
|
||||
Sound.ENTITY_LLAMA_ANGRY, Sound.ENTITY_LLAMA_CHEST, Sound.ENTITY_LLAMA_EAT, Sound.ENTITY_LLAMA_SWAG),
|
||||
|
||||
MAGMA_CUBE(Sound.ENTITY_MAGMA_CUBE_HURT, Sound.ENTITY_MAGMA_CUBE_JUMP,
|
||||
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),
|
||||
|
||||
MULE(Sound.ENTITY_MULE_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_MULE_DEATH, Sound.ENTITY_MULE_AMBIENT,
|
||||
Sound.ENTITY_MULE_CHEST),
|
||||
|
||||
MUSHROOM_COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_DEATH, Sound.ENTITY_COW_AMBIENT),
|
||||
|
||||
OCELOT(Sound.ENTITY_CAT_HURT, Sound.BLOCK_GRASS_STEP, Sound.ENTITY_CAT_DEATH,
|
||||
new Sound[]{Sound.ENTITY_CAT_AMBIENT, Sound.ENTITY_CAT_PURR, Sound.ENTITY_CAT_PURREOW},
|
||||
Sound.ENTITY_CAT_HISS),
|
||||
|
||||
PARROT(Sound.ENTITY_PARROT_HURT, Sound.ENTITY_PARROT_STEP, Sound.ENTITY_PARROT_DEATH, Sound.ENTITY_PARROT_AMBIENT,
|
||||
Arrays.stream(Sound.values())
|
||||
.filter(sound -> sound.name().contains("PARROT_IMITATE") || sound == Sound.ENTITY_PARROT_EAT ||
|
||||
sound == Sound.ENTITY_PARROT_FLY).toArray(Sound[]::new)),
|
||||
|
||||
PIG(Sound.ENTITY_PIG_HURT, Sound.ENTITY_PIG_STEP, Sound.ENTITY_PIG_DEATH, Sound.ENTITY_PIG_AMBIENT),
|
||||
|
||||
PIG_ZOMBIE(Sound.ENTITY_ZOMBIE_PIGMAN_HURT, null, Sound.ENTITY_ZOMBIE_PIGMAN_DEATH,
|
||||
Sound.ENTITY_ZOMBIE_PIGMAN_AMBIENT, Sound.ENTITY_ZOMBIE_PIGMAN_ANGRY),
|
||||
|
||||
PLAYER(Sound.ENTITY_PLAYER_HURT, Arrays.stream(Sound.values())
|
||||
.filter(sound -> sound.name().startsWith("BLOCK_") && sound.name().endsWith("_STEP")).toArray(Sound[]::new),
|
||||
Sound.ENTITY_PLAYER_DEATH, null),
|
||||
|
||||
PHANTOM(Sound.ENTITY_PHANTOM_HURT, new Sound[]{Sound.ENTITY_PHANTOM_FLAP, Sound.ENTITY_PHANTOM_SWOOP},
|
||||
Sound.ENTITY_PHANTOM_DEATH, Sound.ENTITY_PHANTOM_AMBIENT, Sound.ENTITY_PHANTOM_BITE),
|
||||
|
||||
POLAR_BEAR(Sound.ENTITY_POLAR_BEAR_HURT, Sound.ENTITY_POLAR_BEAR_STEP, Sound.ENTITY_POLAR_BEAR_DEATH,
|
||||
new Sound[]{Sound.ENTITY_POLAR_BEAR_AMBIENT, Sound.ENTITY_POLAR_BEAR_AMBIENT_BABY},
|
||||
Sound.ENTITY_POLAR_BEAR_WARNING),
|
||||
|
||||
PUFFERFISH(Sound.ENTITY_PUFFER_FISH_HURT, null, Sound.ENTITY_PUFFER_FISH_DEATH, Sound.ENTITY_PUFFER_FISH_AMBIENT,
|
||||
Sound.ENTITY_PUFFER_FISH_BLOW_OUT, Sound.ENTITY_PUFFER_FISH_BLOW_UP, Sound.ENTITY_PUFFER_FISH_FLOP,
|
||||
Sound.ENTITY_PUFFER_FISH_STING, Sound.ENTITY_FISH_SWIM),
|
||||
|
||||
RABBIT(Sound.ENTITY_RABBIT_HURT, Sound.ENTITY_RABBIT_JUMP, Sound.ENTITY_RABBIT_DEATH, Sound.ENTITY_RABBIT_AMBIENT,
|
||||
Sound.ENTITY_RABBIT_ATTACK),
|
||||
|
||||
SALMON(Sound.ENTITY_SALMON_HURT, null, Sound.ENTITY_SALMON_DEATH, Sound.ENTITY_SALMON_AMBIENT,
|
||||
Sound.ENTITY_SALMON_FLOP, Sound.ENTITY_FISH_SWIM),
|
||||
|
||||
SHEEP(Sound.ENTITY_SHEEP_HURT, Sound.ENTITY_SHEEP_STEP, Sound.ENTITY_SHEEP_DEATH, Sound.ENTITY_SHEEP_AMBIENT,
|
||||
Sound.ENTITY_SHEEP_SHEAR),
|
||||
|
||||
SHULKER(new Sound[]{Sound.ENTITY_SHULKER_HURT, Sound.ENTITY_SHULKER_HURT_CLOSED}, null, Sound.ENTITY_SHULKER_DEATH,
|
||||
Sound.ENTITY_SHULKER_AMBIENT, Sound.ENTITY_SHULKER_OPEN, Sound.ENTITY_SHULKER_CLOSE,
|
||||
Sound.ENTITY_SHULKER_TELEPORT),
|
||||
|
||||
SILVERFISH(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_SILVERFISH_STEP, Sound.ENTITY_SILVERFISH_DEATH,
|
||||
Sound.ENTITY_SILVERFISH_AMBIENT),
|
||||
|
||||
SKELETON(Sound.ENTITY_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP, Sound.ENTITY_SKELETON_DEATH,
|
||||
Sound.ENTITY_SKELETON_AMBIENT),
|
||||
|
||||
SKELETON_HORSE(Sound.ENTITY_SKELETON_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
|
||||
Sound.ENTITY_SKELETON_HORSE_DEATH,
|
||||
new Sound[]{Sound.ENTITY_SKELETON_HORSE_AMBIENT, Sound.ENTITY_SKELETON_HORSE_AMBIENT_WATER},
|
||||
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_SKELETON_HORSE_GALLOP_WATER, Sound.ENTITY_SKELETON_HORSE_JUMP_WATER,
|
||||
Sound.ENTITY_SKELETON_HORSE_SWIM, Sound.ENTITY_SKELETON_HORSE_STEP_WATER),
|
||||
|
||||
SLIME(new Sound[]{Sound.ENTITY_SLIME_HURT, Sound.ENTITY_SLIME_HURT_SMALL},
|
||||
new Sound[]{Sound.ENTITY_SLIME_JUMP, Sound.ENTITY_SLIME_JUMP_SMALL},
|
||||
new Sound[]{Sound.ENTITY_SLIME_DEATH, Sound.ENTITY_SLIME_DEATH_SMALL}, null, Sound.ENTITY_SLIME_ATTACK,
|
||||
Sound.ENTITY_SLIME_SQUISH, Sound.ENTITY_SLIME_SQUISH_SMALL),
|
||||
|
||||
SNOWMAN(Sound.ENTITY_SNOW_GOLEM_HURT, null, Sound.ENTITY_SNOW_GOLEM_DEATH, Sound.ENTITY_SNOW_GOLEM_AMBIENT,
|
||||
Sound.ENTITY_SNOW_GOLEM_SHOOT),
|
||||
|
||||
SPIDER(Sound.ENTITY_SPIDER_HURT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH, Sound.ENTITY_SPIDER_AMBIENT),
|
||||
|
||||
STRAY(Sound.ENTITY_STRAY_HURT, Sound.ENTITY_STRAY_STEP, Sound.ENTITY_STRAY_DEATH, Sound.ENTITY_STRAY_AMBIENT),
|
||||
|
||||
SQUID(Sound.ENTITY_SQUID_HURT, null, Sound.ENTITY_SQUID_DEATH, Sound.ENTITY_SQUID_AMBIENT,
|
||||
Sound.ENTITY_SQUID_SQUIRT, Sound.ENTITY_FISH_SWIM),
|
||||
|
||||
TROPICAL_FISH(Sound.ENTITY_TROPICAL_FISH_HURT, null, Sound.ENTITY_TROPICAL_FISH_DEATH,
|
||||
Sound.ENTITY_TROPICAL_FISH_AMBIENT, Sound.ENTITY_TROPICAL_FISH_FLOP, Sound.ENTITY_FISH_SWIM),
|
||||
|
||||
TURTLE(new Sound[]{Sound.ENTITY_TURTLE_HURT, Sound.ENTITY_TURTLE_HURT_BABY},
|
||||
new Sound[]{Sound.ENTITY_TURTLE_SHAMBLE, Sound.ENTITY_TURTLE_SHAMBLE_BABY},
|
||||
new Sound[]{Sound.ENTITY_TURTLE_DEATH, Sound.ENTITY_TURTLE_DEATH_BABY}, Sound.ENTITY_TURTLE_AMBIENT_LAND,
|
||||
Sound.ENTITY_TURTLE_LAY_EGG),
|
||||
|
||||
VEX(Sound.ENTITY_VEX_HURT, null, Sound.ENTITY_VEX_DEATH, Sound.ENTITY_VEX_AMBIENT, Sound.ENTITY_VEX_CHARGE),
|
||||
|
||||
VILLAGER(Sound.ENTITY_VILLAGER_HURT, null, Sound.ENTITY_VILLAGER_DEATH, Sound.ENTITY_VILLAGER_AMBIENT,
|
||||
Sound.ENTITY_VILLAGER_TRADE, Sound.ENTITY_VILLAGER_NO, Sound.ENTITY_VILLAGER_YES),
|
||||
|
||||
VINDICATOR(Sound.ENTITY_VINDICATOR_HURT, null, Sound.ENTITY_VINDICATOR_DEATH, Sound.ENTITY_VINDICATOR_AMBIENT),
|
||||
|
||||
WITCH(Sound.ENTITY_WITCH_HURT, null, Sound.ENTITY_WITCH_DEATH, Sound.ENTITY_WITCH_AMBIENT),
|
||||
|
||||
WITHER(Sound.ENTITY_WITHER_HURT, null, Sound.ENTITY_WITHER_DEATH, Sound.ENTITY_WITHER_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_WITHER_SPAWN, Sound.ENTITY_PLAYER_BIG_FALL,
|
||||
Sound.ENTITY_WITHER_SHOOT),
|
||||
|
||||
WITHER_SKELETON(Sound.ENTITY_WITHER_SKELETON_HURT, Sound.ENTITY_WITHER_SKELETON_STEP,
|
||||
Sound.ENTITY_WITHER_SKELETON_DEATH, Sound.ENTITY_WITHER_SKELETON_AMBIENT),
|
||||
|
||||
WOLF(Sound.ENTITY_WOLF_HURT, Sound.ENTITY_WOLF_STEP, Sound.ENTITY_WOLF_DEATH, Sound.ENTITY_WOLF_AMBIENT,
|
||||
Sound.ENTITY_WOLF_GROWL, Sound.ENTITY_WOLF_PANT, Sound.ENTITY_WOLF_HOWL, Sound.ENTITY_WOLF_SHAKE,
|
||||
Sound.ENTITY_WOLF_WHINE),
|
||||
|
||||
ZOMBIE(Sound.ENTITY_ZOMBIE_HURT, Sound.ENTITY_ZOMBIE_STEP, Sound.ENTITY_ZOMBIE_DEATH, Sound.ENTITY_ZOMBIE_AMBIENT,
|
||||
Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR),
|
||||
|
||||
ZOMBIE_HORSE(Sound.ENTITY_ZOMBIE_HORSE_HURT, new Sound[]{Sound.BLOCK_GRASS_STEP, Sound.ENTITY_HORSE_STEP_WOOD},
|
||||
Sound.ENTITY_ZOMBIE_HORSE_DEATH, Sound.ENTITY_ZOMBIE_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP,
|
||||
Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
||||
Sound.ENTITY_HORSE_ANGRY),
|
||||
|
||||
ZOMBIE_VILLAGER(Sound.ENTITY_ZOMBIE_VILLAGER_HURT, Sound.ENTITY_ZOMBIE_VILLAGER_STEP,
|
||||
Sound.ENTITY_ZOMBIE_VILLAGER_DEATH, Sound.ENTITY_ZOMBIE_VILLAGER_AMBIENT, Sound.ENTITY_ZOMBIE_INFECT,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR);
|
||||
|
||||
@Getter
|
||||
private LinkedHashMap<Sound, SoundType> disguiseSounds = new LinkedHashMap<>();
|
||||
|
||||
DisguiseSoundEnums(Object hurt, Object step, Object death, Object idle, Object... sounds) {
|
||||
addSound(hurt, SoundType.HURT);
|
||||
addSound(step, SoundType.STEP);
|
||||
addSound(death, SoundType.DEATH);
|
||||
addSound(idle, SoundType.IDLE);
|
||||
|
||||
for (Object obj : sounds) {
|
||||
addSound(obj, SoundType.CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSound(Object sound, SoundType type) {
|
||||
if (sound == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sound instanceof Sound[]) {
|
||||
for (Sound s : (Sound[]) sound) {
|
||||
if (s == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
addSound(s, type);
|
||||
}
|
||||
} else if (sound instanceof Sound) {
|
||||
addSound((Sound) sound, type);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Was given an unknown object " + sound);
|
||||
}
|
||||
}
|
||||
|
||||
private void addSound(Sound sound, SoundType type) {
|
||||
disguiseSounds.put(sound, type);
|
||||
}
|
||||
}
|
@ -146,7 +146,7 @@ public class PacketListenerClientInteract extends PacketAdapter {
|
||||
continue;
|
||||
}
|
||||
|
||||
AnimalColor color = AnimalColor.getColorByWool(item.getType());
|
||||
AnimalColor color = AnimalColor.getColorByItem(item);
|
||||
|
||||
if (color == null) {
|
||||
continue;
|
||||
@ -173,7 +173,7 @@ public class PacketListenerClientInteract extends PacketAdapter {
|
||||
continue;
|
||||
}
|
||||
|
||||
AnimalColor color = AnimalColor.getColorByMaterial(item.getType());
|
||||
AnimalColor color = AnimalColor.getColorByItem(item);
|
||||
|
||||
if (color == null) {
|
||||
continue;
|
||||
|
@ -61,9 +61,15 @@ public class ParamInfoTypes {
|
||||
"View all the colors you can use for a llama color"));
|
||||
paramInfos.add(new ParamInfoEnum(Parrot.Variant.class, "Parrot Variant",
|
||||
"View the different colors a parrot can be"));
|
||||
paramInfos.add(new ParamInfoParticle(WrappedParticle.class, "Particle", "The different particles of Minecraft",
|
||||
Particle.values(), getMaterials()));
|
||||
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
paramInfos.add(new ParamInfoParticle(WrappedParticle.class, "Particle",
|
||||
"The different particles of Minecraft", Particle.values(), getMaterials()));
|
||||
paramInfos.add(new ParamInfoEnum(TropicalFish.Pattern.class, "Pattern", "Patterns of a tropical fish"));
|
||||
} else {
|
||||
paramInfos.add(new ParamInfoEnum(Particle.class, "Particle", "The different particles of Minecraft"));
|
||||
}
|
||||
|
||||
paramInfos.add(new ParamInfoEnum(DyeColor.class, "DyeColor", "Dye colors of many different colors"));
|
||||
paramInfos.add(new ParamInfoEnum(Horse.Style.class, "Horse Style",
|
||||
"Horse style which is the patterns on the horse"));
|
||||
@ -141,7 +147,7 @@ public class ParamInfoTypes {
|
||||
List<Material> list = new ArrayList<>();
|
||||
|
||||
for (Material material : Material.values()) {
|
||||
if (material == Material.AIR || material == Material.CAVE_AIR || material == Material.VOID_AIR) {
|
||||
if (material.name().matches("([A-Z]+_)?AIR")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2,18 +2,67 @@ package me.libraryaddict.disguise.utilities.reflection;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.MushroomCowWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseSound;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseSoundEnums;
|
||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 13/02/2020.
|
||||
*/
|
||||
public class CompileMethods {
|
||||
public static void main(String[] args) {
|
||||
doMethods();
|
||||
doSounds();
|
||||
}
|
||||
|
||||
private static void doSounds() {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
for (DisguiseSoundEnums s : DisguiseSoundEnums.values()) {
|
||||
StringBuilder sound = new StringBuilder(s.name());
|
||||
|
||||
for (DisguiseSound.SoundType type : DisguiseSound.SoundType.values()) {
|
||||
sound.append(":");
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (Map.Entry<Sound, DisguiseSound.SoundType> values : s.getDisguiseSounds().entrySet()) {
|
||||
if (values.getValue() != type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i++ > 0) {
|
||||
sound.append(",");
|
||||
}
|
||||
|
||||
sound.append(values.getKey().name());
|
||||
}
|
||||
}
|
||||
|
||||
list.add(sound.toString());
|
||||
}
|
||||
|
||||
File soundsFile = new File("target/classes/ANTI_PIRACY_ENCODED_WITH_SOUNDS");
|
||||
|
||||
try (PrintWriter writer = new PrintWriter(soundsFile, "UTF-8")) {
|
||||
writer.write(StringUtils.join(list, "\n"));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void doMethods() {
|
||||
ArrayList<Class<?>> classes = ClassGetter
|
||||
.getClassesForPackage(FlagWatcher.class, "me.libraryaddict.disguise.disguisetypes.watchers");
|
||||
classes.add(FlagWatcher.class);
|
||||
@ -36,6 +85,8 @@ public class CompileMethods {
|
||||
continue;
|
||||
} else if (!FlagWatcher.class.isAssignableFrom(method.getDeclaringClass())) {
|
||||
continue;
|
||||
} else if (LibsPremium.isPremium() && new Random().nextBoolean()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int added = -1;
|
||||
@ -56,8 +107,7 @@ public class CompileMethods {
|
||||
Class<?> param = method.getParameterTypes()[0];
|
||||
|
||||
String s = ((added >= 0 || removed >= 0) ? added + ":" + removed + ":" : "") +
|
||||
method.getDeclaringClass().getSimpleName() + ":" + method.getName() + ":" +
|
||||
param.getName();
|
||||
method.getDeclaringClass().getSimpleName() + ":" + method.getName() + ":" + param.getName();
|
||||
|
||||
if (methods.contains(s)) {
|
||||
continue;
|
||||
@ -67,7 +117,7 @@ public class CompileMethods {
|
||||
}
|
||||
}
|
||||
|
||||
File methodsFile = new File("target/classes/methods.txt");
|
||||
File methodsFile = new File("target/classes/ANTI_PIRACY_ENCRYPTION");
|
||||
|
||||
try (PrintWriter writer = new PrintWriter(methodsFile, "UTF-8")) {
|
||||
writer.write(StringUtils.join(methods, "\n"));
|
||||
|
@ -36,7 +36,7 @@ public class DisguiseMethods {
|
||||
}
|
||||
|
||||
public DisguiseMethods() {
|
||||
try (InputStream stream = LibsDisguises.getInstance().getResource("methods.txt")) {
|
||||
try (InputStream stream = LibsDisguises.getInstance().getResource("ANTI_PIRACY_ENCRYPTION")) {
|
||||
List<String> lines = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)).lines()
|
||||
.collect(Collectors.toList());
|
||||
HashMap<String, Class<? extends FlagWatcher>> classes = new HashMap<>();
|
||||
|
@ -4,6 +4,7 @@ package me.libraryaddict.disguise.utilities.reflection;
|
||||
* Created by libraryaddict on 6/02/2020.
|
||||
*/
|
||||
public enum NmsVersion {
|
||||
v1_12,
|
||||
v1_13,
|
||||
v1_14,
|
||||
v1_15;
|
||||
|
@ -978,7 +978,7 @@ public class ReflectionManager {
|
||||
Optional opt = (Optional) value;
|
||||
|
||||
if (!opt.isPresent())
|
||||
return value;
|
||||
return NmsVersion.v1_13.isSupported() ? value : com.google.common.base.Optional.absent();
|
||||
|
||||
Object val = opt.get();
|
||||
|
||||
@ -986,15 +986,18 @@ public class ReflectionManager {
|
||||
BlockPosition pos = (BlockPosition) val;
|
||||
|
||||
try {
|
||||
return Optional.of(getNmsConstructor("BlockPosition", int.class, int.class, int.class)
|
||||
.newInstance(pos.getX(), pos.getY(), pos.getZ()));
|
||||
Object obj = getNmsConstructor("BlockPosition", int.class, int.class, int.class)
|
||||
.newInstance(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
return NmsVersion.v1_13.isSupported() ? Optional.of(obj) : com.google.common.base.Optional.of(obj);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else if (val instanceof WrappedBlockData) {
|
||||
try {
|
||||
return Optional.of(((WrappedBlockData) val).getHandle());
|
||||
Object obj = ((WrappedBlockData) val).getHandle();
|
||||
return NmsVersion.v1_13.isSupported() ? Optional.of(obj) : com.google.common.base.Optional.of(obj);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
@ -1003,11 +1006,15 @@ public class ReflectionManager {
|
||||
val = getNmsItem((ItemStack) val);
|
||||
|
||||
if (val == null)
|
||||
return Optional.empty();
|
||||
return NmsVersion.v1_13.isSupported() ? Optional.empty() : com.google.common.base.Optional.absent();
|
||||
else
|
||||
return Optional.of(val);
|
||||
} else if (val instanceof WrappedChatComponent) {
|
||||
return Optional.of(((WrappedChatComponent) val).getHandle());
|
||||
Object obj = ((WrappedChatComponent) val).getHandle();
|
||||
|
||||
return NmsVersion.v1_13.isSupported() ? Optional.of(obj) : com.google.common.base.Optional.of(obj);
|
||||
}else if (!NmsVersion.v1_13.isSupported()) {
|
||||
return com.google.common.base.Optional.of(val);
|
||||
}
|
||||
} else if (value instanceof Vector3F) {
|
||||
Vector3F angle = (Vector3F) value;
|
||||
@ -1209,6 +1216,7 @@ public class ReflectionManager {
|
||||
|
||||
public static int getEntityTypeId(EntityType entityType) {
|
||||
try {
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
Object entityTypes = getEntityType(entityType);
|
||||
|
||||
Class typesClass = getNmsClass("IRegistry");
|
||||
@ -1217,6 +1225,9 @@ public class ReflectionManager {
|
||||
|
||||
return (int) registry.getClass().getMethod("a", Object.class).invoke(registry, entityTypes);
|
||||
}
|
||||
|
||||
return entityType.getTypeId();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user