Reimplemented cable and parts rendering.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package appeng.tile.networking;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class CableBusTESR extends TileEntitySpecialRenderer<AEBaseTile>
|
||||
{
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt( AEBaseTile te, double x, double y, double z, float partialTicks, int destroyStage )
|
||||
{
|
||||
|
||||
if( !( te instanceof TileCableBusTESR ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileCableBusTESR realTe = (TileCableBusTESR) te;
|
||||
|
||||
for( EnumFacing facing : EnumFacing.values() )
|
||||
{
|
||||
IPart part = realTe.getPart( facing );
|
||||
if( part != null && part.requireDynamicRender() )
|
||||
{
|
||||
part.renderDynamic( x, y, z, partialTicks, destroyStage );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.helpers.AEMultiTile;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.hooks.TickHandler;
|
||||
@@ -89,9 +90,30 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
this.worldObj.checkLight( this.pos );
|
||||
}
|
||||
|
||||
this.updateTileSetting();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes this tile to the TESR version if any of the parts require dynamic rendering.
|
||||
*/
|
||||
protected void updateTileSetting()
|
||||
{
|
||||
if( this.getCableBus().isRequiresDynamicRender() )
|
||||
{
|
||||
try
|
||||
{
|
||||
final TileCableBus tcb = (TileCableBus) BlockCableBus.getTesrTile().newInstance();
|
||||
tcb.copyFrom( this );
|
||||
this.getWorld().setTileEntity( pos, tcb );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void copyFrom( final TileCableBus oldTile )
|
||||
{
|
||||
final CableBusContainer tmpCB = this.getCableBus();
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package appeng.tile.networking;
|
||||
|
||||
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
|
||||
|
||||
public class TileCableBusTESR extends TileCableBus
|
||||
{
|
||||
|
||||
/**
|
||||
* Changes this tile to the non-TESR version, if none of the parts require dynamic rendering.
|
||||
*/
|
||||
@Override
|
||||
protected void updateTileSetting()
|
||||
{
|
||||
if( !this.getCableBus().isRequiresDynamicRender() )
|
||||
{
|
||||
try
|
||||
{
|
||||
final TileCableBus tcb = (TileCableBus) BlockCableBus.getNoTesrTile().newInstance();
|
||||
tcb.copyFrom( this );
|
||||
this.getWorld().setTileEntity( pos, tcb );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user