Merge pull request #511 from thatsIch/b-361-assembler

Try to catch assemblers being build too high or low for ChunkCache
This commit is contained in:
thatsIch 2014-12-02 22:38:39 +01:00
commit 9fae9d1ec0

View file

@ -18,6 +18,7 @@
package appeng.client.render.blocks;
import java.util.EnumSet;
import net.minecraft.client.renderer.RenderBlocks;
@ -28,6 +29,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.IGridHost;
import appeng.api.parts.IBoxProvider;
import appeng.api.parts.IPart;
@ -48,9 +50,12 @@ import appeng.util.Platform;
public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvider
{
IIcon getConnectedCable(IBlockAccess world, int x, int y, int z, ForgeDirection d, boolean covered)
IIcon getConnectedCable(IBlockAccess world, int x, int y, int z, ForgeDirection side, boolean covered)
{
TileEntity ne = world.getTileEntity( x + d.offsetX, y + d.offsetY, z + d.offsetZ );
final int tileYPos = y + side.offsetY;
if ( -1 < tileYPos && tileYPos < 256 )
{
TileEntity ne = world.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
if ( ne instanceof IGridHost && ne instanceof IPartHost )
{
IPartHost ph = (IPartHost) ne;
@ -58,7 +63,7 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
if ( pcx instanceof PartCable )
{
PartCable pc = (PartCable) pcx;
if ( pc.isConnected( d.getOpposite() ) )
if ( pc.isConnected( side.getOpposite() ) )
{
if ( covered )
return pc.getCoveredTexture( pc.getCableColor() );
@ -66,6 +71,7 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
}
}
}
}
return null;
}