Fix telepad rendering with breaking animation

This commit is contained in:
tterrag1098 committed 2015-05-13 14:34:31 -04:00
1 parent 72bf5832e0
commit efb13d1923
2 files changed
+30 -8

No files matched your search

@@ -9,12 +9,14 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.model.obj.GroupObject;
import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.collect.Lists;
import crazypants.render.CubeRenderer;
import crazypants.render.TechneModelRenderer;
import crazypants.render.TechneUtil;
import crazypants.util.BlockCoord;
public class TelePadRenderer extends TechneModelRenderer {
@@ -37,21 +39,41 @@ public class TelePadRenderer extends TechneModelRenderer {
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
TileTelePad te = (TileTelePad) world.getTileEntity(x, y, z);
IIcon cached = renderer.overrideBlockTexture;
boolean ret = true;
if(te.inNetwork()) {
renderer.overrideBlockTexture = null;
if(te.isMaster()) {
super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
if (te.inNetwork()) {
if (renderer.hasOverrideBlockTexture()) {
IIcon icon = renderer.overrideBlockTexture;
renderer.renderFaceYNeg(block, x, y, z, icon);
renderer.renderFaceYPos(block, x, y, z, icon);
BlockCoord bc = te.getLocation();
if (!isTelepad(world, bc, ForgeDirection.EAST)) {
renderer.renderFaceXPos(block, x, y, z, icon);
}
if (!isTelepad(world, bc, ForgeDirection.WEST)) {
renderer.renderFaceXNeg(block, x, y, z, icon);
}
if (!isTelepad(world, bc, ForgeDirection.SOUTH)) {
renderer.renderFaceZPos(block, x, y, z, icon);
}
if (!isTelepad(world, bc, ForgeDirection.NORTH)) {
renderer.renderFaceZNeg(block, x, y, z, icon);
}
} else {
ret = false;
if (te.isMaster()) {
super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
} else {
ret = false;
}
}
} else {
renderer.renderStandardBlock(block, x, y, z);
}
renderer.overrideBlockTexture = cached;
return ret;
}
private boolean isTelepad(IBlockAccess world, BlockCoord pos, ForgeDirection dir) {
return pos.getLocation(dir).getTileEntity(world) instanceof TileTelePad;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
@@ -49,7 +49,7 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei
private boolean inNetwork;
private EnumSet<ForgeDirection> connections = EnumSet.noneOf(ForgeDirection.class);
EnumSet<ForgeDirection> connections = EnumSet.noneOf(ForgeDirection.class);
private EnergyStorage energy = new EnergyStorage(100000, 1000, 1000);