Fixes 1896: Only update a monitor if the text would change
This commit is contained in:
parent
03073081f8
commit
c96cf10c86
|
@ -79,6 +79,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
{
|
||||
private static final IWideReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
private IAEItemStack configuredItem;
|
||||
private String lastHumanReadableText;
|
||||
private boolean isLocked;
|
||||
private IStackWatcher myWatcher;
|
||||
@SideOnly( Side.CLIENT )
|
||||
|
@ -177,6 +178,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
|
||||
final TileEntity te = this.tile;
|
||||
final ItemStack eq = player.getCurrentEquippedItem();
|
||||
|
||||
if( Platform.isWrench( player, eq, te.getPos() ) )
|
||||
{
|
||||
this.isLocked = !this.isLocked;
|
||||
|
@ -249,6 +251,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
protected void finalize() throws Throwable
|
||||
{
|
||||
super.finalize();
|
||||
|
||||
if( this.dspList != null )
|
||||
{
|
||||
GLAllocation.deleteDisplayLists( this.dspList );
|
||||
|
@ -273,6 +276,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
}
|
||||
|
||||
final IAEItemStack ais = (IAEItemStack) this.getDisplayed();
|
||||
|
||||
if( ais != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
@ -313,44 +317,42 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
final AEPartLocation d = this.side;
|
||||
GL11.glTranslated( d.xOffset * 0.77, d.yOffset * 0.77, d.zOffset * 0.77 );
|
||||
|
||||
if( d == AEPartLocation.UP )
|
||||
{
|
||||
GL11.glScalef( 1.0f, -1.0f, 1.0f );
|
||||
GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( this.getSpin() * 90.0F, 0, 0, 1 );
|
||||
}
|
||||
switch( d ) {
|
||||
case UP:
|
||||
GL11.glScalef( 1.0f, -1.0f, 1.0f );
|
||||
GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( this.getSpin() * 90.0F, 0, 0, 1 );
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
GL11.glScalef( 1.0f, -1.0f, 1.0f );
|
||||
GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( this.getSpin() * -90.0F, 0, 0, 1 );
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
|
||||
break;
|
||||
|
||||
if( d == AEPartLocation.DOWN )
|
||||
{
|
||||
GL11.glScalef( 1.0f, -1.0f, 1.0f );
|
||||
GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( this.getSpin() * -90.0F, 0, 0, 1 );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( d == AEPartLocation.EAST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if( d == AEPartLocation.WEST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if( d == AEPartLocation.NORTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
}
|
||||
|
||||
if( d == AEPartLocation.SOUTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
// GL11.glPushMatrix();
|
||||
|
||||
try
|
||||
{
|
||||
final ItemStack sis = ais.getItemStack();
|
||||
|
@ -380,8 +382,6 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
}
|
||||
|
||||
// GL11.glPopMatrix();
|
||||
|
||||
GL11.glTranslatef( 0.0f, 0.14f, -0.24f );
|
||||
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
|
||||
|
||||
|
@ -423,7 +423,14 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||
this.configuredItem.setStackSize( fullStack.getStackSize() );
|
||||
}
|
||||
|
||||
this.getHost().markForUpdate();
|
||||
final long stackSize = this.configuredItem.getStackSize();
|
||||
final String humanReadableText = NUMBER_CONVERTER.toWideReadableForm( stackSize );
|
||||
|
||||
if( !humanReadableText.equals( this.lastHumanReadableText ) )
|
||||
{
|
||||
this.lastHumanReadableText = humanReadableText;
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue