mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2025-02-05 06:12:48 +00:00
Current progress
This commit is contained in:
parent
802c14cb75
commit
7cefd2c51a
18 changed files with 1325 additions and 541 deletions
|
@ -62,29 +62,6 @@ public class LibsDisguises extends JavaPlugin
|
|||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName("com.comphenix.protocol.wrappers.Vector3F").getName();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.err.println("[LibsDisguises] Lib's Disguises failed to startup, outdated ProtocolLib!");
|
||||
System.err.println(
|
||||
"[LibsDisguises] You need to update ProtocolLib, please try this build http://ci.dmulloy2.net/job/ProtocolLib/lastStableBuild/artifact/modules/ProtocolLib/target/ProtocolLib.jar");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ReflectionManager.getNmsClass("EntityShulker").getName();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.err.println("[LibsDisguises] Lib's Disguises failed to startup, outdated server!");
|
||||
System.err.println("[LibsDisguises] This plugin does not offer backwards support!");
|
||||
return;
|
||||
}
|
||||
|
||||
getLogger().info("Discovered MC version: " + ReflectionManager.getBukkitVersion());
|
||||
|
||||
saveDefaultConfig();
|
||||
|
@ -293,6 +270,12 @@ public class LibsDisguises extends JavaPlugin
|
|||
nmsEntityName = "Guardian";
|
||||
break;
|
||||
case ARROW:
|
||||
if (!ReflectionManager.is1_7() && !ReflectionManager.is1_8())
|
||||
{
|
||||
nmsEntityName = "TippedArrow";
|
||||
}
|
||||
|
||||
break;
|
||||
case SPECTRAL_ARROW:
|
||||
nmsEntityName = "TippedArrow";
|
||||
default:
|
||||
|
|
|
@ -16,10 +16,15 @@ public class LibsDisguisesCommand implements CommandExecutor
|
|||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "This server is running " + "Lib's Disguises v."
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + "This server is running special edition " + "Lib's Disguises v."
|
||||
+ Bukkit.getPluginManager().getPlugin("LibsDisguises").getDescription().getVersion()
|
||||
+ " by libraryaddict, maintained by NavidK0.\n"
|
||||
+ "Use /libsdisguises reload to reload the config. All disguises will be blown by doing this.");
|
||||
+ " by libraryaddict, maintained by NavidK0, purchased by %%__USER__%%.");
|
||||
|
||||
if (sender.hasPermission("libsdisguises.reload"))
|
||||
{
|
||||
sender.sendMessage(ChatColor.DARK_GREEN
|
||||
+ "Use /libsdisguises reload to reload the config. All disguises will be blown by doing this.");
|
||||
}
|
||||
}
|
||||
else if (args.length > 0)
|
||||
{
|
||||
|
|
129
src/me/libraryaddict/disguise/disguisetypes/Converter.java
Normal file
129
src/me/libraryaddict/disguise/disguisetypes/Converter.java
Normal file
|
@ -0,0 +1,129 @@
|
|||
package me.libraryaddict.disguise.disguisetypes;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
public abstract class Converter<Y, G>
|
||||
{
|
||||
public abstract G convertSend(Y obj);
|
||||
|
||||
public abstract Y convertReceive(G obj);
|
||||
|
||||
public static Converter<Boolean, Byte> BOOLEAN_TO_BYTE = new Converter<Boolean, Byte>()
|
||||
{
|
||||
@Override
|
||||
public Byte convertSend(Boolean obj)
|
||||
{
|
||||
return (byte) (obj ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean convertReceive(Byte obj)
|
||||
{
|
||||
return obj == 1;
|
||||
}
|
||||
};
|
||||
|
||||
public static Converter<Boolean, Integer> BOOLEAN_TO_INT = new Converter<Boolean, Integer>()
|
||||
{
|
||||
@Override
|
||||
public Integer convertSend(Boolean obj)
|
||||
{
|
||||
return (obj ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean convertReceive(Integer obj)
|
||||
{
|
||||
return obj != 0;
|
||||
}
|
||||
};
|
||||
|
||||
public static Converter<Integer, Byte> INT_TO_BYTE = new Converter<Integer, Byte>()
|
||||
{
|
||||
@Override
|
||||
public Byte convertSend(Integer obj)
|
||||
{
|
||||
return obj.byteValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer convertReceive(Byte obj)
|
||||
{
|
||||
return obj.intValue();
|
||||
}
|
||||
};
|
||||
public static Converter<Byte, Integer> BYTE_TO_INT = new Converter<Byte, Integer>()
|
||||
{
|
||||
@Override
|
||||
public Byte convertReceive(Integer obj)
|
||||
{
|
||||
return obj.byteValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer convertSend(Byte obj)
|
||||
{
|
||||
return obj.intValue();
|
||||
}
|
||||
};
|
||||
|
||||
public static Converter<Optional<ItemStack>, ItemStack> OPT_ITEM_TO_ITEM = new Converter<Optional<ItemStack>, ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public ItemStack convertSend(Optional<ItemStack> obj)
|
||||
{
|
||||
if (!obj.isPresent())
|
||||
return new ItemStack(Material.AIR);
|
||||
|
||||
return obj.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ItemStack> convertReceive(ItemStack obj)
|
||||
{
|
||||
return Optional.fromNullable(obj);
|
||||
}
|
||||
};
|
||||
|
||||
public static Converter<Optional<UUID>, String> OPT_UUID_TO_STRING = new Converter<Optional<UUID>, String>()
|
||||
{
|
||||
@Override
|
||||
public String convertSend(Optional<UUID> obj)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UUID> convertReceive(String obj)
|
||||
{
|
||||
return Optional.absent();
|
||||
}
|
||||
};
|
||||
|
||||
public static Converter<Optional<WrappedBlockData>, ItemStack> BLOCKDATA_TO_ITEM = new Converter<Optional<WrappedBlockData>, ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public ItemStack convertSend(Optional<WrappedBlockData> obj)
|
||||
{
|
||||
if (!obj.isPresent())
|
||||
return null;
|
||||
|
||||
return new ItemStack(obj.get().getType(), 1, (short) obj.get().getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<WrappedBlockData> convertReceive(ItemStack obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return Optional.absent();
|
||||
|
||||
return Optional.of(WrappedBlockData.createData(obj.getType(), obj.getDurability()));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -809,7 +809,7 @@ public abstract class Disguise
|
|||
backup = flagType;
|
||||
}
|
||||
|
||||
getWatcher().setBackupValue(flag, backup == null ? null : backup.getDefault());
|
||||
getWatcher().setBackupValue(flag, backup == null ? null : backup.convertToSend(backup.getDefault()));
|
||||
}
|
||||
|
||||
getWatcher().setNoGravity(true);
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package me.libraryaddict.disguise.disguisetypes;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
@ -58,241 +61,382 @@ import me.libraryaddict.disguise.disguisetypes.watchers.WitherSkullWatcher;
|
|||
import me.libraryaddict.disguise.disguisetypes.watchers.WitherWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.WolfWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager;
|
||||
|
||||
public class FlagType<Y>
|
||||
{
|
||||
|
||||
private static final int _v1_10 = 0;
|
||||
private static final int _v1_8 = 2;
|
||||
private static final int _v1_9 = 1;
|
||||
private static final int _v1_7 = 3;
|
||||
private static FlagType[] _values = new FlagType[0];
|
||||
|
||||
public static FlagType<Boolean> AGEABLE_BABY = new FlagType<Boolean>(AgeableWatcher.class, 0, false);
|
||||
public static FlagType<Boolean> AGEABLE_BABY = new FlagType<Boolean>(AgeableWatcher.class, 0, false)
|
||||
.set1_7(new Converter<Boolean, Integer>()
|
||||
{
|
||||
public Integer convertSend(Boolean isAdult)
|
||||
{
|
||||
return isAdult ? 0 : -24000;
|
||||
}
|
||||
|
||||
public Boolean convertReceive(Integer isAdult)
|
||||
{
|
||||
return isAdult >= 0;
|
||||
}
|
||||
}).set1_8(12).set1_7(12);
|
||||
|
||||
public static FlagType<Integer> AREA_EFFECT_COLOR = new FlagType<Integer>(AreaEffectCloudWatcher.class, 1,
|
||||
Color.BLACK.asRGB());
|
||||
Color.BLACK.asRGB()).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Boolean> AREA_EFFECT_IGNORE_RADIUS = new FlagType<Boolean>(AreaEffectCloudWatcher.class, 2, false);
|
||||
public static FlagType<Boolean> AREA_EFFECT_IGNORE_RADIUS = new FlagType<Boolean>(AreaEffectCloudWatcher.class, 2, false)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> AREA_EFFECT_PARTICLE = new FlagType<Integer>(AreaEffectCloudWatcher.class, 3, 0);
|
||||
public static FlagType<Integer> AREA_EFFECT_PARTICLE = new FlagType<Integer>(AreaEffectCloudWatcher.class, 3, 0)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> AREA_EFFECT_PARTICLE_PARAM_1 = new FlagType<Integer>(AreaEffectCloudWatcher.class, 4, 0);
|
||||
public static FlagType<Integer> AREA_EFFECT_PARTICLE_PARAM_1 = new FlagType<Integer>(AreaEffectCloudWatcher.class, 4, 0)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> AREA_EFFECT_PARTICLE_PARAM_2 = new FlagType<Integer>(AreaEffectCloudWatcher.class, 5, 0);
|
||||
public static FlagType<Integer> AREA_EFFECT_PARTICLE_PARAM_2 = new FlagType<Integer>(AreaEffectCloudWatcher.class, 5, 0)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Float> AREA_EFFECT_RADIUS = new FlagType<Float>(AreaEffectCloudWatcher.class, 0, 0F);
|
||||
public static FlagType<Float> AREA_EFFECT_RADIUS = new FlagType<Float>(AreaEffectCloudWatcher.class, 0, 0F)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Vector3F> ARMORSTAND_BODY = new FlagType<Vector3F>(ArmorStandWatcher.class, 2,
|
||||
new Vector3F(0, 0, 0));
|
||||
public static FlagType<Vector3F> ARMORSTAND_BODY = new FlagType<Vector3F>(ArmorStandWatcher.class, 2, new Vector3F(0, 0, 0))
|
||||
.set1_8(12);
|
||||
|
||||
public static FlagType<Vector3F> ARMORSTAND_HEAD = new FlagType<Vector3F>(ArmorStandWatcher.class, 1,
|
||||
new Vector3F(0, 0, 0));
|
||||
public static FlagType<Vector3F> ARMORSTAND_HEAD = new FlagType<Vector3F>(ArmorStandWatcher.class, 1, new Vector3F(0, 0, 0))
|
||||
.set1_8(11);
|
||||
|
||||
public static FlagType<Vector3F> ARMORSTAND_LEFT_ARM = new FlagType<Vector3F>(ArmorStandWatcher.class, 3,
|
||||
new Vector3F(0, 0, 0));
|
||||
new Vector3F(0, 0, 0)).set1_8(13);
|
||||
|
||||
public static FlagType<Vector3F> ARMORSTAND_LEFT_LEG = new FlagType<Vector3F>(ArmorStandWatcher.class, 5,
|
||||
new Vector3F(0, 0, 0));
|
||||
new Vector3F(0, 0, 0)).set1_8(15);
|
||||
|
||||
public static FlagType<Byte> ARMORSTAND_META = new FlagType<Byte>(ArmorStandWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> ARMORSTAND_META = new FlagType<Byte>(ArmorStandWatcher.class, 0, (byte) 0).set1_8(10);
|
||||
|
||||
public static FlagType<Vector3F> ARMORSTAND_RIGHT_ARM = new FlagType<Vector3F>(ArmorStandWatcher.class, 4, new Vector3F(0,0,0));
|
||||
public static FlagType<Vector3F> ARMORSTAND_RIGHT_ARM = new FlagType<Vector3F>(ArmorStandWatcher.class, 4,
|
||||
new Vector3F(0, 0, 0)).set1_8(14);
|
||||
|
||||
public static FlagType<Vector3F> ARMORSTAND_RIGHT_LEG = new FlagType<Vector3F>(ArmorStandWatcher.class, 6, new Vector3F(0,0,0));
|
||||
public static FlagType<Vector3F> ARMORSTAND_RIGHT_LEG = new FlagType<Vector3F>(ArmorStandWatcher.class, 6,
|
||||
new Vector3F(0, 0, 0)).set1_8(16);
|
||||
|
||||
public static FlagType<Byte> ARROW_CRITICAL = new FlagType<Byte>(ArrowWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> ARROW_CRITICAL = new FlagType<Byte>(ArrowWatcher.class, 0, (byte) 0).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Byte> BAT_HANGING = new FlagType<Byte>(BatWatcher.class, 0, (byte) 1);
|
||||
public static FlagType<Byte> BAT_HANGING = new FlagType<Byte>(BatWatcher.class, 0, (byte) 1).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Byte> BLAZE_BLAZING = new FlagType<Byte>(BlazeWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> BLAZE_BLAZING = new FlagType<Byte>(BlazeWatcher.class, 0, (byte) 0).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Float> BOAT_DAMAGE = new FlagType<Float>(BoatWatcher.class, 2, 40F);
|
||||
public static FlagType<Float> BOAT_DAMAGE = new FlagType<Float>(BoatWatcher.class, 2, 40F).set1_8(19).set1_7(19);
|
||||
|
||||
public static FlagType<Integer> BOAT_DIRECTION = new FlagType<Integer>(BoatWatcher.class, 1, 0);
|
||||
public static FlagType<Integer> BOAT_DIRECTION = new FlagType<Integer>(BoatWatcher.class, 1, 0).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> BOAT_LAST_HIT = new FlagType<Integer>(BoatWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> BOAT_LAST_HIT = new FlagType<Integer>(BoatWatcher.class, 0, 0).set1_8(17).set1_7(17);
|
||||
|
||||
public static FlagType<Boolean> BOAT_LEFT_PADDLING = new FlagType<Boolean>(BoatWatcher.class, 5, false);
|
||||
public static FlagType<Integer> BOAT_SHAKE = new FlagType<Integer>(BoatWatcher.class, 18, 0).setSupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Boolean> BOAT_RIGHT_PADDLING = new FlagType<Boolean>(BoatWatcher.class, 4, false);
|
||||
public static FlagType<Boolean> BOAT_LEFT_PADDLING = new FlagType<Boolean>(BoatWatcher.class, 5, false).setUnsupported(_v1_8,
|
||||
_v1_7);
|
||||
|
||||
public static FlagType<Integer> BOAT_TYPE = new FlagType<Integer>(BoatWatcher.class, 3, 0);
|
||||
public static FlagType<Boolean> BOAT_RIGHT_PADDLING = new FlagType<Boolean>(BoatWatcher.class, 4, false).setUnsupported(_v1_8,
|
||||
_v1_7);
|
||||
|
||||
public static FlagType<Boolean> CREEPER_IGNITED = new FlagType<Boolean>(CreeperWatcher.class, 2, false);
|
||||
public static FlagType<Integer> BOAT_TYPE = new FlagType<Integer>(BoatWatcher.class, 3, 0).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Boolean> CREEPER_POWERED = new FlagType<Boolean>(CreeperWatcher.class, 1, false);
|
||||
public static FlagType<Boolean> CREEPER_IGNITED = new FlagType<Boolean>(CreeperWatcher.class, 2, false)
|
||||
.set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(18).set1_8(18);
|
||||
|
||||
public static FlagType<Integer> CREEPER_STATE = new FlagType<Integer>(CreeperWatcher.class, 0, -1);
|
||||
public static FlagType<Boolean> CREEPER_POWERED = new FlagType<Boolean>(CreeperWatcher.class, 1, false)
|
||||
.set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(17).set1_8(17);
|
||||
|
||||
public static FlagType<Integer> CREEPER_STATE = new FlagType<Integer>(CreeperWatcher.class, 0, -1).set1_7(16).set1_8(16);
|
||||
|
||||
public static FlagType<Optional<ItemStack>> DROPPED_ITEM = new FlagType<Optional<ItemStack>>(DroppedItemWatcher.class, 0,
|
||||
Optional.<ItemStack> of(new ItemStack(Material.STONE)));
|
||||
Optional.<ItemStack> of(new ItemStack(Material.STONE))).set1_8(Converter.OPT_ITEM_TO_ITEM)
|
||||
.set1_7(Converter.OPT_ITEM_TO_ITEM).set1_8(10).set1_7(10);
|
||||
|
||||
public static FlagType<Optional<BlockPosition>> ENDER_CRYSTAL_BEAM = new FlagType<Optional<BlockPosition>>(
|
||||
EnderCrystalWatcher.class, 0, Optional.<BlockPosition> absent());
|
||||
EnderCrystalWatcher.class, 0, Optional.<BlockPosition> absent()).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Boolean> ENDER_CRYSTAL_PLATE = new FlagType<Boolean>(EnderCrystalWatcher.class, 1, false);
|
||||
public static FlagType<Boolean> ENDER_CRYSTAL_PLATE = new FlagType<Boolean>(EnderCrystalWatcher.class, 1, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_INT).set1_7(Converter.BOOLEAN_TO_INT).set1_8(8).set1_7(8);
|
||||
|
||||
public static FlagType<Integer> ENDERDRAGON_PHASE = new FlagType<Integer>(EnderDragonWatcher.class, 0, 0);
|
||||
|
||||
public static FlagType<Boolean> ENDERMAN_AGRESSIVE = new FlagType<Boolean>(EndermanWatcher.class, 1, false);
|
||||
public static FlagType<Boolean> ENDERMAN_AGRESSIVE = new FlagType<Boolean>(EndermanWatcher.class, 1, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(18).set1_7(18);
|
||||
|
||||
public static FlagType<Optional<WrappedBlockData>> ENDERMAN_ITEM = new FlagType<Optional<WrappedBlockData>>(
|
||||
EndermanWatcher.class, 0, Optional.<WrappedBlockData> absent());
|
||||
EndermanWatcher.class, 0, Optional.<WrappedBlockData> absent()).setUnsupported(_v1_7, _v1_8);
|
||||
|
||||
public static FlagType<Short> ENDERMAN_OLD_ITEM_TYPE = new FlagType<Short>(EndermanWatcher.class, 16, (short) 0)
|
||||
.setSupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Byte> ENDERMAN_OLD_ITEM_DATA = new FlagType<Byte>(EndermanWatcher.class, 17, (byte) 0)
|
||||
.setSupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> ENTITY_AIR_TICKS = new FlagType<Integer>(FlagWatcher.class, 1, 0);
|
||||
|
||||
public static FlagType<String> ENTITY_CUSTOM_NAME = new FlagType<String>(FlagWatcher.class, 2, "");
|
||||
|
||||
public static FlagType<Boolean> ENTITY_CUSTOM_NAME_VISIBLE = new FlagType<Boolean>(FlagWatcher.class, 3, false);
|
||||
public static FlagType<Boolean> ENTITY_CUSTOM_NAME_VISIBLE = new FlagType<Boolean>(FlagWatcher.class, 3, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE);
|
||||
|
||||
public static FlagType<Byte> ENTITY_META = new FlagType<Byte>(FlagWatcher.class, 0, (byte) 0);
|
||||
|
||||
public static FlagType<Boolean> ENTITY_NO_GRAVITY = new FlagType<Boolean>(FlagWatcher.class, 5, false);
|
||||
public static FlagType<Boolean> ENTITY_NO_GRAVITY = new FlagType<Boolean>(FlagWatcher.class, 5, false).setUnsupported(_v1_8,
|
||||
_v1_9);
|
||||
|
||||
public static FlagType<Boolean> ENTITY_SILENT = new FlagType<Boolean>(FlagWatcher.class, 4, false);
|
||||
public static FlagType<Boolean> ENTITY_SILENT = new FlagType<Boolean>(FlagWatcher.class, 4, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).setUnsupported(_v1_7);
|
||||
|
||||
public static FlagType<BlockPosition> FALLING_BLOCK_POSITION = new FlagType<BlockPosition>(FallingBlockWatcher.class, 0,
|
||||
BlockPosition.ORIGIN);
|
||||
BlockPosition.ORIGIN).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Optional<ItemStack>> FIREWORK_ITEM = new FlagType<Optional<ItemStack>>(FireworkWatcher.class, 0,
|
||||
Optional.<ItemStack> absent());
|
||||
Optional.<ItemStack> absent()).set1_8(Converter.OPT_ITEM_TO_ITEM).set1_7(Converter.OPT_ITEM_TO_ITEM).set1_8(8)
|
||||
.set1_7(8);
|
||||
|
||||
public static FlagType<Integer> FISHING_HOOK = new FlagType<Integer>(FishingHookWatcher.class, 0, 0);
|
||||
|
||||
public static FlagType<Boolean> GHAST_AGRESSIVE = new FlagType<Boolean>(GhastWatcher.class, 0, false);
|
||||
public static FlagType<Boolean> GHAST_AGRESSIVE = new FlagType<Boolean>(GhastWatcher.class, 0, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Byte> GUARDIAN_FLAG = new FlagType<Byte>(GuardianWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> GUARDIAN_FLAG = new FlagType<Byte>(GuardianWatcher.class, 0, (byte) 0)
|
||||
.set1_8(Converter.INT_TO_BYTE).set1_7(Converter.INT_TO_BYTE).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Integer> GUARDIAN_TARGET = new FlagType<Integer>(GuardianWatcher.class, 1, 0);
|
||||
public static FlagType<Integer> GUARDIAN_TARGET = new FlagType<Integer>(GuardianWatcher.class, 1, 0).set1_8(17).set1_7(17);
|
||||
|
||||
public static FlagType<Integer> HORSE_ARMOR = new FlagType<Integer>(HorseWatcher.class, 4, 0);
|
||||
public static FlagType<Integer> HORSE_ARMOR = new FlagType<Integer>(HorseWatcher.class, 4, 0).set1_8(22).set1_7(22);
|
||||
|
||||
public static FlagType<Integer> HORSE_COLOR = new FlagType<Integer>(HorseWatcher.class, 2, 0);
|
||||
public static FlagType<Integer> HORSE_COLOR = new FlagType<Integer>(HorseWatcher.class, 2, 0).set1_8(20).set1_7(20);
|
||||
|
||||
public static FlagType<Byte> HORSE_META = new FlagType<Byte>(HorseWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> HORSE_META = new FlagType<Byte>(HorseWatcher.class, 0, (byte) 0).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Optional<UUID>> HORSE_OWNER = new FlagType<Optional<UUID>>(HorseWatcher.class, 3,
|
||||
Optional.<UUID> absent());
|
||||
Optional.<UUID> absent()).set1_8(Converter.OPT_UUID_TO_STRING).set1_7(Converter.OPT_UUID_TO_STRING).set1_8(21)
|
||||
.set1_7(21);
|
||||
|
||||
public static FlagType<Integer> HORSE_VARIANT = new FlagType<Integer>(HorseWatcher.class, 1, 0);
|
||||
public static FlagType<Integer> HORSE_VARIANT = new FlagType<Integer>(HorseWatcher.class, 1, 0).set1_8(19).set1_7(19);
|
||||
|
||||
public static FlagType<Byte> INSENTIENT_META = new FlagType<Byte>(InsentientWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> INSENTIENT_META = new FlagType<Byte>(InsentientWatcher.class, 0, (byte) 0).set1_8(15)
|
||||
.setUnsupported(_v1_7);
|
||||
|
||||
public static FlagType<Byte> IRON_GOLEM_PLAYER_CREATED = new FlagType<Byte>(IronGolemWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> IRON_GOLEM_PLAYER_CREATED = new FlagType<Byte>(IronGolemWatcher.class, 0, (byte) 0).set1_8(16)
|
||||
.set1_7(16);
|
||||
|
||||
public static FlagType<Optional<ItemStack>> ITEMFRAME_ITEM = new FlagType<Optional<ItemStack>>(ItemFrameWatcher.class, 0,
|
||||
Optional.<ItemStack> absent());
|
||||
Optional.<ItemStack> absent()).set1_8(Converter.OPT_ITEM_TO_ITEM).set1_7(Converter.OPT_ITEM_TO_ITEM).set1_8(8)
|
||||
.set1_7(8);
|
||||
|
||||
public static FlagType<Integer> ITEMFRAME_ROTATION = new FlagType<Integer>(ItemFrameWatcher.class, 1, 0);
|
||||
public static FlagType<Integer> ITEMFRAME_ROTATION = new FlagType<Integer>(ItemFrameWatcher.class, 1, 0)
|
||||
.set1_8(Converter.INT_TO_BYTE).set1_7(Converter.INT_TO_BYTE).set1_8(9).set1_7(9);
|
||||
|
||||
public static FlagType<Integer> LIVING_ARROWS = new FlagType<Integer>(LivingWatcher.class, 4, 0);
|
||||
public static FlagType<Integer> LIVING_ARROWS = new FlagType<Integer>(LivingWatcher.class, 4, 0).set1_8(Converter.INT_TO_BYTE)
|
||||
.set1_7(Converter.INT_TO_BYTE).set1_8(9).set1_7(9);
|
||||
|
||||
public static FlagType<Byte> LIVING_HAND = new FlagType<Byte>(LivingWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> LIVING_HAND = new FlagType<Byte>(LivingWatcher.class, 0, (byte) 0).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Float> LIVING_HEALTH = new FlagType<Float>(LivingWatcher.class, 1, 1F);
|
||||
public static FlagType<Float> LIVING_HEALTH = new FlagType<Float>(LivingWatcher.class, 1, 1F).set1_8(6).set1_7(6);
|
||||
|
||||
public static FlagType<Boolean> LIVING_POTION_AMBIENT = new FlagType<Boolean>(LivingWatcher.class, 3, false);
|
||||
public static FlagType<Boolean> LIVING_POTION_AMBIENT = new FlagType<Boolean>(LivingWatcher.class, 3, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(8).set1_7(8);
|
||||
|
||||
public static FlagType<Integer> LIVING_POTIONS = new FlagType<Integer>(LivingWatcher.class, 2, 0);
|
||||
public static FlagType<Integer> LIVING_POTIONS = new FlagType<Integer>(LivingWatcher.class, 2, 0).set1_8(7).set1_7(7);
|
||||
|
||||
public static FlagType<Integer> MINECART_BLOCK = new FlagType<Integer>(MinecartWatcher.class, 3, 0);
|
||||
public static FlagType<Integer> MINECART_BLOCK = new FlagType<Integer>(MinecartWatcher.class, 3, 0).set1_8(20).set1_7(20);
|
||||
|
||||
public static FlagType<Boolean> MINECART_BLOCK_VISIBLE = new FlagType<Boolean>(MinecartWatcher.class, 5, false);
|
||||
public static FlagType<Boolean> MINECART_BLOCK_VISIBLE = new FlagType<Boolean>(MinecartWatcher.class, 5, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(22).set1_7(22);
|
||||
|
||||
public static FlagType<Integer> MINECART_BLOCK_Y = new FlagType<Integer>(MinecartWatcher.class, 4, 0);
|
||||
public static FlagType<Integer> MINECART_BLOCK_Y = new FlagType<Integer>(MinecartWatcher.class, 4, 0).set1_8(21).set1_7(21);
|
||||
|
||||
public static FlagType<Integer> MINECART_SHAKING_DIRECTION = new FlagType<Integer>(MinecartWatcher.class, 1, 1);
|
||||
public static FlagType<Integer> MINECART_SHAKING_DIRECTION = new FlagType<Integer>(MinecartWatcher.class, 1, 1).set1_8(18)
|
||||
.set1_7(18);
|
||||
|
||||
public static FlagType<Float> MINECART_SHAKING_MULITPLIER = new FlagType<Float>(MinecartWatcher.class, 2, 0F);
|
||||
public static FlagType<Float> MINECART_SHAKING_MULITPLIER = new FlagType<Float>(MinecartWatcher.class, 2, 0F).set1_8(19)
|
||||
.set1_7(19);
|
||||
|
||||
public static FlagType<Integer> MINECART_SHAKING_POWER = new FlagType<Integer>(MinecartWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> MINECART_SHAKING_POWER = new FlagType<Integer>(MinecartWatcher.class, 0, 0).set1_8(17)
|
||||
.set1_7(17);
|
||||
|
||||
public static FlagType<Integer> OCELOT_TYPE = new FlagType<Integer>(OcelotWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> OCELOT_TYPE = new FlagType<Integer>(OcelotWatcher.class, 0, 0).set1_8(Converter.INT_TO_BYTE)
|
||||
.set1_7(Converter.INT_TO_BYTE).set1_8(18).set1_7(18);
|
||||
|
||||
public static FlagType<Boolean> PIG_SADDLED = new FlagType<Boolean>(PigWatcher.class, 0, false);
|
||||
public static FlagType<Boolean> PIG_SADDLED = new FlagType<Boolean>(PigWatcher.class, 0, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Float> PLAYER_ABSORPTION = new FlagType<Float>(PlayerWatcher.class, 0, 0F);
|
||||
public static FlagType<Float> PLAYER_ABSORPTION = new FlagType<Float>(PlayerWatcher.class, 0, 0F).set1_8(17).set1_7(17);
|
||||
|
||||
public static FlagType<Byte> PLAYER_HAND = new FlagType<Byte>(PlayerWatcher.class, 3, (byte) 0);
|
||||
public static FlagType<Byte> PLAYER_HAND = new FlagType<Byte>(PlayerWatcher.class, 3, (byte) 0).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> PLAYER_SCORE = new FlagType<Integer>(PlayerWatcher.class, 1, 0);
|
||||
public static FlagType<Integer> PLAYER_SCORE = new FlagType<Integer>(PlayerWatcher.class, 1, 0).set1_8(18).set1_7(18);
|
||||
|
||||
public static FlagType<Byte> PLAYER_SKIN = new FlagType<Byte>(PlayerWatcher.class, 2, (byte) 127);
|
||||
public static FlagType<Byte> PLAYER_SKIN = new FlagType<Byte>(PlayerWatcher.class, 2, (byte) 127).set1_8(10).set1_7(10);
|
||||
|
||||
public static FlagType<Byte> PLAYER_SOMETHING = new FlagType<Byte>(PlayerWatcher.class, 16, (byte) 0).setSupported(_v1_7,
|
||||
_v1_8);
|
||||
|
||||
public static FlagType<Boolean> POLAR_BEAR_STANDING = new FlagType<Boolean>(PolarBearWatcher.class, 0, false);
|
||||
|
||||
public static FlagType<Integer> RABBIT_TYPE = new FlagType<Integer>(RabbitWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> RABBIT_TYPE = new FlagType<Integer>(RabbitWatcher.class, 0, 0).set1_8(Converter.INT_TO_BYTE)
|
||||
.set1_7(Converter.INT_TO_BYTE).set1_8(18).set1_7(18);
|
||||
|
||||
public static FlagType<Byte> SHEEP_WOOL = new FlagType<Byte>(SheepWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> SHEEP_WOOL = new FlagType<Byte>(SheepWatcher.class, 0, (byte) 0).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Optional<BlockPosition>> SHULKER_ATTACHED = new FlagType<Optional<BlockPosition>>(ShulkerWatcher.class,
|
||||
1, Optional.<BlockPosition> absent());
|
||||
1, Optional.<BlockPosition> absent()).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Direction> SHULKER_FACING = new FlagType<Direction>(ShulkerWatcher.class, 0, Direction.DOWN);
|
||||
public static FlagType<Direction> SHULKER_FACING = new FlagType<Direction>(ShulkerWatcher.class, 0, Direction.DOWN)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Byte> SHULKER_PEEKING = new FlagType<Byte>(ShulkerWatcher.class, 2, (byte) 0);
|
||||
public static FlagType<Byte> SHULKER_PEEKING = new FlagType<Byte>(ShulkerWatcher.class, 2, (byte) 0).setUnsupported(_v1_8,
|
||||
_v1_7);
|
||||
|
||||
public static FlagType<Boolean> SKELETON_SWING_ARMS = new FlagType<Boolean>(SkeletonWatcher.class, 1, false);
|
||||
public static FlagType<Boolean> SKELETON_SWING_ARMS = new FlagType<Boolean>(SkeletonWatcher.class, 1, false)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> SKELETON_TYPE = new FlagType<Integer>(SkeletonWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> SKELETON_TYPE = new FlagType<Integer>(SkeletonWatcher.class, 0, 0)
|
||||
.set1_8(Converter.INT_TO_BYTE).set1_7(Converter.INT_TO_BYTE).set1_8(13).set1_7(13);
|
||||
|
||||
public static FlagType<Integer> SLIME_SIZE = new FlagType<Integer>(SlimeWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> SLIME_SIZE = new FlagType<Integer>(SlimeWatcher.class, 0, 0).set1_8(Converter.INT_TO_BYTE)
|
||||
.set1_7(Converter.INT_TO_BYTE).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Byte> SNOWMAN_HAT = new FlagType<Byte>(SnowmanWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> SNOWMAN_HAT = new FlagType<Byte>(SnowmanWatcher.class, 0, (byte) 0).setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Byte> SPIDER_CLIMB = new FlagType<Byte>(SpiderWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> SPIDER_CLIMB = new FlagType<Byte>(SpiderWatcher.class, 0, (byte) 0).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Optional<ItemStack>> SPLASH_POTION_ITEM = new FlagType<Optional<ItemStack>>(SplashPotionWatcher.class,
|
||||
1, Optional.of(new ItemStack(Material.SPLASH_POTION))); // Yeah, the '1' isn't a bug. No idea why but MC thinks
|
||||
// there's a '0' already.
|
||||
1, Optional.fromNullable(ReflectionManager.getItemWithMaterial("SPLASH_POTION"))).setUnsupported(_v1_8, _v1_7);
|
||||
// Yeah, the '1' isn't a bug. No idea why but MC thinks there's a '0' already.
|
||||
|
||||
public static FlagType<Optional<ItemStack>> SPLASH_POTION_ITEM_BAD = new FlagType<Optional<ItemStack>>(
|
||||
SplashPotionWatcher.class, 0, Optional.of(new ItemStack(Material.SPLASH_POTION))); // Yeah, the '1' isn't a bug. No
|
||||
// idea why but MC thinks there's a
|
||||
// '0' already.
|
||||
SplashPotionWatcher.class, 0, Optional.fromNullable(ReflectionManager.getItemWithMaterial("SPLASH_POTION")))
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
// Yeah, the '1' isn't a bug. No idea why but MC thinks there's a '0' already.
|
||||
|
||||
public static FlagType<Byte> TAMEABLE_META = new FlagType<Byte>(TameableWatcher.class, 0, (byte) 0);
|
||||
public static FlagType<Byte> TAMEABLE_META = new FlagType<Byte>(TameableWatcher.class, 0, (byte) 0).set1_8(16).set1_7(16);
|
||||
|
||||
public static FlagType<Optional<UUID>> TAMEABLE_OWNER = new FlagType<Optional<UUID>>(TameableWatcher.class, 1,
|
||||
Optional.<UUID> absent());
|
||||
Optional.<UUID> absent()).set1_8(Converter.OPT_UUID_TO_STRING).set1_7(Converter.OPT_UUID_TO_STRING).set1_8(17)
|
||||
.set1_7(17);
|
||||
|
||||
public static FlagType<Integer> TIPPED_ARROW_COLOR = new FlagType<Integer>(ArrowWatcher.class, 1, Color.WHITE.asRGB());
|
||||
public static FlagType<Integer> TIPPED_ARROW_COLOR = new FlagType<Integer>(ArrowWatcher.class, 1, Color.WHITE.asRGB())
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> TNT_FUSE_TICKS = new FlagType<Integer>(TNTWatcher.class, 0, Integer.MAX_VALUE);
|
||||
public static FlagType<Integer> TNT_FUSE_TICKS = new FlagType<Integer>(TNTWatcher.class, 0, Integer.MAX_VALUE)
|
||||
.setUnsupported(_v1_8, _v1_7);
|
||||
|
||||
public static FlagType<Integer> VILLAGER_PROFESSION = new FlagType<Integer>(VillagerWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> VILLAGER_PROFESSION = new FlagType<Integer>(VillagerWatcher.class, 0, 0).set1_8(16)
|
||||
.set1_7(16);
|
||||
|
||||
public static FlagType<Boolean> WITCH_AGGRESSIVE = new FlagType<Boolean>(WitchWatcher.class, 0, false);
|
||||
public static FlagType<Boolean> WITCH_AGGRESSIVE = new FlagType<Boolean>(WitchWatcher.class, 0, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(21).set1_7(21);
|
||||
|
||||
public static FlagType<Integer> WITHER_INVUL = new FlagType<Integer>(WitherWatcher.class, 3, 0);
|
||||
public static FlagType<Integer> WITHER_INVUL = new FlagType<Integer>(WitherWatcher.class, 3, 0).set1_8(20).set1_7(20);
|
||||
|
||||
public static FlagType<Integer> WITHER_TARGET_1 = new FlagType<Integer>(WitherWatcher.class, 0, 0);
|
||||
public static FlagType<Integer> WITHER_TARGET_1 = new FlagType<Integer>(WitherWatcher.class, 0, 0).set1_8(17).set1_7(17);
|
||||
|
||||
public static FlagType<Integer> WITHER_TARGET_2 = new FlagType<Integer>(WitherWatcher.class, 1, 0);
|
||||
public static FlagType<Integer> WITHER_TARGET_2 = new FlagType<Integer>(WitherWatcher.class, 1, 0).set1_8(18).set1_7(18);
|
||||
|
||||
public static FlagType<Integer> WITHER_TARGET_3 = new FlagType<Integer>(WitherWatcher.class, 2, 0);
|
||||
public static FlagType<Integer> WITHER_TARGET_3 = new FlagType<Integer>(WitherWatcher.class, 2, 0).set1_8(19).set1_7(19);
|
||||
|
||||
public static FlagType<Boolean> WITHERSKULL_BLUE = new FlagType<Boolean>(WitherSkullWatcher.class, 0, false);
|
||||
public static FlagType<Boolean> WITHERSKULL_BLUE = new FlagType<Boolean>(WitherSkullWatcher.class, 0, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(10).set1_7(10);
|
||||
|
||||
public static FlagType<Boolean> WOLF_BEGGING = new FlagType<Boolean>(WolfWatcher.class, 1, false);
|
||||
public static FlagType<Boolean> WOLF_BEGGING = new FlagType<Boolean>(WolfWatcher.class, 1, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(19).set1_7(19);
|
||||
|
||||
public static FlagType<Integer> WOLF_COLLAR = new FlagType<Integer>(WolfWatcher.class, 2, 14);
|
||||
public static FlagType<Integer> WOLF_COLLAR = new FlagType<Integer>(WolfWatcher.class, 2, 14).set1_8(Converter.INT_TO_BYTE)
|
||||
.set1_7(Converter.INT_TO_BYTE).set1_8(20).set1_7(20);
|
||||
|
||||
public static FlagType<Float> WOLF_DAMAGE = new FlagType<Float>(WolfWatcher.class, 0, 0F);
|
||||
public static FlagType<Float> WOLF_DAMAGE = new FlagType<Float>(WolfWatcher.class, 0, 0F).set1_8(18).set1_7(18);
|
||||
|
||||
public static FlagType<Boolean> ZOMBIE_AGGRESSIVE = new FlagType<Boolean>(ZombieWatcher.class, 3, false);
|
||||
public static FlagType<Boolean> ZOMBIE_AGGRESSIVE = new FlagType<Boolean>(ZombieWatcher.class, 3, false).setUnsupported(_v1_8,
|
||||
_v1_7);
|
||||
|
||||
public static FlagType<Boolean> ZOMBIE_BABY = new FlagType<Boolean>(ZombieWatcher.class, 0, false);
|
||||
public static FlagType<Boolean> ZOMBIE_BABY = new FlagType<Boolean>(ZombieWatcher.class, 0, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(12).set1_7(12);
|
||||
|
||||
public static FlagType<Integer> ZOMBIE_PROFESSION = new FlagType<Integer>(ZombieWatcher.class, 1, 0);
|
||||
public static FlagType<Integer> ZOMBIE_PROFESSION = new FlagType<Integer>(ZombieWatcher.class, 1, 0)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(13).set1_7(13);
|
||||
|
||||
public static FlagType<Boolean> ZOMBIE_SHAKING = new FlagType<Boolean>(ZombieWatcher.class, 2, false);
|
||||
public static FlagType<Boolean> ZOMBIE_SHAKING = new FlagType<Boolean>(ZombieWatcher.class, 2, false)
|
||||
.set1_8(Converter.BOOLEAN_TO_BYTE).set1_7(Converter.BOOLEAN_TO_BYTE).set1_8(14).set1_7(14);
|
||||
|
||||
static
|
||||
{
|
||||
for (FlagType flagType : values())
|
||||
try
|
||||
{
|
||||
if (flagType.getFlagWatcher() == FlagWatcher.class)
|
||||
continue;
|
||||
for (Field field : FlagType.class.getFields())
|
||||
{
|
||||
if (field.getDeclaringClass() != FlagType.class)
|
||||
continue;
|
||||
|
||||
flagType._index += getNoIndexes(flagType.getFlagWatcher().getSuperclass());
|
||||
FlagType flagType = (FlagType) field.get(null);
|
||||
|
||||
if (flagType.isUnsupported())
|
||||
continue;
|
||||
|
||||
_values = Arrays.copyOf(_values, _values.length + 1);
|
||||
_values[_values.length - 1] = flagType;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
ArrayList<FlagType> flags = new ArrayList<FlagType>(Arrays.asList(values()));
|
||||
final HashMap<FlagType, Integer> map = new HashMap<FlagType, Integer>();
|
||||
|
||||
for (FlagType flag : flags)
|
||||
{
|
||||
Class c1 = flag.getFlagWatcher();
|
||||
|
||||
int score = 0;
|
||||
|
||||
while (FlagWatcher.class.isAssignableFrom(c1))
|
||||
{
|
||||
c1 = c1.getSuperclass();
|
||||
score++;
|
||||
}
|
||||
|
||||
map.put(flag, score);
|
||||
}
|
||||
|
||||
Collections.sort(flags, new Comparator<FlagType>()
|
||||
{
|
||||
@Override
|
||||
public int compare(FlagType o1, FlagType o2)
|
||||
{
|
||||
Class c1 = o1.getFlagWatcher();
|
||||
Class c2 = o2.getFlagWatcher();
|
||||
|
||||
boolean a1 = c1.isAssignableFrom(c2);
|
||||
boolean a2 = c2.isAssignableFrom(c1);
|
||||
|
||||
if (a1 && a2)
|
||||
{
|
||||
return Integer.compare(o1.getIndex(), o2.getIndex());
|
||||
}
|
||||
|
||||
return Integer.compare(map.get(o1), map.get(o2));
|
||||
}
|
||||
});
|
||||
|
||||
if (!ReflectionManager.is1_7() && !ReflectionManager.is1_8())
|
||||
{
|
||||
for (FlagType flagType : flags)
|
||||
{
|
||||
if (flagType.getFlagWatcher() == FlagWatcher.class)
|
||||
continue;
|
||||
|
||||
flagType._index += getNoIndexes(flagType.getFlagWatcher().getSuperclass());
|
||||
}
|
||||
}
|
||||
|
||||
// Simple verification for the dev that he's setting up the FlagType's properly.
|
||||
|
@ -336,7 +480,7 @@ public class FlagType<Y>
|
|||
found = type;
|
||||
}
|
||||
|
||||
if (found != null)
|
||||
if (found != null || ReflectionManager.is1_7() || ReflectionManager.is1_8())
|
||||
continue;
|
||||
|
||||
System.err.println(entry.getKey().getSimpleName() + " has no FlagType registered for the index " + i);
|
||||
|
@ -402,6 +546,8 @@ public class FlagType<Y>
|
|||
|
||||
private Y _defaultValue;
|
||||
private int _index;
|
||||
private boolean[] _unsupported = new boolean[4];
|
||||
private Converter _converter;
|
||||
private Class<? extends FlagWatcher> _watcher;
|
||||
|
||||
private FlagType(Class<? extends FlagWatcher> watcher, int index, Y defaultValue)
|
||||
|
@ -409,9 +555,6 @@ public class FlagType<Y>
|
|||
_index = index;
|
||||
_watcher = watcher;
|
||||
_defaultValue = defaultValue;
|
||||
|
||||
_values = Arrays.copyOf(_values, _values.length + 1);
|
||||
_values[_values.length - 1] = this;
|
||||
}
|
||||
|
||||
public Y getDefault()
|
||||
|
@ -419,6 +562,32 @@ public class FlagType<Y>
|
|||
return _defaultValue;
|
||||
}
|
||||
|
||||
public Object convertToSend(Y value)
|
||||
{
|
||||
int version = getVersion();
|
||||
|
||||
if (version == -1)
|
||||
return value;
|
||||
|
||||
if (_converter == null)
|
||||
return value;
|
||||
|
||||
return _converter.convertSend(value);
|
||||
}
|
||||
|
||||
public Y convertToReceive(Object value)
|
||||
{
|
||||
int version = getVersion();
|
||||
|
||||
if (version == -1)
|
||||
return (Y) value;
|
||||
|
||||
if (_converter == null)
|
||||
return (Y) value;
|
||||
|
||||
return (Y) _converter.convertReceive(value);
|
||||
}
|
||||
|
||||
public Class<? extends FlagWatcher> getFlagWatcher()
|
||||
{
|
||||
return _watcher;
|
||||
|
@ -428,4 +597,89 @@ public class FlagType<Y>
|
|||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
private int getVersion()
|
||||
{
|
||||
if (ReflectionManager.is1_10())
|
||||
return _v1_10;
|
||||
else if (ReflectionManager.is1_9())
|
||||
return _v1_9;
|
||||
else if (ReflectionManager.is1_8())
|
||||
return _v1_8;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isUnsupported()
|
||||
{
|
||||
int version = getVersion();
|
||||
|
||||
if (version == -1)
|
||||
throw new IllegalArgumentException("This version of Minecraft is not supported!");
|
||||
|
||||
return _unsupported[version];
|
||||
}
|
||||
|
||||
private FlagType<Y> set1_7(int index)
|
||||
{
|
||||
if (!ReflectionManager.is1_7())
|
||||
return this;
|
||||
|
||||
_index = index;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private FlagType<Y> set1_7(Converter converter)
|
||||
{
|
||||
if (!ReflectionManager.is1_7())
|
||||
return this;
|
||||
|
||||
_converter = converter;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private FlagType<Y> set1_8(Converter converter)
|
||||
{
|
||||
if (!ReflectionManager.is1_8())
|
||||
return this;
|
||||
|
||||
_converter = converter;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private FlagType<Y> set1_8(int index)
|
||||
{
|
||||
if (!ReflectionManager.is1_8())
|
||||
return this;
|
||||
|
||||
_index = index;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private FlagType<Y> setUnsupported(int... versions)
|
||||
{
|
||||
for (int version : versions)
|
||||
{
|
||||
_unsupported[version] = true;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private FlagType<Y> setSupported(int... versions)
|
||||
{
|
||||
for (int i = 0; i < _unsupported.length; i++)
|
||||
_unsupported[i] = true;
|
||||
|
||||
for (int version : versions)
|
||||
{
|
||||
_unsupported[version] = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,10 +305,10 @@ public class FlagWatcher
|
|||
{
|
||||
if (_entityValues.containsKey(flagType.getIndex()))
|
||||
{
|
||||
return (Y) _entityValues.get(flagType.getIndex());
|
||||
return (Y) flagType.convertToReceive(_entityValues.get(flagType.getIndex()));
|
||||
}
|
||||
|
||||
return flagType.getDefault();
|
||||
return flagType.convertToReceive(flagType.getDefault());
|
||||
}
|
||||
|
||||
public List<WrappedWatchableObject> getWatchableObjects()
|
||||
|
@ -420,6 +420,9 @@ public class FlagWatcher
|
|||
|
||||
for (FlagType data : dataValues)
|
||||
{
|
||||
if (data.isUnsupported())
|
||||
continue;
|
||||
|
||||
if (!_entityValues.containsKey(data.getIndex()) || _entityValues.get(data.getIndex()) == null)
|
||||
{
|
||||
continue;
|
||||
|
@ -677,7 +680,10 @@ public class FlagWatcher
|
|||
|
||||
protected <Y> void setValue(FlagType<Y> id, Y value)
|
||||
{
|
||||
_entityValues.put(id.getIndex(), value);
|
||||
if (id.isUnsupported())
|
||||
return;
|
||||
|
||||
_entityValues.put(id.getIndex(), id.convertToSend(value));
|
||||
|
||||
if (!DisguiseConfig.isMetadataPacketsEnabled())
|
||||
{
|
||||
|
|
|
@ -63,6 +63,8 @@ public class EndermanWatcher extends InsentientWatcher
|
|||
optional = Optional.<WrappedBlockData> of(WrappedBlockData.createData(type, data));
|
||||
|
||||
setValue(FlagType.ENDERMAN_ITEM, optional);
|
||||
setValue(FlagType.ENDERMAN_OLD_ITEM_TYPE, (short) (type.getId() & 255));
|
||||
setValue(FlagType.ENDERMAN_OLD_ITEM_DATA, (byte) (data & 255));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import org.bukkit.inventory.MainHand;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagType;
|
||||
|
||||
|
@ -12,15 +10,15 @@ public class InsentientWatcher extends LivingWatcher
|
|||
super(disguise);
|
||||
}
|
||||
|
||||
public void setMainHand(MainHand mainHand)
|
||||
public void setMainHand(boolean mainHand)
|
||||
{
|
||||
setInsentientFlag(2, mainHand == MainHand.RIGHT);
|
||||
setInsentientFlag(2, mainHand);
|
||||
sendData(FlagType.INSENTIENT_META);
|
||||
}
|
||||
|
||||
public MainHand getMainHand()
|
||||
public boolean isMainHand()
|
||||
{
|
||||
return getInsentientFlag(2) ? MainHand.RIGHT : MainHand.LEFT;
|
||||
return getInsentientFlag(2);
|
||||
}
|
||||
|
||||
public boolean isAI()
|
||||
|
|
|
@ -34,16 +34,52 @@ public class LivingWatcher extends FlagWatcher
|
|||
{
|
||||
try
|
||||
{
|
||||
getId = ReflectionManager.getNmsMethod("MobEffectList", "getId", ReflectionManager.getNmsClass("MobEffectList"));
|
||||
Object REGISTRY = ReflectionManager.getNmsField("MobEffectList", "REGISTRY").get(null);
|
||||
|
||||
for (Object next : ((Iterable) REGISTRY))
|
||||
if (ReflectionManager.is1_10() || ReflectionManager.is1_9())
|
||||
{
|
||||
int id = (int) getId.invoke(null, next);
|
||||
list.put(id, next);
|
||||
getId = ReflectionManager.getNmsMethod("MobEffectList", "getId", ReflectionManager.getNmsClass("MobEffectList"));
|
||||
|
||||
Object REGISTRY = ReflectionManager.getNmsField("MobEffectList", "REGISTRY").get(null);
|
||||
|
||||
for (Object next : ((Iterable) REGISTRY))
|
||||
{
|
||||
int id = (int) getId.invoke(null, next);
|
||||
list.put(id, next);
|
||||
}
|
||||
}
|
||||
else if (ReflectionManager.is1_8())
|
||||
{
|
||||
Object[] potions = (Object[]) ReflectionManager.getNmsField("MobEffectList", "byId").get(null);
|
||||
|
||||
for (Object obj : potions)
|
||||
{
|
||||
if (obj == null)
|
||||
continue;
|
||||
|
||||
for (Method field : obj.getClass().getMethods())
|
||||
{
|
||||
if (field.getReturnType() != int.class)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((Integer) field.invoke(obj) <= 10000)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (field.getParameterTypes().length > 0)
|
||||
continue;
|
||||
|
||||
list.put((int) field.invoke(obj), obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (
|
||||
|
||||
Exception ex)
|
||||
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
|
|||
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.MainHand;
|
||||
|
||||
import com.comphenix.protocol.PacketType.Play.Server;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
|
@ -37,15 +36,15 @@ public class PlayerWatcher extends LivingWatcher
|
|||
return watcher;
|
||||
}
|
||||
|
||||
public void setMainHand(MainHand mainHand)
|
||||
public void setMainHand(boolean mainHand)
|
||||
{
|
||||
setValue(FlagType.PLAYER_HAND, (byte) mainHand.ordinal());
|
||||
setValue(FlagType.PLAYER_HAND, (byte) (mainHand ? 1 : 0));
|
||||
sendData(FlagType.PLAYER_HAND);
|
||||
}
|
||||
|
||||
public MainHand getMainHand()
|
||||
public boolean isMainHand()
|
||||
{
|
||||
return MainHand.values()[getValue(FlagType.PLAYER_HAND)];
|
||||
return getValue(FlagType.PLAYER_HAND) == 1;
|
||||
}
|
||||
|
||||
public BlockFace getSleepingDirection()
|
||||
|
|
|
@ -1,307 +1,291 @@
|
|||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
/**
|
||||
* Only living disguises go in here!
|
||||
*/
|
||||
public enum DisguiseSound
|
||||
{
|
||||
|
||||
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),
|
||||
|
||||
BLAZE(Sound.ENTITY_BLAZE_HURT, null, Sound.ENTITY_BLAZE_DEATH, Sound.ENTITY_BLAZE_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL,
|
||||
Sound.ENTITY_PLAYER_BIG_FALL),
|
||||
|
||||
CAVE_SPIDER(Sound.ENTITY_SPIDER_AMBIENT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH, Sound.ENTITY_SPIDER_AMBIENT),
|
||||
|
||||
CHICKEN(Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_STEP, Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_CHICKEN_EGG, Sound.ENTITY_PLAYER_BIG_FALL),
|
||||
|
||||
COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_DEATH, Sound.ENTITY_COW_AMBIENT),
|
||||
|
||||
CREEPER(Sound.ENTITY_CREEPER_HURT, "step.grass", Sound.ENTITY_CREEPER_DEATH, null),
|
||||
|
||||
DONKEY(Sound.ENTITY_DONKEY_HURT, "step.grass", Sound.ENTITY_DONKEY_DEATH, Sound.ENTITY_DONKEY_AMBIENT,
|
||||
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD,
|
||||
Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY),
|
||||
|
||||
ELDER_GUARDIAN(Sound.ENTITY_ELDER_GUARDIAN_HURT, null, Sound.ENTITY_ELDER_GUARDIAN_DEATH,
|
||||
Sound.ENTITY_ELDER_GUARDIAN_AMBIENT),
|
||||
|
||||
ENDER_DRAGON(Sound.ENTITY_ENDERDRAGON_HURT, null, Sound.ENTITY_ENDERDRAGON_DEATH, Sound.ENTITY_ENDERDRAGON_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_ENDERDRAGON_FLAP, Sound.ENTITY_PLAYER_BIG_FALL),
|
||||
|
||||
ENDERMAN(Sound.ENTITY_ENDERMEN_HURT, "step.grass", Sound.ENTITY_ENDERMEN_DEATH, Sound.ENTITY_ENDERMEN_AMBIENT,
|
||||
Sound.ENTITY_ENDERMEN_SCREAM, Sound.ENTITY_ENDERMEN_TELEPORT, Sound.ENTITY_ENDERMEN_STARE),
|
||||
|
||||
ENDERMITE(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_ENDERMITE_STEP, Sound.ENTITY_ENDERMITE_DEATH,
|
||||
Sound.ENTITY_ENDERMITE_AMBIENT),
|
||||
|
||||
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, "step.grass", null, null),
|
||||
|
||||
GUARDIAN(Sound.ENTITY_GUARDIAN_HURT, null, Sound.ENTITY_GUARDIAN_DEATH, Sound.ENTITY_ELDER_GUARDIAN_AMBIENT),
|
||||
|
||||
HORSE(Sound.ENTITY_HORSE_HURT, "step.grass", Sound.ENTITY_HORSE_DEATH, Sound.ENTITY_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP,
|
||||
Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR,
|
||||
Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY),
|
||||
|
||||
IRON_GOLEM(Sound.ENTITY_IRONGOLEM_HURT, Sound.ENTITY_IRONGOLEM_STEP, Sound.ENTITY_IRONGOLEM_DEATH,
|
||||
Sound.ENTITY_IRONGOLEM_ATTACK),
|
||||
|
||||
MAGMA_CUBE(Sound.ENTITY_MAGMACUBE_HURT, Sound.ENTITY_MAGMACUBE_JUMP, null, null),
|
||||
|
||||
MULE(Sound.ENTITY_MULE_HURT, "step.grass", Sound.ENTITY_MULE_DEATH, Sound.ENTITY_MULE_AMBIENT),
|
||||
|
||||
MUSHROOM_COW(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_AMBIENT),
|
||||
|
||||
OCELOT(Sound.ENTITY_CAT_HURT, "step.grass", Sound.ENTITY_CAT_HURT, Sound.ENTITY_CAT_AMBIENT, Sound.ENTITY_CAT_PURR,
|
||||
Sound.ENTITY_CAT_PURREOW),
|
||||
|
||||
PIG(Sound.ENTITY_PIG_HURT, Sound.ENTITY_PIG_STEP, Sound.ENTITY_PIG_DEATH, Sound.ENTITY_PIG_AMBIENT),
|
||||
|
||||
PIG_ZOMBIE(Sound.ENTITY_ZOMBIE_PIG_HURT, null, Sound.ENTITY_ZOMBIE_PIG_DEATH, Sound.ENTITY_ZOMBIE_PIG_AMBIENT,
|
||||
Sound.ENTITY_ZOMBIE_PIG_ANGRY),
|
||||
|
||||
PLAYER(Sound.ENTITY_PLAYER_HURT, "step.grass", Sound.ENTITY_PLAYER_DEATH, null),
|
||||
|
||||
RABBIT(Sound.ENTITY_RABBIT_HURT, Sound.ENTITY_RABBIT_JUMP, Sound.ENTITY_RABBIT_DEATH, Sound.ENTITY_RABBIT_AMBIENT),
|
||||
|
||||
SHEEP(Sound.ENTITY_SHEEP_HURT, Sound.ENTITY_SHEEP_STEP, null, Sound.ENTITY_SHEEP_AMBIENT, Sound.ENTITY_SHEEP_SHEAR),
|
||||
|
||||
SHULKER(Sound.ENTITY_SHULKER_HURT, null, Sound.ENTITY_SHULKER_DEATH, Sound.ENTITY_SHULKER_AMBIENT, Sound.ENTITY_SHULKER_OPEN,
|
||||
Sound.ENTITY_SHULKER_CLOSE, Sound.ENTITY_SHULKER_HURT_CLOSED, 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, "step.grass", Sound.ENTITY_SKELETON_HORSE_DEATH,
|
||||
Sound.ENTITY_SKELETON_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY,
|
||||
Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
||||
Sound.ENTITY_HORSE_ANGRY),
|
||||
|
||||
SLIME(Sound.ENTITY_SLIME_HURT, Sound.ENTITY_SLIME_JUMP, Sound.ENTITY_SLIME_DEATH, null),
|
||||
|
||||
SNOWMAN(Sound.ENTITY_SNOWMAN_HURT, null, Sound.ENTITY_SNOWMAN_DEATH, Sound.ENTITY_SNOWMAN_AMBIENT,
|
||||
Sound.ENTITY_SNOWMAN_SHOOT),
|
||||
|
||||
SPIDER(Sound.ENTITY_SPIDER_AMBIENT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH, Sound.ENTITY_SPIDER_AMBIENT),
|
||||
|
||||
SQUID(Sound.ENTITY_SQUID_HURT, null, Sound.ENTITY_SQUID_DEATH, Sound.ENTITY_SQUID_AMBIENT),
|
||||
|
||||
UNDEAD_HORSE(Sound.ENTITY_ZOMBIE_HORSE_HURT, "step.grass", Sound.ENTITY_ZOMBIE_HORSE_DEATH, Sound.ENTITY_ZOMBIE_HORSE_AMBIENT,
|
||||
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD,
|
||||
Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY),
|
||||
|
||||
VILLAGER(Sound.ENTITY_VILLAGER_HURT, null, Sound.ENTITY_VILLAGER_DEATH, Sound.ENTITY_VILLAGER_AMBIENT,
|
||||
Sound.ENTITY_VILLAGER_TRADING, Sound.ENTITY_VILLAGER_NO, Sound.ENTITY_VILLAGER_YES),
|
||||
|
||||
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_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP, Sound.ENTITY_SKELETON_DEATH,
|
||||
Sound.ENTITY_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_BREAK_DOOR_WOOD, Sound.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR), 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_BREAK_DOOR_WOOD, Sound.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR);
|
||||
|
||||
public enum SoundType
|
||||
{
|
||||
CANCEL, DEATH, HURT, IDLE, STEP
|
||||
}
|
||||
|
||||
public static DisguiseSound getType(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return valueOf(name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<String> cancelSounds = new HashSet<>();
|
||||
private float damageSoundVolume = 1F;
|
||||
private HashMap<SoundType, String> disguiseSounds = new HashMap<>();
|
||||
|
||||
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 void addSound(Object sound, SoundType type)
|
||||
{
|
||||
String s;
|
||||
|
||||
if (sound == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (sound instanceof String)
|
||||
{
|
||||
s = (String) sound;
|
||||
}
|
||||
else if (sound instanceof Sound)
|
||||
{
|
||||
s = ReflectionManager.getCraftSound((Sound) sound);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException("Was given a unknown object " + sound);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case HURT:
|
||||
disguiseSounds.put(SoundType.HURT, s);
|
||||
break;
|
||||
case STEP:
|
||||
disguiseSounds.put(SoundType.STEP, s);
|
||||
break;
|
||||
case DEATH:
|
||||
disguiseSounds.put(SoundType.DEATH, s);
|
||||
break;
|
||||
case IDLE:
|
||||
disguiseSounds.put(SoundType.IDLE, s);
|
||||
break;
|
||||
case CANCEL:
|
||||
cancelSounds.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
public float getDamageAndIdleSoundVolume()
|
||||
{
|
||||
return damageSoundVolume;
|
||||
}
|
||||
|
||||
public String getSound(SoundType type)
|
||||
{
|
||||
if (type == null || !disguiseSounds.containsKey(type))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return disguiseSounds.get(type);
|
||||
}
|
||||
|
||||
public HashSet<String> getSoundsToCancel()
|
||||
{
|
||||
return cancelSounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if this sound name is owned by this disguise sound.
|
||||
*/
|
||||
public SoundType getType(String sound, boolean ignoreDamage)
|
||||
{
|
||||
if (sound == null)
|
||||
return SoundType.CANCEL;
|
||||
|
||||
if (isCancelSound(sound))
|
||||
{
|
||||
return SoundType.CANCEL;
|
||||
}
|
||||
|
||||
if (disguiseSounds.containsKey(SoundType.STEP) && disguiseSounds.get(SoundType.STEP).startsWith("step.")
|
||||
&& sound.startsWith("step."))
|
||||
{
|
||||
return SoundType.STEP;
|
||||
}
|
||||
|
||||
for (SoundType type : SoundType.values())
|
||||
{
|
||||
if (!disguiseSounds.containsKey(type) || type == SoundType.DEATH || (ignoreDamage && type == SoundType.HURT))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String s = disguiseSounds.get(type);
|
||||
|
||||
if (s != null)
|
||||
{
|
||||
if (s.equals(sound))
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCancelSound(String sound)
|
||||
{
|
||||
return getSoundsToCancel().contains(sound);
|
||||
}
|
||||
|
||||
public void removeSound(SoundType type, Sound sound)
|
||||
{
|
||||
removeSound(type, ReflectionManager.getCraftSound(sound));
|
||||
}
|
||||
|
||||
public void removeSound(SoundType type, String sound)
|
||||
{
|
||||
if (type == SoundType.CANCEL)
|
||||
{
|
||||
cancelSounds.remove(sound);
|
||||
}
|
||||
else
|
||||
{
|
||||
disguiseSounds.remove(type);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDamageAndIdleSoundVolume(float strength)
|
||||
{
|
||||
this.damageSoundVolume = strength;
|
||||
}
|
||||
|
||||
public void setSound(SoundType type, Sound sound)
|
||||
{
|
||||
setSound(type, ReflectionManager.getCraftSound(sound));
|
||||
}
|
||||
|
||||
public void setSound(SoundType type, String sound)
|
||||
{
|
||||
if (type == SoundType.CANCEL)
|
||||
{
|
||||
cancelSounds.add(sound);
|
||||
}
|
||||
else
|
||||
{
|
||||
disguiseSounds.put(type, sound);
|
||||
}
|
||||
}
|
||||
}
|
||||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
/**
|
||||
* Only living disguises go in here!
|
||||
*/
|
||||
public enum DisguiseSound
|
||||
{
|
||||
|
||||
ARROW,
|
||||
|
||||
BAT,
|
||||
|
||||
BLAZE,
|
||||
|
||||
CAVE_SPIDER,
|
||||
|
||||
CHICKEN,
|
||||
|
||||
COW,
|
||||
|
||||
CREEPER,
|
||||
|
||||
DONKEY,
|
||||
|
||||
ELDER_GUARDIAN,
|
||||
|
||||
ENDER_DRAGON,
|
||||
|
||||
ENDERMAN,
|
||||
|
||||
ENDERMITE,
|
||||
|
||||
GHAST,
|
||||
|
||||
GIANT,
|
||||
|
||||
GUARDIAN,
|
||||
|
||||
HORSE,
|
||||
|
||||
IRON_GOLEM,
|
||||
|
||||
MAGMA_CUBE,
|
||||
|
||||
MULE,
|
||||
|
||||
MUSHROOM_COW,
|
||||
|
||||
OCELOT,
|
||||
|
||||
PIG,
|
||||
|
||||
PIG_ZOMBIE,
|
||||
|
||||
PLAYER,
|
||||
|
||||
RABBIT,
|
||||
|
||||
SHEEP,
|
||||
|
||||
SHULKER,
|
||||
|
||||
SILVERFISH,
|
||||
|
||||
SKELETON,
|
||||
|
||||
SKELETON_HORSE,
|
||||
|
||||
SLIME,
|
||||
|
||||
SNOWMAN,
|
||||
|
||||
SPIDER,
|
||||
|
||||
SQUID,
|
||||
|
||||
UNDEAD_HORSE,
|
||||
|
||||
VILLAGER,
|
||||
|
||||
WITCH,
|
||||
|
||||
WITHER,
|
||||
|
||||
WITHER_SKELETON,
|
||||
|
||||
WOLF,
|
||||
|
||||
ZOMBIE,
|
||||
|
||||
ZOMBIE_VILLAGER;
|
||||
|
||||
static
|
||||
{
|
||||
if (ReflectionManager.is1_7() || ReflectionManager.is1_8())
|
||||
{
|
||||
OldDisguiseSounds.setSounds();
|
||||
}
|
||||
else
|
||||
{
|
||||
NewDisguiseSounds.setSounds();
|
||||
}
|
||||
}
|
||||
|
||||
public enum SoundType
|
||||
{
|
||||
CANCEL, DEATH, HURT, IDLE, STEP
|
||||
}
|
||||
|
||||
public static DisguiseSound getType(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return valueOf(name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<String> cancelSounds = new HashSet<>();
|
||||
private float damageSoundVolume = 1F;
|
||||
private HashMap<SoundType, String> disguiseSounds = new HashMap<>();
|
||||
|
||||
private DisguiseSound()
|
||||
{
|
||||
}
|
||||
|
||||
public void setSounds(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)
|
||||
{
|
||||
String s;
|
||||
|
||||
if (sound == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (sound instanceof String)
|
||||
{
|
||||
s = (String) sound;
|
||||
}
|
||||
else if (sound instanceof Sound)
|
||||
{
|
||||
s = ReflectionManager.getCraftSound((Sound) sound);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException("Was given a unknown object " + sound);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case HURT:
|
||||
disguiseSounds.put(SoundType.HURT, s);
|
||||
break;
|
||||
case STEP:
|
||||
disguiseSounds.put(SoundType.STEP, s);
|
||||
break;
|
||||
case DEATH:
|
||||
disguiseSounds.put(SoundType.DEATH, s);
|
||||
break;
|
||||
case IDLE:
|
||||
disguiseSounds.put(SoundType.IDLE, s);
|
||||
break;
|
||||
case CANCEL:
|
||||
cancelSounds.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
public float getDamageAndIdleSoundVolume()
|
||||
{
|
||||
return damageSoundVolume;
|
||||
}
|
||||
|
||||
public String getSound(SoundType type)
|
||||
{
|
||||
if (type == null || !disguiseSounds.containsKey(type))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return disguiseSounds.get(type);
|
||||
}
|
||||
|
||||
public HashSet<String> getSoundsToCancel()
|
||||
{
|
||||
return cancelSounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if this sound name is owned by this disguise sound.
|
||||
*/
|
||||
public SoundType getType(String sound, boolean ignoreDamage)
|
||||
{
|
||||
if (sound == null)
|
||||
return SoundType.CANCEL;
|
||||
|
||||
if (isCancelSound(sound))
|
||||
{
|
||||
return SoundType.CANCEL;
|
||||
}
|
||||
|
||||
if (disguiseSounds.containsKey(SoundType.STEP) && disguiseSounds.get(SoundType.STEP).startsWith("step.")
|
||||
&& sound.startsWith("step."))
|
||||
{
|
||||
return SoundType.STEP;
|
||||
}
|
||||
|
||||
for (SoundType type : SoundType.values())
|
||||
{
|
||||
if (!disguiseSounds.containsKey(type) || type == SoundType.DEATH || (ignoreDamage && type == SoundType.HURT))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String s = disguiseSounds.get(type);
|
||||
|
||||
if (s != null)
|
||||
{
|
||||
if (s.equals(sound))
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCancelSound(String sound)
|
||||
{
|
||||
return getSoundsToCancel().contains(sound);
|
||||
}
|
||||
|
||||
public void removeSound(SoundType type, Sound sound)
|
||||
{
|
||||
removeSound(type, ReflectionManager.getCraftSound(sound));
|
||||
}
|
||||
|
||||
public void removeSound(SoundType type, String sound)
|
||||
{
|
||||
if (type == SoundType.CANCEL)
|
||||
{
|
||||
cancelSounds.remove(sound);
|
||||
}
|
||||
else
|
||||
{
|
||||
disguiseSounds.remove(type);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDamageAndIdleSoundVolume(float strength)
|
||||
{
|
||||
this.damageSoundVolume = strength;
|
||||
}
|
||||
|
||||
public void setSound(SoundType type, Sound sound)
|
||||
{
|
||||
setSound(type, ReflectionManager.getCraftSound(sound));
|
||||
}
|
||||
|
||||
public void setSound(SoundType type, String sound)
|
||||
{
|
||||
if (type == SoundType.CANCEL)
|
||||
{
|
||||
cancelSounds.add(sound);
|
||||
}
|
||||
else
|
||||
{
|
||||
disguiseSounds.put(type, sound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public class DisguiseUtilities
|
|||
private static HashSet<UUID> selfDisguised = new HashSet<>();
|
||||
private static Thread mainThread;
|
||||
private static PacketContainer spawnChunk;
|
||||
private static Object mapChunk;
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -92,10 +93,10 @@ public class DisguiseUtilities
|
|||
Object server = ReflectionManager.getNmsMethod("MinecraftServer", "getServer").invoke(null);
|
||||
Object world = ((List) server.getClass().getField("worlds").get(server)).get(0);
|
||||
|
||||
Object bedChunk = ReflectionManager.getNmsClass("Chunk")
|
||||
mapChunk = ReflectionManager.getNmsClass("Chunk")
|
||||
.getConstructor(ReflectionManager.getNmsClass("World"), int.class, int.class).newInstance(world, 0, 0);
|
||||
|
||||
Field cSection = bedChunk.getClass().getDeclaredField("sections");
|
||||
Field cSection = mapChunk.getClass().getDeclaredField("sections");
|
||||
cSection.setAccessible(true);
|
||||
|
||||
Object chunkSection = ReflectionManager.getNmsClass("ChunkSection").getConstructor(int.class, boolean.class)
|
||||
|
@ -130,10 +131,19 @@ public class DisguiseUtilities
|
|||
|
||||
array[0] = chunkSection;
|
||||
|
||||
cSection.set(bedChunk, array);
|
||||
cSection.set(mapChunk, array);
|
||||
|
||||
spawnChunk = ProtocolLibrary.getProtocolManager()
|
||||
.createPacketConstructor(PacketType.Play.Server.MAP_CHUNK, bedChunk, 65535).createPacket(bedChunk, 65535);
|
||||
if (ReflectionManager.is1_10() || ReflectionManager.is1_9())
|
||||
{
|
||||
spawnChunk = ProtocolLibrary.getProtocolManager()
|
||||
.createPacketConstructor(PacketType.Play.Server.MAP_CHUNK, mapChunk, 65535).createPacket(mapChunk, 65535);
|
||||
}
|
||||
else if (ReflectionManager.is1_8())
|
||||
{
|
||||
spawnChunk = ProtocolLibrary.getProtocolManager()
|
||||
.createPacketConstructor(PacketType.Play.Server.MAP_CHUNK, mapChunk, true, 65535)
|
||||
.createPacket(mapChunk, true, 65535);
|
||||
}
|
||||
|
||||
Field threadField = ReflectionManager.getNmsField("MinecraftServer", "primaryThread");
|
||||
threadField.setAccessible(true);
|
||||
|
@ -444,12 +454,23 @@ public class DisguiseUtilities
|
|||
|
||||
if (oldLoc != null)
|
||||
{
|
||||
PacketContainer despawn = new PacketContainer(Server.UNLOAD_CHUNK);
|
||||
PacketContainer despawn;
|
||||
|
||||
StructureModifier<Object> modifier = despawn.getModifier();
|
||||
if (ReflectionManager.is1_10() || ReflectionManager.is1_9())
|
||||
{
|
||||
despawn = new PacketContainer(Server.UNLOAD_CHUNK);
|
||||
|
||||
modifier.write(0, getChunkCord(oldLoc.getBlockX()));
|
||||
modifier.write(1, getChunkCord(oldLoc.getBlockZ()));
|
||||
StructureModifier<Object> modifier = despawn.getModifier();
|
||||
|
||||
modifier.write(0, getChunkCord(oldLoc.getBlockX()));
|
||||
modifier.write(1, getChunkCord(oldLoc.getBlockZ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
despawn = ProtocolLibrary.getProtocolManager()
|
||||
.createPacketConstructor(PacketType.Play.Server.MAP_CHUNK, mapChunk, true, 0)
|
||||
.createPacket(mapChunk, true, 0);
|
||||
}
|
||||
|
||||
packets[i++] = despawn;
|
||||
}
|
||||
|
@ -1370,13 +1391,15 @@ public class DisguiseUtilities
|
|||
ReflectionManager.createEnumItemSlot(EquipmentSlot.HEAD),
|
||||
ReflectionManager.getNmsItem(new ItemStack(Material.STONE))).createPacket(player.getEntityId(),
|
||||
ReflectionManager.createEnumItemSlot(EquipmentSlot.HAND),
|
||||
ReflectionManager.getNmsItem(player.getInventory().getItemInMainHand())));
|
||||
sendSelfPacket(player,
|
||||
manager.createPacketConstructor(Server.ENTITY_EQUIPMENT, 0,
|
||||
ReflectionManager.createEnumItemSlot(EquipmentSlot.HEAD),
|
||||
ReflectionManager.getNmsItem(new ItemStack(Material.STONE))).createPacket(player.getEntityId(),
|
||||
ReflectionManager.createEnumItemSlot(EquipmentSlot.OFF_HAND),
|
||||
ReflectionManager.getNmsItem(player.getInventory().getItemInOffHand())));
|
||||
ReflectionManager.getNmsItem(player.getInventory().getItemInHand())));
|
||||
|
||||
if (!ReflectionManager.isPre1_9())
|
||||
sendSelfPacket(player,
|
||||
manager.createPacketConstructor(Server.ENTITY_EQUIPMENT, 0,
|
||||
ReflectionManager.createEnumItemSlot(EquipmentSlot.HEAD),
|
||||
ReflectionManager.getNmsItem(new ItemStack(Material.STONE))).createPacket(player.getEntityId(),
|
||||
ReflectionManager.createEnumItemSlot(EquipmentSlot.OFF_HAND),
|
||||
ReflectionManager.getNmsItem(player.getInventory().getItemInOffHand())));
|
||||
|
||||
Location loc = player.getLocation();
|
||||
|
||||
|
|
143
src/me/libraryaddict/disguise/utilities/NewDisguiseSounds.java
Normal file
143
src/me/libraryaddict/disguise/utilities/NewDisguiseSounds.java
Normal file
|
@ -0,0 +1,143 @@
|
|||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class NewDisguiseSounds
|
||||
{
|
||||
public static void setSounds()
|
||||
{
|
||||
DisguiseSound.ARROW.setSounds(null, null, null, null, Sound.ENTITY_ARROW_HIT, Sound.ENTITY_ARROW_SHOOT);
|
||||
|
||||
DisguiseSound.BAT.setSounds(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);
|
||||
|
||||
DisguiseSound.BLAZE.setSounds(Sound.ENTITY_BLAZE_HURT, null, Sound.ENTITY_BLAZE_DEATH, Sound.ENTITY_BLAZE_AMBIENT,
|
||||
Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_PLAYER_BIG_FALL);
|
||||
|
||||
DisguiseSound.CAVE_SPIDER.setSounds(Sound.ENTITY_SPIDER_AMBIENT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH,
|
||||
Sound.ENTITY_SPIDER_AMBIENT);
|
||||
|
||||
DisguiseSound.CHICKEN.setSounds(Sound.ENTITY_CHICKEN_HURT, Sound.ENTITY_CHICKEN_STEP, Sound.ENTITY_CHICKEN_HURT,
|
||||
Sound.ENTITY_CHICKEN_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_CHICKEN_EGG,
|
||||
Sound.ENTITY_PLAYER_BIG_FALL);
|
||||
|
||||
DisguiseSound.COW.setSounds(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_DEATH,
|
||||
Sound.ENTITY_COW_AMBIENT);
|
||||
|
||||
DisguiseSound.CREEPER.setSounds(Sound.ENTITY_CREEPER_HURT, "step.grass", Sound.ENTITY_CREEPER_DEATH, null);
|
||||
|
||||
DisguiseSound.DONKEY.setSounds(Sound.ENTITY_DONKEY_HURT, "step.grass", Sound.ENTITY_DONKEY_DEATH,
|
||||
Sound.ENTITY_DONKEY_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY,
|
||||
Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP,
|
||||
Sound.ENTITY_HORSE_ANGRY);
|
||||
|
||||
DisguiseSound.ELDER_GUARDIAN.setSounds(Sound.ENTITY_ELDER_GUARDIAN_HURT, null, Sound.ENTITY_ELDER_GUARDIAN_DEATH,
|
||||
Sound.ENTITY_ELDER_GUARDIAN_AMBIENT);
|
||||
|
||||
DisguiseSound.ENDER_DRAGON.setSounds(Sound.ENTITY_ENDERDRAGON_HURT, null, Sound.ENTITY_ENDERDRAGON_DEATH,
|
||||
Sound.ENTITY_ENDERDRAGON_AMBIENT, Sound.ENTITY_PLAYER_SMALL_FALL, Sound.ENTITY_ENDERDRAGON_FLAP,
|
||||
Sound.ENTITY_PLAYER_BIG_FALL);
|
||||
|
||||
DisguiseSound.ENDERMAN.setSounds(Sound.ENTITY_ENDERMEN_HURT, "step.grass", Sound.ENTITY_ENDERMEN_DEATH,
|
||||
Sound.ENTITY_ENDERMEN_AMBIENT, Sound.ENTITY_ENDERMEN_SCREAM, Sound.ENTITY_ENDERMEN_TELEPORT,
|
||||
Sound.ENTITY_ENDERMEN_STARE);
|
||||
|
||||
DisguiseSound.ENDERMITE.setSounds(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_ENDERMITE_STEP, Sound.ENTITY_ENDERMITE_DEATH,
|
||||
Sound.ENTITY_ENDERMITE_AMBIENT);
|
||||
|
||||
DisguiseSound.GHAST.setSounds(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);
|
||||
|
||||
DisguiseSound.GIANT.setSounds(Sound.ENTITY_PLAYER_HURT, "step.grass", null, null);
|
||||
|
||||
DisguiseSound.GUARDIAN.setSounds(Sound.ENTITY_GUARDIAN_HURT, null, Sound.ENTITY_GUARDIAN_DEATH,
|
||||
Sound.ENTITY_ELDER_GUARDIAN_AMBIENT);
|
||||
|
||||
DisguiseSound.HORSE.setSounds(Sound.ENTITY_HORSE_HURT, "step.grass", Sound.ENTITY_HORSE_DEATH, Sound.ENTITY_HORSE_AMBIENT,
|
||||
Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE, Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD,
|
||||
Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND, Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY);
|
||||
|
||||
DisguiseSound.IRON_GOLEM.setSounds(Sound.ENTITY_IRONGOLEM_HURT, Sound.ENTITY_IRONGOLEM_STEP, Sound.ENTITY_IRONGOLEM_DEATH,
|
||||
Sound.ENTITY_IRONGOLEM_ATTACK);
|
||||
|
||||
DisguiseSound.MAGMA_CUBE.setSounds(Sound.ENTITY_MAGMACUBE_HURT, Sound.ENTITY_MAGMACUBE_JUMP, null, null);
|
||||
|
||||
DisguiseSound.MULE.setSounds(Sound.ENTITY_MULE_HURT, "step.grass", Sound.ENTITY_MULE_DEATH, Sound.ENTITY_MULE_AMBIENT);
|
||||
|
||||
DisguiseSound.MUSHROOM_COW.setSounds(Sound.ENTITY_COW_HURT, Sound.ENTITY_COW_STEP, Sound.ENTITY_COW_HURT,
|
||||
Sound.ENTITY_COW_AMBIENT);
|
||||
|
||||
DisguiseSound.OCELOT.setSounds(Sound.ENTITY_CAT_HURT, "step.grass", Sound.ENTITY_CAT_HURT, Sound.ENTITY_CAT_AMBIENT,
|
||||
Sound.ENTITY_CAT_PURR, Sound.ENTITY_CAT_PURREOW);
|
||||
|
||||
DisguiseSound.PIG.setSounds(Sound.ENTITY_PIG_HURT, Sound.ENTITY_PIG_STEP, Sound.ENTITY_PIG_DEATH,
|
||||
Sound.ENTITY_PIG_AMBIENT);
|
||||
|
||||
DisguiseSound.PIG_ZOMBIE.setSounds(Sound.ENTITY_ZOMBIE_PIG_HURT, null, Sound.ENTITY_ZOMBIE_PIG_DEATH,
|
||||
Sound.ENTITY_ZOMBIE_PIG_AMBIENT, Sound.ENTITY_ZOMBIE_PIG_ANGRY);
|
||||
|
||||
DisguiseSound.PLAYER.setSounds(Sound.ENTITY_PLAYER_HURT, "step.grass", Sound.ENTITY_PLAYER_DEATH, null);
|
||||
|
||||
DisguiseSound.RABBIT.setSounds(Sound.ENTITY_RABBIT_HURT, Sound.ENTITY_RABBIT_JUMP, Sound.ENTITY_RABBIT_DEATH,
|
||||
Sound.ENTITY_RABBIT_AMBIENT);
|
||||
|
||||
DisguiseSound.SHEEP.setSounds(Sound.ENTITY_SHEEP_HURT, Sound.ENTITY_SHEEP_STEP, null, Sound.ENTITY_SHEEP_AMBIENT,
|
||||
Sound.ENTITY_SHEEP_SHEAR);
|
||||
|
||||
DisguiseSound.SHULKER.setSounds(Sound.ENTITY_SHULKER_HURT, null, Sound.ENTITY_SHULKER_DEATH, Sound.ENTITY_SHULKER_AMBIENT,
|
||||
Sound.ENTITY_SHULKER_OPEN, Sound.ENTITY_SHULKER_CLOSE, Sound.ENTITY_SHULKER_HURT_CLOSED,
|
||||
Sound.ENTITY_SHULKER_TELEPORT);
|
||||
|
||||
DisguiseSound.SILVERFISH.setSounds(Sound.ENTITY_SILVERFISH_HURT, Sound.ENTITY_SILVERFISH_STEP,
|
||||
Sound.ENTITY_SILVERFISH_DEATH, Sound.ENTITY_SILVERFISH_AMBIENT);
|
||||
|
||||
DisguiseSound.SKELETON.setSounds(Sound.ENTITY_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP, Sound.ENTITY_SKELETON_DEATH,
|
||||
Sound.ENTITY_SKELETON_AMBIENT);
|
||||
|
||||
DisguiseSound.SKELETON_HORSE.setSounds(Sound.ENTITY_SKELETON_HORSE_HURT, "step.grass", Sound.ENTITY_SKELETON_HORSE_DEATH,
|
||||
Sound.ENTITY_SKELETON_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
|
||||
Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY);
|
||||
|
||||
DisguiseSound.SLIME.setSounds(Sound.ENTITY_SLIME_HURT, Sound.ENTITY_SLIME_JUMP, Sound.ENTITY_SLIME_DEATH, null);
|
||||
|
||||
DisguiseSound.SNOWMAN.setSounds(Sound.ENTITY_SNOWMAN_HURT, null, Sound.ENTITY_SNOWMAN_DEATH, Sound.ENTITY_SNOWMAN_AMBIENT,
|
||||
Sound.ENTITY_SNOWMAN_SHOOT);
|
||||
|
||||
DisguiseSound.SPIDER.setSounds(Sound.ENTITY_SPIDER_AMBIENT, Sound.ENTITY_SPIDER_STEP, Sound.ENTITY_SPIDER_DEATH,
|
||||
Sound.ENTITY_SPIDER_AMBIENT);
|
||||
|
||||
DisguiseSound.SQUID.setSounds(Sound.ENTITY_SQUID_HURT, null, Sound.ENTITY_SQUID_DEATH, Sound.ENTITY_SQUID_AMBIENT);
|
||||
|
||||
DisguiseSound.UNDEAD_HORSE.setSounds(Sound.ENTITY_ZOMBIE_HORSE_HURT, "step.grass", Sound.ENTITY_ZOMBIE_HORSE_DEATH,
|
||||
Sound.ENTITY_ZOMBIE_HORSE_AMBIENT, Sound.ENTITY_HORSE_GALLOP, Sound.ENTITY_HORSE_SADDLE,
|
||||
Sound.ENTITY_DONKEY_ANGRY, Sound.ENTITY_HORSE_STEP_WOOD, Sound.ENTITY_HORSE_ARMOR, Sound.ENTITY_HORSE_LAND,
|
||||
Sound.ENTITY_HORSE_JUMP, Sound.ENTITY_HORSE_ANGRY);
|
||||
|
||||
DisguiseSound.VILLAGER.setSounds(Sound.ENTITY_VILLAGER_HURT, null, Sound.ENTITY_VILLAGER_DEATH,
|
||||
Sound.ENTITY_VILLAGER_AMBIENT, Sound.ENTITY_VILLAGER_TRADING, Sound.ENTITY_VILLAGER_NO,
|
||||
Sound.ENTITY_VILLAGER_YES);
|
||||
|
||||
DisguiseSound.WITCH.setSounds(Sound.ENTITY_WITCH_HURT, null, Sound.ENTITY_WITCH_DEATH, Sound.ENTITY_WITCH_AMBIENT);
|
||||
|
||||
DisguiseSound.WITHER.setSounds(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);
|
||||
|
||||
DisguiseSound.WITHER_SKELETON.setSounds(Sound.ENTITY_SKELETON_HURT, Sound.ENTITY_SKELETON_STEP,
|
||||
Sound.ENTITY_SKELETON_DEATH, Sound.ENTITY_SKELETON_AMBIENT);
|
||||
|
||||
DisguiseSound.WOLF.setSounds(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);
|
||||
|
||||
DisguiseSound.ZOMBIE.setSounds(Sound.ENTITY_ZOMBIE_HURT, Sound.ENTITY_ZOMBIE_STEP, Sound.ENTITY_ZOMBIE_DEATH,
|
||||
Sound.ENTITY_ZOMBIE_AMBIENT, Sound.ENTITY_ZOMBIE_INFECT, Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD,
|
||||
Sound.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR);
|
||||
|
||||
DisguiseSound.ZOMBIE_VILLAGER.setSounds(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_BREAK_DOOR_WOOD, Sound.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR);
|
||||
}
|
||||
}
|
112
src/me/libraryaddict/disguise/utilities/OldDisguiseSounds.java
Normal file
112
src/me/libraryaddict/disguise/utilities/OldDisguiseSounds.java
Normal file
|
@ -0,0 +1,112 @@
|
|||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
public class OldDisguiseSounds
|
||||
{
|
||||
public static void setSounds()
|
||||
{
|
||||
DisguiseSound.ARROW.setSounds(null, null, null, null, "random.bowhit");
|
||||
|
||||
DisguiseSound.BAT.setSounds("mob.bat.hurt", null, "mob.bat.death", "mob.bat.idle", "damage.fallsmall", "mob.bat.loop",
|
||||
"damage.fallbig", "mob.bat.takeoff");
|
||||
|
||||
DisguiseSound.BLAZE.setSounds("mob.blaze.hit", null, "mob.blaze.death", "mob.blaze.breathe", "damage.fallsmall",
|
||||
"damage.fallbig");
|
||||
|
||||
DisguiseSound.CAVE_SPIDER.setSounds("mob.spider.say", "mob.spider.step", "mob.spider.death", "mob.spider.say");
|
||||
|
||||
DisguiseSound.CHICKEN.setSounds("mob.chicken.hurt", "mob.chicken.step", "mob.chicken.hurt", "mob.chicken.say",
|
||||
"damage.fallsmall", "mob.chicken.plop", "damage.fallbig");
|
||||
|
||||
DisguiseSound.COW.setSounds("mob.cow.hurt", "mob.cow.step", "mob.cow.hurt", "mob.cow.say");
|
||||
|
||||
DisguiseSound.CREEPER.setSounds("mob.creeper.say", "step.grass", "mob.creeper.death", null);
|
||||
|
||||
DisguiseSound.DONKEY.setSounds("mob.horse.donkey.hit", "step.grass", "mob.horse.donkey.death", "mob.horse.donkey.idle",
|
||||
"mob.horse.gallop", "mob.horse.leather", "mob.horse.donkey.angry", "mob.horse.wood", "mob.horse.armor",
|
||||
"mob.horse.soft", "mob.horse.land", "mob.horse.jump", "mob.horse.angry");
|
||||
|
||||
DisguiseSound.ELDER_GUARDIAN.setSounds("mob.guardian.elder.hit", null, "mob.guardian.elder.death",
|
||||
"mob.guardian.elder.death");
|
||||
|
||||
DisguiseSound.ENDER_DRAGON.setSounds("mob.enderdragon.hit", null, "mob.enderdragon.end", "mob.enderdragon.growl",
|
||||
"damage.fallsmall", "mob.enderdragon.wings", "damage.fallbig");
|
||||
|
||||
DisguiseSound.ENDERMAN.setSounds("mob.endermen.hit", "step.grass", "mob.endermen.death", "mob.endermen.idle",
|
||||
"mob.endermen.scream", "mob.endermen.portal", "mob.endermen.stare");
|
||||
|
||||
DisguiseSound.ENDERMITE.setSounds("mob.silverfish.hit", "mob.silverfish.step", "mob.silverfish.kill",
|
||||
"mob.silverfish.say");
|
||||
|
||||
DisguiseSound.GHAST.setSounds("mob.ghast.scream", null, "mob.ghast.death", "mob.ghast.moan", "damage.fallsmall",
|
||||
"mob.ghast.fireball", "damage.fallbig", "mob.ghast.affectionate_scream", "mob.ghast.charge");
|
||||
|
||||
DisguiseSound.GIANT.setSounds("damage.hit", "step.grass", null, null);
|
||||
|
||||
DisguiseSound.GUARDIAN.setSounds("mob.guardian.hit", null, "mob.guardian.death", "mob.guardian.death");
|
||||
|
||||
DisguiseSound.HORSE.setSounds("mob.horse.hit", "step.grass", "mob.horse.death", "mob.horse.idle", "mob.horse.gallop",
|
||||
"mob.horse.leather", "mob.horse.wood", "mob.horse.armor", "mob.horse.soft", "mob.horse.land", "mob.horse.jump",
|
||||
"mob.horse.angry", "mob.horse.leather");
|
||||
|
||||
DisguiseSound.IRON_GOLEM.setSounds("mob.irongolem.hit", "mob.irongolem.walk", "mob.irongolem.death",
|
||||
"mob.irongolem.throw");
|
||||
|
||||
DisguiseSound.MAGMA_CUBE.setSounds("mob.slime.attack", "mob.slime.big", null, null, "mob.slime.small");
|
||||
|
||||
DisguiseSound.MULE.setSounds("mob.horse.donkey.hit", "step.grass", "mob.horse.donkey.death", "mob.horse.donkey.idle");
|
||||
|
||||
DisguiseSound.MUSHROOM_COW.setSounds("mob.cow.hurt", "mob.cow.step", "mob.cow.hurt", "mob.cow.say");
|
||||
|
||||
DisguiseSound.OCELOT.setSounds("mob.cat.hitt", "step.grass", "mob.cat.hitt", "mob.cat.meow", "mob.cat.purreow",
|
||||
"mob.cat.purr");
|
||||
|
||||
DisguiseSound.PIG.setSounds("mob.pig.say", "mob.pig.step", "mob.pig.death", "mob.pig.say");
|
||||
|
||||
DisguiseSound.PIG_ZOMBIE.setSounds("mob.zombiepig.zpighurt", null, "mob.zombiepig.zpigdeath", "mob.zombiepig.zpig",
|
||||
"mob.zombiepig.zpigangry");
|
||||
|
||||
DisguiseSound.PLAYER.setSounds(ReflectionManager.is1_7() ? "game.player.hurt" : "damage.hit", "step.grass",
|
||||
ReflectionManager.is1_7() ? "game.player.hurt" : "damage.hit", null);
|
||||
|
||||
DisguiseSound.RABBIT.setSounds("mob.rabbit.hurt", "mob.rabbit.hop", "mob.rabbit.death", "mob.rabbit.idle");
|
||||
|
||||
DisguiseSound.SHEEP.setSounds("mob.sheep.say", "mob.sheep.step", null, "mob.sheep.say", "mob.sheep.shear");
|
||||
|
||||
DisguiseSound.SILVERFISH.setSounds("mob.silverfish.hit", "mob.silverfish.step", "mob.silverfish.kill",
|
||||
"mob.silverfish.say");
|
||||
|
||||
DisguiseSound.SKELETON.setSounds("mob.skeleton.hurt", "mob.skeleton.step", "mob.skeleton.death", "mob.skeleton.say");
|
||||
|
||||
DisguiseSound.SKELETON_HORSE.setSounds("mob.horse.skeleton.hit", "step.grass", "mob.horse.skeleton.death",
|
||||
"mob.horse.skeleton.idle", "mob.horse.gallop", "mob.horse.leather", "mob.horse.wood", "mob.horse.armor",
|
||||
"mob.horse.soft", "mob.horse.land", "mob.horse.jump", "mob.horse.angry");
|
||||
|
||||
DisguiseSound.SLIME.setSounds("mob.slime.attack", "mob.slime.big", null, null, "mob.slime.small");
|
||||
|
||||
DisguiseSound.SPIDER.setSounds("mob.spider.say", "mob.spider.step", "mob.spider.death", "mob.spider.say");
|
||||
|
||||
DisguiseSound.UNDEAD_HORSE.setSounds("mob.horse.zombie.hit", "step.grass", "mob.horse.zombie.death",
|
||||
"mob.horse.zombie.idle", "mob.horse.gallop", "mob.horse.leather", "mob.horse.wood", "mob.horse.armor",
|
||||
"mob.horse.soft", "mob.horse.land", "mob.horse.jump", "mob.horse.angry");
|
||||
|
||||
DisguiseSound.VILLAGER.setSounds("mob.villager.hit", null, "mob.villager.death", "mob.villager.idle",
|
||||
"mob.villager.haggle", "mob.villager.no", "mob.villager.yes");
|
||||
|
||||
DisguiseSound.WITCH.setSounds("mob.witch.hurt", null, "mob.witch.death", "mob.witch.idle");
|
||||
|
||||
DisguiseSound.WITHER.setSounds("mob.wither.hurt", null, "mob.wither.death", "mob.wither.idle", "damage.fallsmall",
|
||||
"mob.wither.spawn", "damage.fallbig", "mob.wither.shoot");
|
||||
|
||||
DisguiseSound.WITHER_SKELETON.setSounds("mob.skeleton.hurt", "mob.skeleton.step", "mob.skeleton.death",
|
||||
"mob.skeleton.say");
|
||||
|
||||
DisguiseSound.WOLF.setSounds("mob.wolf.hurt", "mob.wolf.step", "mob.wolf.death", "mob.wolf.bark", "mob.wolf.panting",
|
||||
"mob.wolf.whine", "mob.wolf.howl", "mob.wolf.growl", "mob.wolf.shake");
|
||||
|
||||
DisguiseSound.ZOMBIE.setSounds("mob.zombie.hurt", "mob.zombie.step", "mob.zombie.death", "mob.zombie.say",
|
||||
"mob.zombie.infect", "mob.zombie.woodbreak", "mob.zombie.metal", "mob.zombie.wood");
|
||||
|
||||
DisguiseSound.ZOMBIE_VILLAGER.setSounds("mob.zombie.hurt", "mob.zombie.step", "mob.zombie.death", "mob.zombie.say",
|
||||
"mob.zombie.infect", "mob.zombie.woodbreak", "mob.zombie.metal", "mob.zombie.wood");
|
||||
}
|
||||
}
|
|
@ -185,9 +185,9 @@ public class PacketsManager
|
|||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
||||
|
||||
mods.write(0, disguisedEntity.getEntityId());
|
||||
mods.write(1, loc.getX());
|
||||
mods.write(2, loc.getY() + 0.06);
|
||||
mods.write(3, loc.getZ());
|
||||
mods.write(1, getLoc(loc.getX()));
|
||||
mods.write(2, getLoc(loc.getY() + 0.06));
|
||||
mods.write(3, getLoc(loc.getZ()));
|
||||
mods.write(4, 1);
|
||||
}
|
||||
else if (disguise.getType() == DisguiseType.PAINTING)
|
||||
|
@ -196,14 +196,21 @@ public class PacketsManager
|
|||
|
||||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
||||
|
||||
mods.write(0, disguisedEntity.getEntityId());
|
||||
mods.write(1, disguisedEntity.getUniqueId());
|
||||
mods.write(2, ReflectionManager.getBlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
mods.write(3, ReflectionManager.getEnumDirection(((int) loc.getYaw()) % 4));
|
||||
int index = 0;
|
||||
|
||||
mods.write(index++, disguisedEntity.getEntityId());
|
||||
|
||||
if (!ReflectionManager.is1_7() && !ReflectionManager.is1_8())
|
||||
{
|
||||
mods.write(index++, disguisedEntity.getUniqueId());
|
||||
}
|
||||
|
||||
mods.write(index++, ReflectionManager.getBlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
mods.write(index++, ReflectionManager.getEnumDirection(((int) loc.getYaw()) % 4));
|
||||
|
||||
int id = ((MiscDisguise) disguise).getData();
|
||||
|
||||
mods.write(4, ReflectionManager.getEnumArt(Art.values()[id]));
|
||||
mods.write(index++, ReflectionManager.getEnumArt(Art.values()[id]));
|
||||
|
||||
// Make the teleport packet to make it visible..
|
||||
spawnPackets[1] = new PacketContainer(Server.ENTITY_TELEPORT);
|
||||
|
@ -211,9 +218,9 @@ public class PacketsManager
|
|||
mods = spawnPackets[1].getModifier();
|
||||
|
||||
mods.write(0, disguisedEntity.getEntityId());
|
||||
mods.write(1, loc.getX());
|
||||
mods.write(2, loc.getY());
|
||||
mods.write(3, loc.getZ());
|
||||
mods.write(1, getLoc(loc.getX()));
|
||||
mods.write(2, getLoc(loc.getY()));
|
||||
mods.write(3, getLoc(loc.getZ()));
|
||||
mods.write(4, yaw);
|
||||
mods.write(5, pitch);
|
||||
}
|
||||
|
@ -239,15 +246,17 @@ public class PacketsManager
|
|||
|
||||
spawnPackets[0] = new PacketContainer(PacketType.Play.Server.NAMED_ENTITY_SPAWN);
|
||||
|
||||
spawnPackets[0].getIntegers().write(0, entityId); // Id
|
||||
spawnPackets[0].getModifier().write(1, gameProfile.getUUID());
|
||||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
||||
|
||||
spawnPackets[0].getDoubles().write(0, loc.getX());
|
||||
spawnPackets[0].getDoubles().write(1, loc.getY());
|
||||
spawnPackets[0].getDoubles().write(2, loc.getZ());
|
||||
mods.write(0, entityId); // Id
|
||||
mods.write(1, gameProfile.getUUID());
|
||||
|
||||
spawnPackets[0].getBytes().write(0, ((byte) (int) (loc.getYaw() * 256.0F / 360.0F)));
|
||||
spawnPackets[0].getBytes().write(1, ((byte) (int) (loc.getPitch() * 256.0F / 360.0F)));
|
||||
mods.write(2, getLoc(loc.getX()));
|
||||
mods.write(3, getLoc(loc.getY()));
|
||||
mods.write(4, getLoc(loc.getZ()));
|
||||
|
||||
mods.write(5, ((byte) (int) (loc.getYaw() * 256.0F / 360.0F)));
|
||||
mods.write(6, ((byte) (int) (loc.getPitch() * 256.0F / 360.0F)));
|
||||
|
||||
spawnPackets[0].getDataWatcherModifier().write(0,
|
||||
createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher())); // watcher,
|
||||
|
@ -310,9 +319,16 @@ public class PacketsManager
|
|||
|
||||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
||||
|
||||
mods.write(0, disguisedEntity.getEntityId());
|
||||
mods.write(1, UUID.randomUUID());
|
||||
mods.write(2, disguise.getType().getTypeId());
|
||||
int index = 0;
|
||||
|
||||
mods.write(index++, disguisedEntity.getEntityId());
|
||||
|
||||
if (!ReflectionManager.is1_7() && !ReflectionManager.is1_8())
|
||||
{
|
||||
mods.write(index++, UUID.randomUUID());
|
||||
}
|
||||
|
||||
mods.write(index++, disguise.getType().getTypeId());
|
||||
|
||||
// region Vector calculations
|
||||
double d1 = 3.9D;
|
||||
|
@ -333,14 +349,14 @@ public class PacketsManager
|
|||
d4 = d1;
|
||||
// endregion
|
||||
|
||||
mods.write(3, loc.getX());
|
||||
mods.write(4, loc.getY());
|
||||
mods.write(5, loc.getZ());
|
||||
mods.write(6, (int) (d2 * 8000.0D));
|
||||
mods.write(7, (int) (d3 * 8000.0D));
|
||||
mods.write(8, (int) (d4 * 8000.0D));
|
||||
mods.write(9, yaw);
|
||||
mods.write(10, pitch);
|
||||
mods.write(index++, getLoc(loc.getX()));
|
||||
mods.write(index++, getLoc(loc.getY()));
|
||||
mods.write(index++, getLoc(loc.getZ()));
|
||||
mods.write(index++, (int) (d2 * 8000.0D));
|
||||
mods.write(index++, (int) (d3 * 8000.0D));
|
||||
mods.write(index++, (int) (d4 * 8000.0D));
|
||||
mods.write(index++, yaw);
|
||||
mods.write(index++, pitch);
|
||||
|
||||
spawnPackets[0].getDataWatcherModifier().write(0,
|
||||
createDataWatcher(WrappedDataWatcher.getEntityWatcher(disguisedEntity), disguise.getWatcher()));
|
||||
|
@ -369,18 +385,19 @@ public class PacketsManager
|
|||
spawnPackets[0] = ProtocolLibrary.getProtocolManager()
|
||||
.createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, nmsEntity, objectId, data)
|
||||
.createPacket(nmsEntity, objectId, data);
|
||||
spawnPackets[0].getModifier().write(8, pitch);
|
||||
spawnPackets[0].getModifier().write(9, yaw);
|
||||
|
||||
spawnPackets[0].getModifier().write(ReflectionManager.isPre1_9() ? 7 : 8, pitch);
|
||||
spawnPackets[0].getModifier().write(ReflectionManager.isPre1_9() ? 8 : 9, yaw);
|
||||
|
||||
if (disguise.getType() == DisguiseType.ITEM_FRAME)
|
||||
{
|
||||
if (data % 2 == 0)
|
||||
{
|
||||
spawnPackets[0].getModifier().write(4, loc.getZ() + (data == 0 ? -1 : 1));
|
||||
spawnPackets[0].getModifier().write(4, getLoc(loc.getZ() + (data == 0 ? -1 : 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnPackets[0].getModifier().write(2, loc.getX() + (data == 3 ? -1 : 1));
|
||||
spawnPackets[0].getModifier().write(2, getLoc(loc.getX() + (data == 3 ? -1 : 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -408,6 +425,14 @@ public class PacketsManager
|
|||
};
|
||||
}
|
||||
|
||||
private static Object getLoc(double loc)
|
||||
{
|
||||
if (ReflectionManager.is1_7() || ReflectionManager.is1_8())
|
||||
return (int) Math.floor(loc * 32);
|
||||
|
||||
return loc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new datawatcher but with the 'correct' values
|
||||
*/
|
||||
|
@ -428,6 +453,12 @@ public class PacketsManager
|
|||
if (watchableObject.getValue() == null)
|
||||
continue;
|
||||
|
||||
if (ReflectionManager.is1_7() || ReflectionManager.is1_8())
|
||||
{
|
||||
newWatcher.setObject(watchableObject.getIndex(), watchableObject.getValue());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Registry.get(watchableObject.getValue().getClass()) == null)
|
||||
continue;
|
||||
|
||||
|
@ -996,8 +1027,10 @@ public class PacketsManager
|
|||
byte yawValue = bytes.read(0);
|
||||
byte pitchValue = bytes.read(1);
|
||||
|
||||
bytes.write(0, getYaw(disguise.getType(), entity.getType(), yawValue));
|
||||
bytes.write(1, getPitch(disguise.getType(), DisguiseType.getType(entity.getType()), pitchValue));
|
||||
bytes.write(ReflectionManager.isPre1_9() && sentPacket.getType() != Server.ENTITY_TELEPORT ? 3 : 0,
|
||||
getYaw(disguise.getType(), entity.getType(), yawValue));
|
||||
bytes.write(ReflectionManager.isPre1_9() && sentPacket.getType() != Server.ENTITY_TELEPORT ? 4 : 1,
|
||||
getPitch(disguise.getType(), DisguiseType.getType(entity.getType()), pitchValue));
|
||||
|
||||
if (sentPacket.getType() == Server.ENTITY_TELEPORT && disguise.getType() == DisguiseType.ITEM_FRAME)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,10 @@ public class ReflectionManager
|
|||
private static final Method ihmGet;
|
||||
private static final Field pingField;
|
||||
private static final Field trackerField;
|
||||
public static final Field entityCountField;
|
||||
private static final Field entityCountField;
|
||||
private static final boolean v1_10;
|
||||
private static final boolean v1_9;
|
||||
private static final boolean v1_8;
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -95,6 +98,52 @@ public class ReflectionManager
|
|||
entityCountField = getNmsField("Entity", "entityCount");
|
||||
|
||||
entityCountField.setAccessible(true);
|
||||
|
||||
v1_10 = bukkitVersion.startsWith("v1_10_");
|
||||
v1_9 = bukkitVersion.startsWith("v1_9_");
|
||||
v1_8 = bukkitVersion.startsWith("v1_8_");
|
||||
}
|
||||
|
||||
public static ItemStack getItemWithMaterial(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
Material mat = Material.valueOf(name);
|
||||
|
||||
if (mat == null)
|
||||
return null;
|
||||
|
||||
return new ItemStack(mat);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean is1_10()
|
||||
{
|
||||
return v1_10;
|
||||
}
|
||||
|
||||
public static boolean is1_9()
|
||||
{
|
||||
return v1_9;
|
||||
}
|
||||
|
||||
public static boolean is1_8()
|
||||
{
|
||||
return v1_8;
|
||||
}
|
||||
|
||||
public static boolean is1_7()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isPre1_9()
|
||||
{
|
||||
return is1_7() || is1_8();
|
||||
}
|
||||
|
||||
public static Object createEntityInstance(String entityName)
|
||||
|
@ -128,7 +177,7 @@ public class ReflectionManager
|
|||
entityObject = entityClass
|
||||
.getDeclaredConstructor(getNmsClass("World"), Double.TYPE, Double.TYPE, Double.TYPE,
|
||||
getNmsClass("ItemStack"))
|
||||
.newInstance(world, 0d, 0d, 0d, getNmsItem(new ItemStack(Material.SPLASH_POTION)));
|
||||
.newInstance(world, 0d, 0d, 0d, getNmsItem(new ItemStack(Material.STONE)));
|
||||
break;
|
||||
default:
|
||||
entityObject = entityClass.getDeclaredConstructor(getNmsClass("World")).newInstance(world);
|
||||
|
@ -781,8 +830,11 @@ public class ReflectionManager
|
|||
* @param slot
|
||||
* @return null if the equipment slot is null
|
||||
*/
|
||||
public static Enum createEnumItemSlot(EquipmentSlot slot)
|
||||
public static Object createEnumItemSlot(EquipmentSlot slot)
|
||||
{
|
||||
if (is1_7() || is1_8())
|
||||
return slot.ordinal();
|
||||
|
||||
Class<?> clazz = getNmsClass("EnumItemSlot");
|
||||
|
||||
Object[] enums = clazz != null ? clazz.getEnumConstants() : null;
|
||||
|
@ -964,14 +1016,15 @@ public class ReflectionManager
|
|||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else if (value instanceof BlockPosition)
|
||||
}
|
||||
else if (value instanceof BlockPosition)
|
||||
{
|
||||
BlockPosition pos = (BlockPosition) value;
|
||||
|
||||
try
|
||||
{
|
||||
return getNmsConstructor("BlockPosition", int.class, int.class, int.class).newInstance(pos.getX(),
|
||||
pos.getY(), pos.getZ());
|
||||
return getNmsConstructor("BlockPosition", int.class, int.class, int.class).newInstance(pos.getX(), pos.getY(),
|
||||
pos.getZ());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1011,8 +1064,8 @@ public class ReflectionManager
|
|||
|
||||
if (serializer == null)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"Unable to find Serializer for " + value + "! Are you running the latest version of ProtocolLib?");
|
||||
throw new IllegalArgumentException("Unable to find Serializer for index " + id + " value " + value
|
||||
+ "! Are you running the latest version of ProtocolLib?");
|
||||
}
|
||||
|
||||
WrappedDataWatcherObject watcherObject = new WrappedDataWatcherObject(id, serializer);
|
||||
|
@ -1033,6 +1086,12 @@ public class ReflectionManager
|
|||
|
||||
public static WrappedWatchableObject createWatchable(int index, Object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
|
||||
if (ReflectionManager.is1_7() || ReflectionManager.is1_8())
|
||||
return new WrappedWatchableObject(index, convertInvalidItem(obj));
|
||||
|
||||
return new WrappedWatchableObject(createDataWatcherItem(index, obj));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import me.libraryaddict.disguise.disguisetypes.Disguise;
|
|||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.SheepWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.WolfWatcher;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager;
|
||||
|
||||
public class PacketListenerClientInteract extends PacketAdapter
|
||||
{
|
||||
|
@ -55,7 +56,8 @@ public class PacketListenerClientInteract extends PacketAdapter
|
|||
|
||||
for (ItemStack item : new ItemStack[]
|
||||
{
|
||||
observer.getInventory().getItemInMainHand(), observer.getInventory().getItemInOffHand()
|
||||
observer.getInventory().getItemInHand(),
|
||||
ReflectionManager.isPre1_9() ? null : observer.getInventory().getItemInOffHand()
|
||||
})
|
||||
{
|
||||
if (item == null || item.getType() != Material.INK_SACK)
|
||||
|
|
|
@ -64,11 +64,13 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
|
||||
if (event.getPacketType() == Server.NAMED_SOUND_EFFECT)
|
||||
{
|
||||
boolean oldSounds = ReflectionManager.isPre1_9();
|
||||
SoundType soundType = null;
|
||||
|
||||
int[] soundCords = new int[]
|
||||
{
|
||||
(Integer) mods.read(2), (Integer) mods.read(3), (Integer) mods.read(4)
|
||||
(Integer) mods.read(oldSounds ? 1 : 2), (Integer) mods.read(oldSounds ? 2 : 3),
|
||||
(Integer) mods.read(oldSounds ? 3 : 4)
|
||||
};
|
||||
|
||||
int chunkX = (int) Math.floor((soundCords[0] / 8D) / 16D);
|
||||
|
@ -84,7 +86,7 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
|
||||
Disguise disguise = null;
|
||||
|
||||
String soundEffect = ReflectionManager.convertSoundEffectToString(mods.read(0));
|
||||
String soundEffect = oldSounds ? (String) mods.read(0) : ReflectionManager.convertSoundEffectToString(mods.read(0));
|
||||
Entity[] entities = observer.getWorld().getChunkAt(chunkX, chunkZ).getEntities();
|
||||
|
||||
for (Entity entity : entities)
|
||||
|
@ -205,8 +207,11 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
{
|
||||
Object step = ReflectionManager.getNmsField("Block", "stepSound").get(block);
|
||||
|
||||
mods.write(0, ReflectionManager.getNmsMethod(step.getClass(), "d").invoke(step));
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType()));
|
||||
mods.write(0, ReflectionManager.getNmsMethod(step.getClass(), oldSounds ? "getStepSound" : "d")
|
||||
.invoke(step));
|
||||
|
||||
if (!oldSounds)
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType()));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -219,16 +224,18 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
}
|
||||
else
|
||||
{
|
||||
mods.write(0, ReflectionManager.getCraftSoundEffect(sound));
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType()));
|
||||
mods.write(0, oldSounds ? sound : ReflectionManager.getCraftSoundEffect(sound));
|
||||
|
||||
if (!oldSounds)
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType()));
|
||||
|
||||
// Time to change the pitch and volume
|
||||
if (soundType == SoundType.HURT || soundType == SoundType.DEATH || soundType == SoundType.IDLE)
|
||||
{
|
||||
// If the volume is the default
|
||||
if (mods.read(5).equals(entitySound.getDamageAndIdleSoundVolume()))
|
||||
if (mods.read(oldSounds ? 4 : 5).equals(entitySound.getDamageAndIdleSoundVolume()))
|
||||
{
|
||||
mods.write(5, dSound.getDamageAndIdleSoundVolume());
|
||||
mods.write(oldSounds ? 4 : 5, dSound.getDamageAndIdleSoundVolume());
|
||||
}
|
||||
|
||||
// Here I assume its the default pitch as I can't calculate if its real.
|
||||
|
@ -248,7 +255,7 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
|
||||
if (((MobDisguise) disguise).isAdult() == baby)
|
||||
{
|
||||
float pitch = (Float) mods.read(6);
|
||||
float pitch = oldSounds ? ((Byte) mods.read(5)) / 64F : (Float) mods.read(6);
|
||||
|
||||
if (baby)
|
||||
{
|
||||
|
@ -285,7 +292,10 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
if (pitch > 255)
|
||||
pitch = 255;
|
||||
|
||||
mods.write(6, pitch);
|
||||
if (oldSounds)
|
||||
mods.write(5, (int) pitch);
|
||||
else
|
||||
mods.write(6, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -315,6 +325,7 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
|
||||
SoundType soundType = null;
|
||||
Object obj = null;
|
||||
boolean oldSounds = ReflectionManager.isPre1_9();
|
||||
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
|
@ -367,14 +378,19 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
|
||||
mods = packet.getModifier();
|
||||
|
||||
Object craftSoundEffect = ReflectionManager.getCraftSoundEffect(sound);
|
||||
Object craftSoundEffect = oldSounds ? sound : ReflectionManager.getCraftSoundEffect(sound);
|
||||
|
||||
mods.write(0, craftSoundEffect);
|
||||
mods.write(1, ReflectionManager.getSoundCategory(disguise.getType())); // Meh
|
||||
mods.write(2, (int) (loc.getX() * 8D));
|
||||
mods.write(3, (int) (loc.getY() * 8D));
|
||||
mods.write(4, (int) (loc.getZ() * 8D));
|
||||
mods.write(5, disSound.getDamageAndIdleSoundVolume());
|
||||
int index = 0;
|
||||
|
||||
mods.write(index++, craftSoundEffect);
|
||||
|
||||
if (!oldSounds)
|
||||
mods.write(index++, ReflectionManager.getSoundCategory(disguise.getType())); // Meh
|
||||
|
||||
mods.write(index++, (int) (loc.getX() * 8D));
|
||||
mods.write(index++, (int) (loc.getY() * 8D));
|
||||
mods.write(index++, (int) (loc.getZ() * 8D));
|
||||
mods.write(index++, disSound.getDamageAndIdleSoundVolume());
|
||||
|
||||
float pitch;
|
||||
|
||||
|
@ -398,7 +414,7 @@ public class PacketListenerSounds extends PacketAdapter
|
|||
if (pitch > 255)
|
||||
pitch = 255;
|
||||
|
||||
mods.write(6, (int) pitch);
|
||||
mods.write(index++, (int) pitch);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue