Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.server.v1_8_R1;
- import com.google.common.collect.Lists;
- import com.google.common.collect.Maps;
- import java.lang.reflect.Constructor;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import java.util.Set;
- import org.apache.logging.log4j.LogManager;
- import org.apache.logging.log4j.Logger;
- public class EntityTypes
- {
- private static final Logger b = ;
- private static final Map c = Maps.newHashMap();
- private static final Map d = Maps.newHashMap();
- private static final Map e = Maps.newHashMap();
- private static final Map f = Maps.newHashMap();
- private static final Map g = Maps.newHashMap();
- public static final Map eggInfo = Maps.newLinkedHashMap();
- private static void a(Class paramClass, String paramString, int paramInt)
- {
- if (c.containsKey(paramString)) {
- throw new IllegalArgumentException("ID is already registered: " + paramString);
- }
- if (e.containsKey(Integer.valueOf(paramInt))) {
- throw new IllegalArgumentException("ID is already registered: " + paramInt);
- }
- if (paramInt == 0) {
- throw new IllegalArgumentException("Cannot register to reserved id: " + paramInt);
- }
- if (paramClass == null) {
- throw new IllegalArgumentException("Cannot register null clazz for id: " + paramInt);
- }
- c.put(paramString, paramClass);
- d.put(paramClass, paramString);
- e.put(Integer.valueOf(paramInt), paramClass);
- f.put(paramClass, Integer.valueOf(paramInt));
- g.put(paramString, Integer.valueOf(paramInt));
- }
- private static void a(Class paramClass, String paramString, int paramInt1, int paramInt2, int paramInt3)
- {
- a(paramClass, paramString, paramInt1);
- eggInfo.put(Integer.valueOf(paramInt1), new MonsterEggInfo(paramInt1, paramInt2, paramInt3));
- }
- static
- {
- a(EntityItem.class, "Item", 1);
- a(EntityExperienceOrb.class, "XPOrb", 2);
- a(EntityLeash.class, "LeashKnot", 8);
- a(EntityPainting.class, "Painting", 9);
- a(EntityArrow.class, "Arrow", 10);
- a(EntitySnowball.class, "Snowball", 11);
- a(EntityLargeFireball.class, "Fireball", 12);
- a(EntitySmallFireball.class, "SmallFireball", 13);
- a(EntityEnderPearl.class, "ThrownEnderpearl", 14);
- a(EntityEnderSignal.class, "EyeOfEnderSignal", 15);
- a(EntityPotion.class, "ThrownPotion", 16);
- a(EntityThrownExpBottle.class, "ThrownExpBottle", 17);
- a(EntityItemFrame.class, "ItemFrame", 18);
- a(EntityWitherSkull.class, "WitherSkull", 19);
- a(EntityTNTPrimed.class, "PrimedTnt", 20);
- a(EntityFallingBlock.class, "FallingSand", 21);
- a(EntityFireworks.class, "FireworksRocketEntity", 22);
- a(EntityArmorStand.class, "ArmorStand", 30);
- a(EntityBoat.class, "Boat", 41);
- a(EntityMinecartRideable.class, EnumMinecartType.RIDEABLE.b(), 42);
- a(EntityMinecartChest.class, EnumMinecartType.CHEST.b(), 43);
- a(EntityMinecartFurnace.class, EnumMinecartType.FURNACE.b(), 44);
- a(EntityMinecartTNT.class, EnumMinecartType.TNT.b(), 45);
- a(EntityMinecartHopper.class, EnumMinecartType.HOPPER.b(), 46);
- a(EntityMinecartMobSpawner.class, EnumMinecartType.SPAWNER.b(), 47);
- a(EntityMinecartCommandBlock.class, EnumMinecartType.COMMAND_BLOCK.b(), 40);
- a(EntityInsentient.class, "Mob", 48);
- a(EntityMonster.class, "Monster", 49);
- a(EntityCreeper.class, "Creeper", 50, 894731, 0);
- a(EntitySkeleton.class, "Skeleton", 51, 12698049, 4802889);
- a(EntitySpider.class, "Spider", 52, 3419431, 11013646);
- a(EntityGiantZombie.class, "Giant", 53);
- a(EntityZombie.class, "Zombie", 54, 44975, 7969893);
- a(EntitySlime.class, "Slime", 55, 5349438, 8306542);
- a(EntityGhast.class, "Ghast", 56, 16382457, 12369084);
- a(EntityPigZombie.class, "PigZombie", 57, 15373203, 5009705);
- a(EntityEnderman.class, "Enderman", 58, 1447446, 0);
- a(EntityCaveSpider.class, "CaveSpider", 59, 803406, 11013646);
- a(EntitySilverfish.class, "Silverfish", 60, 7237230, 3158064);
- a(EntityBlaze.class, "Blaze", 61, 16167425, 16775294);
- a(EntityMagmaCube.class, "LavaSlime", 62, 3407872, 16579584);
- a(EntityEnderDragon.class, "EnderDragon", 63);
- a(EntityWither.class, "WitherBoss", 64);
- a(EntityBat.class, "Bat", 65, 4996656, 986895);
- a(EntityWitch.class, "Witch", 66, 3407872, 5349438);
- a(EntityEndermite.class, "Endermite", 67, 1447446, 7237230);
- a(EntityGuardian.class, "Guardian", 68, 5931634, 15826224);
- a(EntityPig.class, "Pig", 90, 15771042, 14377823);
- a(EntitySheep.class, "Sheep", 91, 15198183, 16758197);
- a(EntityCow.class, "Cow", 92, 4470310, 10592673);
- a(EntityChicken.class, "Chicken", 93, 10592673, 16711680);
- a(EntitySquid.class, "Squid", 94, 2243405, 7375001);
- a(EntityWolf.class, "Wolf", 95, 14144467, 13545366);
- a(EntityMushroomCow.class, "MushroomCow", 96, 10489616, 12040119);
- a(EntitySnowman.class, "SnowMan", 97);
- a(EntityOcelot.class, "Ozelot", 98, 15720061, 5653556);
- a(EntityIronGolem.class, "VillagerGolem", 99);
- a(EntityHorse.class, "EntityHorse", 100, 12623485, 15656192);
- a(EntityRabbit.class, "Rabbit", 101, 10051392, 7555121);
- a(EntityVillager.class, "Villager", 120, 5651507, 12422002);
- a(EntityEnderCrystal.class, "EnderCrystal", 200);
- }
- public static Entity createEntityByName(String paramString, World paramWorld)
- {
- Entity localEntity = null;
- try
- {
- Class localClass = (Class)c.get(paramString);
- if (localClass != null) {
- localEntity = (Entity)localClass.getConstructor(new Class[] { World.class }).newInstance(new Object[] { paramWorld });
- }
- }
- catch (Exception localException)
- {
- localException.printStackTrace();
- }
- return localEntity;
- }
- public static Entity a(NBTTagCompound paramNBTTagCompound, World paramWorld)
- {
- Entity localEntity = null;
- if ("Minecart".equals(paramNBTTagCompound.getString("id")))
- {
- paramNBTTagCompound.setString("id", EnumMinecartType.a(paramNBTTagCompound.getInt("Type")).b());
- paramNBTTagCompound.remove("Type");
- }
- try
- {
- Class localClass = (Class)c.get(paramNBTTagCompound.getString("id"));
- if (localClass != null) {
- localEntity = (Entity)localClass.getConstructor(new Class[] { World.class }).newInstance(new Object[] { paramWorld });
- }
- }
- catch (Exception localException)
- {
- localException.printStackTrace();
- }
- if (localEntity != null) {
- localEntity.f(paramNBTTagCompound);
- } else {
- b.warn("Skipping Entity with id " + paramNBTTagCompound.getString("id"));
- }
- return localEntity;
- }
- public static Entity a(int paramInt, World paramWorld)
- {
- Entity localEntity = null;
- try
- {
- Class localClass = a(paramInt);
- if (localClass != null) {
- localEntity = (Entity)localClass.getConstructor(new Class[] { World.class }).newInstance(new Object[] { paramWorld });
- }
- }
- catch (Exception localException)
- {
- localException.printStackTrace();
- }
- if (localEntity == null) {
- b.warn("Skipping Entity with id " + paramInt);
- }
- return localEntity;
- }
- public static int a(Entity paramEntity)
- {
- Integer localInteger = (Integer)f.get(paramEntity.getClass());
- return localInteger == null ? 0 : localInteger.intValue();
- }
- public static Class a(int paramInt)
- {
- return (Class)e.get(Integer.valueOf(paramInt));
- }
- public static String b(Entity paramEntity)
- {
- return (String)d.get(paramEntity.getClass());
- }
- public static String b(int paramInt)
- {
- return (String)d.get(a(paramInt));
- }
- public static List b()
- {
- Set localSet = c.keySet();
- ArrayList localArrayList = Lists.newArrayList();
- for (String str : localSet)
- {
- Class localClass = (Class)c.get(str);
- if ((localClass.getModifiers() & 0x400) != 1024) {
- localArrayList.add(str);
- }
- }
- localArrayList.add("LightningBolt");
- return localArrayList;
- }
- public static boolean a(Entity paramEntity, String paramString)
- {
- String str = b(paramEntity);
- if ((str == null) && ((paramEntity instanceof EntityHuman))) {
- str = "Player";
- } else if ((str == null) && ((paramEntity instanceof EntityLightning))) {
- str = "LightningBolt";
- }
- return paramString.equals(str);
- }
- public static boolean b(String paramString)
- {
- return ("Player".equals(paramString)) || (b().contains(paramString));
- }
- public static void a() {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement