mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 11:05:07 +00:00
sa
This commit is contained in:
1 parent
319ed409f1
commit
4e1835ed12
1 file changed
+11
-18
@@ -39,6 +39,7 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
.withInitial(PlacementContext::new);
|
||||
|
||||
private static class PlacementContext {
|
||||
|
||||
int x, y, z;
|
||||
}
|
||||
|
||||
@@ -63,8 +64,7 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
String mobType = getMobTypeFromItemStack(itemstack);
|
||||
if (mobType != null) {
|
||||
NEICPH.sendMobSpawnerID(x, y, z, mobType);
|
||||
spawner.func_145881_a()
|
||||
.setEntityName(mobType);
|
||||
spawner.func_145881_a().setEntityName(mobType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -87,8 +87,7 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip,
|
||||
boolean advanced) {
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||
int meta = getValidMetaData(itemstack);
|
||||
EntityLiving entity = getEntity(meta);
|
||||
String mobName = IDtoNameMap.get(meta);
|
||||
@@ -130,8 +129,7 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
|
||||
int modifiers = entityClass.getModifiers();
|
||||
if (Modifier.isAbstract(modifiers) || Modifier.isInterface(modifiers)) {
|
||||
NEIClientConfig.logger.warn(
|
||||
"Skipping abstract entity class: " + entityClass.getName());
|
||||
NEIClientConfig.logger.warn("Skipping abstract entity class: " + entityClass.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -144,8 +142,7 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
}
|
||||
|
||||
try {
|
||||
return (EntityLiving) entityClass.getConstructor(World.class)
|
||||
.newInstance(world);
|
||||
return (EntityLiving) entityClass.getConstructor(World.class).newInstance(world);
|
||||
} catch (Throwable t) {
|
||||
logEntityCreationError(entityClass, id, t);
|
||||
return getFallbackEntity(id);
|
||||
@@ -154,12 +151,10 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
|
||||
private static void logEntityCreationError(Class<?> entityClass, int id, Throwable t) {
|
||||
if (entityClass == null) {
|
||||
NEIClientConfig.logger.error(
|
||||
"Null class for entity (ID: {}, Name: {})",
|
||||
id, IDtoNameMap.getOrDefault(id, "unknown"));
|
||||
NEIClientConfig.logger
|
||||
.error("Null class for entity (ID: {}, Name: {})", id, IDtoNameMap.getOrDefault(id, "unknown"));
|
||||
} else {
|
||||
NEIClientConfig.logger.error(
|
||||
"Error creating instance of entity: " + entityClass.getName(), t);
|
||||
NEIClientConfig.logger.error("Error creating instance of entity: " + entityClass.getName(), t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,16 +176,14 @@ public class ItemMobSpawner extends ItemBlock {
|
||||
pig = new EntityPig(world);
|
||||
entityHashMap.put(idPig, pig);
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error(
|
||||
"Failed to create fallback pig entity", e);
|
||||
NEIClientConfig.logger.error("Failed to create fallback pig entity", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pig == null && originalId != idPig) {
|
||||
NEIClientConfig.logger.warn(
|
||||
"Using null fallback for entity ID: {}, original fallback ID: {}",
|
||||
originalId, idPig);
|
||||
NEIClientConfig.logger
|
||||
.warn("Using null fallback for entity ID: {}, original fallback ID: {}", originalId, idPig);
|
||||
}
|
||||
|
||||
return pig;
|
||||
|
||||
Reference in new issue
Block a user