Eliminate pointless redraws in receiveMetaTileEntityData
This commit is contained in:
parent
55fdf45f59
commit
970bd1abb1
2 changed files with 58 additions and 14 deletions
|
@ -327,18 +327,38 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
|
|||
}
|
||||
|
||||
public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
|
||||
issueTextureUpdate();
|
||||
boolean tNeedsRedraw = false;
|
||||
if (aID > 0 && mID != aID) {
|
||||
mID = aID;
|
||||
createNewMetatileEntity(mID);
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
|
||||
mCoverSides[0] = aCover0;
|
||||
mCoverSides[1] = aCover1;
|
||||
mCoverSides[2] = aCover2;
|
||||
mCoverSides[3] = aCover3;
|
||||
mCoverSides[4] = aCover4;
|
||||
mCoverSides[5] = aCover5;
|
||||
|
||||
if (mCoverSides[0] != aCover0) {
|
||||
mCoverSides[0] = aCover0;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[1] != aCover1) {
|
||||
mCoverSides[1] = aCover1;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[2] != aCover2) {
|
||||
mCoverSides[2] = aCover2;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[3] != aCover3) {
|
||||
mCoverSides[3] = aCover3;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[4] != aCover4) {
|
||||
mCoverSides[4] = aCover4;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[5] != aCover5) {
|
||||
mCoverSides[5] = aCover5;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
|
||||
for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
|
||||
|
||||
|
@ -346,6 +366,8 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
|
|||
receiveClientEvent(1, aUpdateData);
|
||||
receiveClientEvent(2, aColorData);
|
||||
receiveClientEvent(3, aRedstoneData);
|
||||
|
||||
if (tNeedsRedraw) issueTextureUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -594,19 +594,38 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
|
|||
}
|
||||
|
||||
public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
|
||||
issueTextureUpdate();
|
||||
boolean tNeedsRedraw = false;
|
||||
if (mID != aID && aID > 0) {
|
||||
mID = aID;
|
||||
createNewMetatileEntity(mID);
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
|
||||
|
||||
mCoverSides[0] = aCover0;
|
||||
mCoverSides[1] = aCover1;
|
||||
mCoverSides[2] = aCover2;
|
||||
mCoverSides[3] = aCover3;
|
||||
mCoverSides[4] = aCover4;
|
||||
mCoverSides[5] = aCover5;
|
||||
if (mCoverSides[0] != aCover0) {
|
||||
mCoverSides[0] = aCover0;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[1] != aCover1) {
|
||||
mCoverSides[1] = aCover1;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[2] != aCover2) {
|
||||
mCoverSides[2] = aCover2;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[3] != aCover3) {
|
||||
mCoverSides[3] = aCover3;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[4] != aCover4) {
|
||||
mCoverSides[4] = aCover4;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
if (mCoverSides[5] != aCover5) {
|
||||
mCoverSides[5] = aCover5;
|
||||
tNeedsRedraw = true;
|
||||
}
|
||||
|
||||
for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
|
||||
|
||||
|
@ -614,6 +633,9 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
|
|||
receiveClientEvent(1, aUpdateData);
|
||||
receiveClientEvent(2, aColorData);
|
||||
receiveClientEvent(3, aRedstoneData);
|
||||
|
||||
if (tNeedsRedraw) issueTextureUpdate();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue