Fixed crash, and lag

This commit is contained in:
modmuss50 2015-04-26 15:35:45 +01:00
parent f5d58b57eb
commit 98427bbe8a
2 changed files with 2 additions and 21 deletions

View file

@ -43,8 +43,9 @@ public class QModPartFactory implements IPartFactory, IPartProvider {
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
e.printStackTrace(); e.printStackTrace();
} }
} } else {
return new QModPart(modPart.getClass().newInstance()); return new QModPart(modPart.getClass().newInstance());
}
} catch (InstantiationException e) { } catch (InstantiationException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {

View file

@ -44,17 +44,11 @@ public class CablePart extends ModPart implements IEnergyConductor {
protected ForgeDirection[] dirs = ForgeDirection.values(); protected ForgeDirection[] dirs = ForgeDirection.values();
private boolean[] connections = new boolean[6]; private boolean[] connections = new boolean[6];
public boolean addedToEnergyNet = false; public boolean addedToEnergyNet = false;
TileEntityCable entityCable = new TileEntityCable();
public int type = 3; public int type = 3;
public CablePart(int type) { public CablePart(int type) {
this.type = type; this.type = type;
if(Minecraft.getMinecraft().theWorld != null){
entityCable = new TileEntityCable();
entityCable.setWorldObj(new fakeWorld());
entityCable.changeType((short) type);
}
refreshBounding(); refreshBounding();
connectedSides = new HashMap<ForgeDirection, TileEntity>(); connectedSides = new HashMap<ForgeDirection, TileEntity>();
} }
@ -150,20 +144,6 @@ public class CablePart extends ModPart implements IEnergyConductor {
return true; return true;
} }
public class fakeWorld extends WorldClient{
public fakeWorld() {
super(new NetHandlerPlayClient(Minecraft.getMinecraft(), null, new NetworkManager(true)), new WorldSettings(0, WorldSettings.GameType.NOT_SET,
false, false, WorldType.DEFAULT), 0, EnumDifficulty.PEACEFUL, Minecraft.getMinecraft().theWorld.theProfiler);
}
@Override
public boolean setBlockMetadataWithNotify(int p_72921_1_, int p_72921_2_, int p_72921_3_, int p_72921_4_, int p_72921_5_) {
return true;
}
}
@Override @Override
public void writeToNBT(NBTTagCompound tag) { public void writeToNBT(NBTTagCompound tag) {