Fixed a CME when chunk rendering is multithreaded, see #10
This commit is contained in:
parent
7dc33fb296
commit
6a1081f47c
|
@ -150,10 +150,7 @@ public abstract class PanelComponent {
|
|||
String type = nbt.getString("type");
|
||||
if (baseCreaters.containsKey(type)) {
|
||||
PanelComponent ret = baseCreaters.get(type).get();
|
||||
ret.readCustomNBT(nbt);
|
||||
ret.setX(nbt.getFloat("x"));
|
||||
ret.setY(nbt.getFloat("y"));
|
||||
ret.setPanelHeight(nbt.getFloat("panelHeight"));
|
||||
ret.readFromNBT(nbt);
|
||||
return ret;
|
||||
} else {
|
||||
FMLLog.log(IndustrialWires.MODID, Level.WARN, "Unknown panel component: " + type);
|
||||
|
@ -161,6 +158,13 @@ public abstract class PanelComponent {
|
|||
}
|
||||
}
|
||||
|
||||
public final void readFromNBT(NBTTagCompound nbt) {
|
||||
readCustomNBT(nbt);
|
||||
setX(nbt.getFloat("x"));
|
||||
setY(nbt.getFloat("y"));
|
||||
setPanelHeight(nbt.getFloat("panelHeight"));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderBox(TileEntityPanel te) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
|
|
@ -116,7 +116,8 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
|
|||
new Vector3f(wHalf, 0, length), EnumFacing.UP, BLACK, mat);
|
||||
return ret;
|
||||
}
|
||||
private static RawModelFontRenderer renderer;
|
||||
|
||||
private RawModelFontRenderer renderer;
|
||||
private RawModelFontRenderer fontRenderer() {
|
||||
if (renderer == null) {
|
||||
renderer = new RawModelFontRenderer(Minecraft.getMinecraft().gameSettings, Label.FONT, Minecraft.getMinecraft().getTextureManager(),
|
||||
|
|
|
@ -79,7 +79,9 @@ public final class PanelUtils {
|
|||
Matrix4 m4RotOnly = m4.copy();
|
||||
m4RotOnly.invert();
|
||||
m4RotOnly.transpose();
|
||||
for (PanelComponent pc : components) {
|
||||
//Intentionally not a for-each to help with CME's
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
PanelComponent pc = components.get(i);
|
||||
Matrix4 m4Here = m4.copy().translate(pc.getX(), .0001, pc.getY());
|
||||
List<RawQuad> compQuads = pc.getQuads();
|
||||
for (RawQuad bq : compQuads) {
|
||||
|
@ -346,11 +348,24 @@ public final class PanelUtils {
|
|||
}
|
||||
|
||||
public static void readListFromNBT(NBTTagList list, @Nonnull List<PanelComponent> base) {
|
||||
base.clear();
|
||||
boolean allNew = list.tagCount() != base.size();
|
||||
if (allNew) {
|
||||
base.clear();
|
||||
}
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
PanelComponent pc = PanelComponent.read(list.getCompoundTagAt(i));
|
||||
NBTTagCompound nbt = list.getCompoundTagAt(i);
|
||||
PanelComponent pc = PanelComponent.read(nbt);
|
||||
if (pc != null) {
|
||||
base.add(pc);
|
||||
if (allNew) {
|
||||
base.add(pc);
|
||||
} else {
|
||||
PanelComponent oldPc = base.get(i);
|
||||
if (pc.getClass() != oldPc.getClass()) {
|
||||
base.set(i, pc);
|
||||
} else {
|
||||
oldPc.readFromNBT(nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue