mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-24 22:14:29 +00:00
Cleaned and generalised item loading/searching
Reimplemented subsets Added regex searching Fixed format error on delete all Fixed GuiButton handling clicks before NEI widgets could override Re-Implemented banned blocks implementation Added brewing recipes again note test obf ASM beacons Fixed some calls being intercepted by item panel when mouse was over a gui element Fixed crash on closing potion window with escape Disabled fast transfer, scrolling, and drag 'n' drop in creative Added item panel sorting Removed TMI uninstaller Fixed /give command Updated to 1.7.10
This commit is contained in:
1 parent
3c9ebc6961
commit
3c84527806
67 files changed
+3251
-2319
No files matched your search
@@ -26,7 +26,7 @@ public class ItemMobSpawner extends ItemBlock
|
||||
public static int idPig;
|
||||
private static boolean loaded;
|
||||
|
||||
public ItemMobSpawner(World world) {
|
||||
public ItemMobSpawner() {
|
||||
super(Blocks.mob_spawner);
|
||||
|
||||
hasSubtypes = true;
|
||||
@@ -34,7 +34,6 @@ public class ItemMobSpawner extends ItemBlock
|
||||
|
||||
entityHashMap = new HashMap<Integer, EntityLiving>();
|
||||
IDtoNameMap = new HashMap<Integer, String>();
|
||||
loadSpawners(world);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,26 +72,24 @@ public class ItemMobSpawner extends ItemBlock
|
||||
meta = idPig;
|
||||
}
|
||||
Entity e = getEntity(meta);
|
||||
if (e == null) return;
|
||||
list.add("\u00A7" + (e instanceof IMob ? "4" : "3") + IDtoNameMap.get(meta));
|
||||
}
|
||||
|
||||
public static EntityLiving getEntity(int ID) {
|
||||
EntityLiving entityliving = entityHashMap.get(ID);
|
||||
if (entityliving == null) {
|
||||
EntityLiving e = entityHashMap.get(ID);
|
||||
if (e == null) {
|
||||
World world = NEIClientUtils.mc().theWorld;
|
||||
loadSpawners(world);
|
||||
Class<?> clazz = (Class<?>) EntityList.IDtoClassMapping.get(ID);
|
||||
try {
|
||||
Class<?> class1 = (Class<?>) EntityList.IDtoClassMapping.get(ID);
|
||||
if (class1 != null && EntityLiving.class.isAssignableFrom(class1)) {
|
||||
entityliving = (EntityLiving) class1.getConstructor(new Class[]{World.class}).newInstance(new Object[]{world});
|
||||
}
|
||||
e = (EntityLiving) clazz.getConstructor(new Class[]{World.class}).newInstance(world);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
NEIClientConfig.logger.error("Error creating instance of entity: " + clazz.getName(), t);
|
||||
e = getEntity(idPig);
|
||||
}
|
||||
entityHashMap.put(ID, entityliving);
|
||||
entityHashMap.put(ID, e);
|
||||
}
|
||||
return entityliving;
|
||||
return e;
|
||||
}
|
||||
|
||||
private void setDefaultTag(ItemStack itemstack) {
|
||||
@@ -103,31 +100,27 @@ public class ItemMobSpawner extends ItemBlock
|
||||
public static void loadSpawners(World world) {
|
||||
if (loaded) return;
|
||||
loaded = true;
|
||||
try {
|
||||
HashMap<Class<Entity>, String> classToStringMapping = (HashMap<Class<Entity>, String>) EntityList.classToStringMapping;
|
||||
HashMap<Class<Entity>, Integer> classToIDMapping = (HashMap<Class<Entity>, Integer>) EntityList.classToIDMapping;
|
||||
for (Class<Entity> eclass : classToStringMapping.keySet()) {
|
||||
if (!EntityLiving.class.isAssignableFrom(eclass))
|
||||
HashMap<Class<Entity>, String> classToStringMapping = (HashMap<Class<Entity>, String>) EntityList.classToStringMapping;
|
||||
HashMap<Class<Entity>, Integer> classToIDMapping = (HashMap<Class<Entity>, Integer>) EntityList.classToIDMapping;
|
||||
for (Class<Entity> eclass : classToStringMapping.keySet()) {
|
||||
if (!EntityLiving.class.isAssignableFrom(eclass))
|
||||
continue;
|
||||
try {
|
||||
EntityLiving entityliving = (EntityLiving) eclass.getConstructor(new Class[]{World.class}).newInstance(world);
|
||||
entityliving.isChild();
|
||||
|
||||
int id = classToIDMapping.get(eclass);
|
||||
String name = classToStringMapping.get(eclass);
|
||||
|
||||
if (name.equals("EnderDragon"))
|
||||
continue;
|
||||
try {
|
||||
EntityLiving entityliving = (EntityLiving) eclass.getConstructor(new Class[]{World.class}).newInstance(new Object[]{world});
|
||||
entityliving.isChild();
|
||||
|
||||
int id = classToIDMapping.get(eclass);
|
||||
String name = classToStringMapping.get(eclass);
|
||||
IDtoNameMap.put(id, name);
|
||||
|
||||
if (name.equals("EnderDragon"))
|
||||
continue;
|
||||
|
||||
IDtoNameMap.put(id, name);
|
||||
|
||||
if (name.equals("Pig"))
|
||||
idPig = id;
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
if (name.equals("Pig"))
|
||||
idPig = id;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user