Replace the old connected glass renderer with one adapted from Chisel.

I've made modifications to the original system to allow multi-meta CTM, such as between Dynamic Tanks and Dynamic Valves. This also allows texturing with effectively 5 textures, as opposed to the 47 needed previously
This commit is contained in:
Ben Spiers 2014-09-01 04:03:35 +01:00
parent 1ba5665e07
commit 5ae5036e62
66 changed files with 1083 additions and 166 deletions

View file

@ -47,6 +47,7 @@ public class MekanismConfig
public static boolean machineEffects = true; public static boolean machineEffects = true;
public static boolean oldTransmitterRender = false; public static boolean oldTransmitterRender = false;
public static boolean replaceSoundsWhenResuming = true; public static boolean replaceSoundsWhenResuming = true;
public static boolean renderCTM = true;
} }
public static class usage public static class usage

View file

@ -55,6 +55,7 @@ import mekanism.client.render.RenderGlowPanel;
import mekanism.client.render.RenderPartTransmitter; import mekanism.client.render.RenderPartTransmitter;
import mekanism.client.render.RenderTickHandler; import mekanism.client.render.RenderTickHandler;
import mekanism.client.render.block.BasicRenderingHandler; import mekanism.client.render.block.BasicRenderingHandler;
import mekanism.client.render.block.CTMRenderingHandler;
import mekanism.client.render.block.MachineRenderingHandler; import mekanism.client.render.block.MachineRenderingHandler;
import mekanism.client.render.entity.RenderBalloon; import mekanism.client.render.entity.RenderBalloon;
import mekanism.client.render.entity.RenderFlame; import mekanism.client.render.entity.RenderFlame;
@ -174,6 +175,7 @@ public class ClientProxy extends CommonProxy
{ {
public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
public static int CTM_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
@Override @Override
public void loadConfiguration() public void loadConfiguration()
@ -189,6 +191,7 @@ public class ClientProxy extends CommonProxy
client.oldTransmitterRender = Mekanism.configuration.get("client", "OldTransmitterRender", false).getBoolean(); client.oldTransmitterRender = Mekanism.configuration.get("client", "OldTransmitterRender", false).getBoolean();
client.replaceSoundsWhenResuming = Mekanism.configuration.get("client", "ReplaceSoundsWhenResuming", true, client.replaceSoundsWhenResuming = Mekanism.configuration.get("client", "ReplaceSoundsWhenResuming", true,
"If true, will reduce lagging between player sounds. Setting to false will reduce GC load").getBoolean(); "If true, will reduce lagging between player sounds. Setting to false will reduce GC load").getBoolean();
client.renderCTM = Mekanism.configuration.get("client", "Use CTM Renderer", true).getBoolean();
if(Mekanism.configuration.hasChanged()) if(Mekanism.configuration.hasChanged())
Mekanism.configuration.save(); Mekanism.configuration.save();
@ -336,6 +339,7 @@ public class ClientProxy extends CommonProxy
//Register block handlers //Register block handlers
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler()); RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler()); RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
RenderingRegistry.registerBlockHandler(new CTMRenderingHandler());
Mekanism.logger.info("Render registrations complete."); Mekanism.logger.info("Render registrations complete.");
} }

View file

@ -0,0 +1,306 @@
package mekanism.client.render;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
/**
* CTM Logic adapted from Chisel.
* Code licensed under GPLv2
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
public class CTM
{
static int submaps[][] = {
{16, 17, 18, 19},
{16, 9, 18, 13},
{8, 9, 12, 13},
{8, 17, 12, 19},
{16, 9, 6, 15},
{8, 17, 14, 7},
{2, 11, 6, 15},
{8, 9, 14, 15},
{10, 1, 14, 15},
{10, 11, 14, 5},
{0, 11, 4, 15},
{0, 1, 14, 15},
{},
{},
{},
{},
{16, 17, 6, 7},
{16, 9, 6, 5},
{8, 9, 4, 5},
{8, 17, 4, 7},
{2, 11, 18, 13},
{10, 3, 12, 19},
{10, 11, 12, 13},
{10, 3, 14, 7},
{0, 11, 14, 15},
{10, 11, 4, 15},
{10, 11, 4, 5},
{10, 1, 14, 5},
{},
{},
{},
{},
{2, 3, 6, 7},
{2, 1, 6, 5},
{0, 1, 4, 5},
{0, 3, 4, 7},
{2, 11, 6, 5},
{8, 9, 4, 15},
{2, 1, 6, 15},
{8, 9, 14, 5},
{0, 1, 4, 15},
{0, 1, 14, 5},
{10, 1, 4, 15},
{0, 11, 14, 5},
{},
{},
{},
{},
{2, 3, 18, 19},
{2, 1, 18, 13},
{0, 1, 12, 13},
{0, 3, 12, 19},
{10, 1, 12, 13},
{0, 3, 14, 7},
{0, 11, 12, 13},
{10, 3, 4, 7},
{0, 11, 4, 5},
{10, 1, 4, 5},
{10, 11, 14, 15},
{0, 1, 4, 5},
{},
{},
{},
{},
};
public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side, List<Integer> metas)
{
int index = getTexture(world, x, y, z, side, metas);
return submaps[index];
}
public static int getTexture(IBlockAccess world, int x, int y, int z, int side, List<Integer> metas)
{
if(world == null)
return 0;
int texture = 0;
Block block = world.getBlock(x, y, z);
if(metas == null || metas.size() <= 0)
metas = Arrays.asList(world.getBlockMetadata(x, y, z));
boolean b[] = new boolean[6];
if(side <= 1)
{
b[0] = isConnected(world, x - 1, y, z, side, block, metas);
b[1] = isConnected(world, x + 1, y, z, side, block, metas);
b[2] = isConnected(world, x, y, z + 1, side, block, metas);
b[3] = isConnected(world, x, y, z - 1, side, block, metas);
} else if(side == 2)
{
b[0] = isConnected(world, x + 1, y, z, side, block, metas);
b[1] = isConnected(world, x - 1, y, z, side, block, metas);
b[2] = isConnected(world, x, y - 1, z, side, block, metas);
b[3] = isConnected(world, x, y + 1, z, side, block, metas);
} else if(side == 3)
{
b[0] = isConnected(world, x - 1, y, z, side, block, metas);
b[1] = isConnected(world, x + 1, y, z, side, block, metas);
b[2] = isConnected(world, x, y - 1, z, side, block, metas);
b[3] = isConnected(world, x, y + 1, z, side, block, metas);
} else if(side == 4)
{
b[0] = isConnected(world, x, y, z - 1, side, block, metas);
b[1] = isConnected(world, x, y, z + 1, side, block, metas);
b[2] = isConnected(world, x, y - 1, z, side, block, metas);
b[3] = isConnected(world, x, y + 1, z, side, block, metas);
} else if(side == 5)
{
b[0] = isConnected(world, x, y, z + 1, side, block, metas);
b[1] = isConnected(world, x, y, z - 1, side, block, metas);
b[2] = isConnected(world, x, y - 1, z, side, block, metas);
b[3] = isConnected(world, x, y + 1, z, side, block, metas);
}
if(b[0] & !b[1] & !b[2] & !b[3])
texture = 3;
else if(!b[0] & b[1] & !b[2] & !b[3])
texture = 1;
else if(!b[0] & !b[1] & b[2] & !b[3])
texture = 16;
else if(!b[0] & !b[1] & !b[2] & b[3])
texture = 48;
else if(b[0] & b[1] & !b[2] & !b[3])
texture = 2;
else if(!b[0] & !b[1] & b[2] & b[3])
texture = 32;
else if(b[0] & !b[1] & b[2] & !b[3])
texture = 19;
else if(b[0] & !b[1] & !b[2] & b[3])
texture = 51;
else if(!b[0] & b[1] & b[2] & !b[3])
texture = 17;
else if(!b[0] & b[1] & !b[2] & b[3])
texture = 49;
else if(!b[0] & b[1] & b[2] & b[3])
texture = 33;
else if(b[0] & !b[1] & b[2] & b[3])
texture = 35;
else if(b[0] & b[1] & !b[2] & b[3])
texture = 50;
else if(b[0] & b[1] & b[2] & !b[3])
texture = 18;
else if(b[0] & b[1] & b[2] & b[3])
texture = 34;
boolean b2[] = new boolean[6];
if(side <= 1)
{
b2[0] = !isConnected(world, x + 1, y, z + 1, side, block, metas);
b2[1] = !isConnected(world, x - 1, y, z + 1, side, block, metas);
b2[2] = !isConnected(world, x + 1, y, z - 1, side, block, metas);
b2[3] = !isConnected(world, x - 1, y, z - 1, side, block, metas);
} else if(side == 2)
{
b2[0] = !isConnected(world, x - 1, y - 1, z, side, block, metas);
b2[1] = !isConnected(world, x + 1, y - 1, z, side, block, metas);
b2[2] = !isConnected(world, x - 1, y + 1, z, side, block, metas);
b2[3] = !isConnected(world, x + 1, y + 1, z, side, block, metas);
} else if(side == 3)
{
b2[0] = !isConnected(world, x + 1, y - 1, z, side, block, metas);
b2[1] = !isConnected(world, x - 1, y - 1, z, side, block, metas);
b2[2] = !isConnected(world, x + 1, y + 1, z, side, block, metas);
b2[3] = !isConnected(world, x - 1, y + 1, z, side, block, metas);
} else if(side == 4)
{
b2[0] = !isConnected(world, x, y - 1, z + 1, side, block, metas);
b2[1] = !isConnected(world, x, y - 1, z - 1, side, block, metas);
b2[2] = !isConnected(world, x, y + 1, z + 1, side, block, metas);
b2[3] = !isConnected(world, x, y + 1, z - 1, side, block, metas);
} else if(side == 5)
{
b2[0] = !isConnected(world, x, y - 1, z - 1, side, block, metas);
b2[1] = !isConnected(world, x, y - 1, z + 1, side, block, metas);
b2[2] = !isConnected(world, x, y + 1, z - 1, side, block, metas);
b2[3] = !isConnected(world, x, y + 1, z + 1, side, block, metas);
}
if(texture == 17 && b2[0])
texture = 4;
if(texture == 19 && b2[1])
texture = 5;
if(texture == 49 && b2[2])
texture = 20;
if(texture == 51 && b2[3])
texture = 21;
if(texture == 18 && b2[0] && b2[1])
texture = 7;
if(texture == 33 && b2[0] && b2[2])
texture = 6;
if(texture == 35 && b2[3] && b2[1])
texture = 23;
if(texture == 50 && b2[3] && b2[2])
texture = 22;
if(texture == 18 && !b2[0] && b2[1])
texture = 39;
if(texture == 33 && b2[0] && !b2[2])
texture = 38;
if(texture == 35 && !b2[3] && b2[1])
texture = 53;
if(texture == 50 && b2[3] && !b2[2])
texture = 52;
if(texture == 18 && b2[0] && !b2[1])
texture = 37;
if(texture == 33 && !b2[0] && b2[2])
texture = 36;
if(texture == 35 && b2[3] && !b2[1])
texture = 55;
if(texture == 50 && !b2[3] && b2[2])
texture = 54;
if(texture == 34 && b2[0] && b2[1] && b2[2] && b2[3])
texture = 58;
if(texture == 34 && !b2[0] && b2[1] && b2[2] && b2[3])
texture = 9;
if(texture == 34 && b2[0] && !b2[1] && b2[2] && b2[3])
texture = 25;
if(texture == 34 && b2[0] && b2[1] && !b2[2] && b2[3])
texture = 8;
if(texture == 34 && b2[0] && b2[1] && b2[2] && !b2[3])
texture = 24;
if(texture == 34 && b2[0] && b2[1] && !b2[2] && !b2[3])
texture = 11;
if(texture == 34 && !b2[0] && !b2[1] && b2[2] && b2[3])
texture = 26;
if(texture == 34 && !b2[0] && b2[1] && !b2[2] && b2[3])
texture = 27;
if(texture == 34 && b2[0] && !b2[1] && b2[2] && !b2[3])
texture = 10;
if(texture == 34 && b2[0] && !b2[1] && !b2[2] && b2[3])
texture = 42;
if(texture == 34 && !b2[0] && b2[1] && b2[2] && !b2[3])
texture = 43;
if(texture == 34 && b2[0] && !b2[1] && !b2[2] && !b2[3])
texture = 40;
if(texture == 34 && !b2[0] && b2[1] && !b2[2] && !b2[3])
texture = 41;
if(texture == 34 && !b2[0] && !b2[1] && b2[2] && !b2[3])
texture = 56;
if(texture == 34 && !b2[0] && !b2[1] && !b2[2] && b2[3])
texture = 57;
return texture;
}
public static boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, List<Integer> metas)
{
int x2 = x, y2 = y, z2 = z;
switch(side)
{
case 0:
y2--;
break;
case 1:
y2++;
break;
case 2:
z2--;
break;
case 3:
z2++;
break;
case 4:
x2--;
break;
case 5:
x2++;
break;
}
int meta = world.getBlockMetadata(x, y, z);
int meta2 = world.getBlockMetadata(x2, y2, z2);
boolean validMeta = metas.contains(meta);
boolean validMeta2 = metas.contains(meta2);
return world.getBlock(x, y, z).equals(block) && validMeta && !(world.getBlock(x2, y2, z2).equals(block) && validMeta2);
}
}

View file

@ -0,0 +1,67 @@
package mekanism.client.render.block;
import mekanism.api.MekanismConfig;
import mekanism.client.ClientProxy;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.CTMData;
import mekanism.common.base.IBlockCTM;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
* CTM ISBRH adapted from Chisel
* Code licensed under GPLv2
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
public class CTMRenderingHandler implements ISimpleBlockRenderingHandler
{
RenderBlocksCTM rendererCTM = new RenderBlocksCTM();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
MekanismRenderer.renderItem(renderer, metadata, block);
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld)
{
int meta = world.getBlockMetadata(x, y, z);
CTMData blockCTM = ((IBlockCTM)block).getCTMData(meta);
if(MekanismConfig.client.renderCTM && blockCTM != null)
{
rendererCTM.blockAccess = world;
rendererCTM.renderMaxX = 1.0;
rendererCTM.renderMaxY = 1.0;
rendererCTM.renderMaxZ = 1.0;
rendererCTM.submap = blockCTM.submap;
rendererCTM.submapSmall = blockCTM.submapSmall;
rendererCTM.metas = blockCTM.acceptableMetas;
rendererCTM.rendererOld = rendererOld;
return rendererCTM.renderStandardBlock(block, x, y, z);
}
return rendererOld.renderStandardBlock(block, x, y, z);
}
@Override
public boolean shouldRender3DInInventory(int renderId)
{
return true;
}
@Override
public int getRenderId()
{
return ClientProxy.CTM_RENDER_ID;
}
}

View file

@ -0,0 +1,387 @@
package mekanism.client.render.block;
import java.util.List;
import mekanism.client.render.CTM;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
/**
* CTM RenderBlocks adapted from Chisel
* Code licensed under GPLv2
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
public class RenderBlocksCTM extends RenderBlocks
{
RenderBlocksCTM()
{
super();
resetVertices();
}
Tessellator tessellator;
double[] X = new double[26];
double[] Y = new double[26];
double[] Z = new double[26];
double[] U = new double[26];
double[] V = new double[26];
int[] L = new int[26];
float[] R = new float[26];
float[] G = new float[26];
float[] B = new float[26];
TextureSubmap submap;
TextureSubmap submapSmall;
RenderBlocks rendererOld;
List<Integer> metas;
int bx, by, bz;
@Override
public boolean renderStandardBlock(Block block, int x, int y, int z)
{
bx = x;
by = y;
bz = z;
tessellator = Tessellator.instance;
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
tessellator.addTranslation(x, y, z);
boolean res = super.renderStandardBlock(block, x, y, z);
tessellator.addTranslation(-x, -y, -z);
return res;
}
void setupSides(int a, int b, int c, int d, int xa, int xb, int xc, int xd, int e)
{
L[a] = brightnessBottomLeft;
L[b] = brightnessBottomRight;
L[c] = brightnessTopRight;
L[d] = brightnessTopLeft;
L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4;
L[xa] = (L[a] + L[b]) / 2;
L[xb] = (L[b] + L[c]) / 2;
L[xc] = (L[c] + L[d]) / 2;
L[xd] = (L[d] + L[a]) / 2;
R[a] = colorRedBottomLeft;
R[b] = colorRedBottomRight;
R[c] = colorRedTopRight;
R[d] = colorRedTopLeft;
R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4;
R[xa] = (R[a] + R[b]) / 2;
R[xb] = (R[b] + R[c]) / 2;
R[xc] = (R[c] + R[d]) / 2;
R[xd] = (R[d] + R[a]) / 2;
G[a] = colorGreenBottomLeft;
G[b] = colorGreenBottomRight;
G[c] = colorGreenTopRight;
G[d] = colorGreenTopLeft;
G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4;
G[xa] = (G[a] + G[b]) / 2;
G[xb] = (G[b] + G[c]) / 2;
G[xc] = (G[c] + G[d]) / 2;
G[xd] = (G[d] + G[a]) / 2;
B[a] = colorBlueBottomLeft;
B[b] = colorBlueBottomRight;
B[c] = colorBlueTopRight;
B[d] = colorBlueTopLeft;
B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4;
B[xa] = (B[a] + B[b]) / 2;
B[xb] = (B[b] + B[c]) / 2;
B[xc] = (B[c] + B[d]) / 2;
B[xd] = (B[d] + B[a]) / 2;
}
void side(int a, int b, int c, int d, int iconIndex, boolean flip)
{
IIcon icon = iconIndex >= 16 ? submapSmall.icons[iconIndex - 16] : submap.icons[iconIndex];
double u0 = icon.getMaxU();
double u1 = icon.getMinU();
double v0 = icon.getMaxV();
double v1 = icon.getMinV();
U[a] = flip ? u1 : u1;
U[b] = flip ? u0 : u1;
U[c] = flip ? u0 : u0;
U[d] = flip ? u1 : u0;
V[a] = flip ? v1 : v1;
V[b] = flip ? v1 : v0;
V[c] = flip ? v0 : v0;
V[d] = flip ? v0 : v1;
vert(a);
vert(b);
vert(c);
vert(d);
}
void vert(int index)
{
if(enableAO)
{
tessellator.setColorOpaque_F(R[index], G[index], B[index]);
tessellator.setBrightness(L[index]);
}
tessellator.addVertexWithUV(X[index], Y[index], Z[index], U[index], V[index]);
}
@Override
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon)
{
if(rendererOld != null && rendererOld.hasOverrideBlockTexture())
{
IIcon i = rendererOld.overrideBlockTexture;
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
} else
{
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 4, metas);
setupSides(1, 0, 4, 5, 14, 19, 17, 23, 9);
side(1, 14, 9, 23, tex[0], false);
side(23, 9, 17, 5, tex[1], false);
side(9, 19, 4, 17, tex[3], false);
side(14, 0, 19, 9, tex[2], false);
}
}
@Override
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon)
{
if(rendererOld != null && rendererOld.hasOverrideBlockTexture())
{
IIcon i = rendererOld.overrideBlockTexture;
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMinU(), i.getMinV());
} else
{
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 5, metas);
setupSides(3, 2, 6, 7, 15, 25, 16, 21, 11);
side(11, 21, 3, 15, tex[3], false);
side(16, 7, 21, 11, tex[2], false);
side(25, 11, 15, 2, tex[1], false);
side(6, 16, 11, 25, tex[0], false);
}
}
@Override
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon)
{
if(rendererOld != null && rendererOld.hasOverrideBlockTexture())
{
IIcon i = rendererOld.overrideBlockTexture;
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV());
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMaxV());
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
} else
{
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 2, metas);
setupSides(2, 3, 0, 1, 15, 18, 14, 22, 8);
side(2, 15, 8, 22, tex[0], false);
side(15, 3, 18, 8, tex[2], false);
side(8, 18, 0, 14, tex[3], false);
side(22, 8, 14, 1, tex[1], false);
}
}
@Override
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon)
{
if(rendererOld != null && rendererOld.hasOverrideBlockTexture())
{
IIcon i = rendererOld.overrideBlockTexture;
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMinV());
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV());
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
} else
{
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 3, metas);
setupSides(4, 7, 6, 5, 20, 16, 24, 17, 10);
side(17, 4, 20, 10, tex[2], false);
side(5, 17, 10, 24, tex[0], false);
side(24, 10, 16, 6, tex[1], false);
side(10, 20, 7, 16, tex[3], false);
}
}
@Override
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon)
{
if(rendererOld != null && rendererOld.hasOverrideBlockTexture())
{
IIcon i = rendererOld.overrideBlockTexture;
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV());
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMinV());
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV());
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
} else
{
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 0, metas);
setupSides(0, 3, 7, 4, 18, 21, 20, 19, 13);
side(13, 21, 7, 20, tex[3], true);
side(19, 13, 20, 4, tex[2], true);
side(0, 18, 13, 19, tex[0], true);
side(18, 3, 21, 13, tex[1], true);
}
}
@Override
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon)
{
if(rendererOld != null && rendererOld.hasOverrideBlockTexture())
{
IIcon i = rendererOld.overrideBlockTexture;
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMaxV());
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV());
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV());
} else
{
int tex[] = CTM.getSubmapIndices(blockAccess, bx, by, bz, 1, metas);
setupSides(2, 1, 5, 6, 22, 23, 24, 25, 12);
side(12, 24, 6, 25, tex[3], false);
side(22, 12, 25, 2, tex[1], false);
side(1, 23, 12, 22, tex[0], false);
side(23, 5, 24, 12, tex[2], false);
}
}
void resetVertices()
{
X[0] = 0;
Z[0] = 0;
Y[0] = 0;
X[1] = 0;
Z[1] = 0;
Y[1] = 1;
X[2] = 1;
Z[2] = 0;
Y[2] = 1;
X[3] = 1;
Z[3] = 0;
Y[3] = 0;
X[4] = 0;
Z[4] = 1;
Y[4] = 0;
X[5] = 0;
Z[5] = 1;
Y[5] = 1;
X[6] = 1;
Z[6] = 1;
Y[6] = 1;
X[7] = 1;
Z[7] = 1;
Y[7] = 0;
X[8] = 0.5;
Z[8] = 0;
Y[8] = 0.5;
X[9] = 0;
Z[9] = 0.5;
Y[9] = 0.5;
X[10] = 0.5;
Z[10] = 1;
Y[10] = 0.5;
X[11] = 1;
Z[11] = 0.5;
Y[11] = 0.5;
X[12] = 0.5;
Z[12] = 0.5;
Y[12] = 1;
X[13] = 0.5;
Z[13] = 0.5;
Y[13] = 0;
X[14] = 0;
Z[14] = 0;
Y[14] = 0.5;
X[15] = 1;
Z[15] = 0;
Y[15] = 0.5;
X[16] = 1;
Z[16] = 1;
Y[16] = 0.5;
X[17] = 0;
Z[17] = 1;
Y[17] = 0.5;
X[18] = 0.5;
Z[18] = 0;
Y[18] = 0;
X[19] = 0;
Z[19] = 0.5;
Y[19] = 0;
X[20] = 0.5;
Z[20] = 1;
Y[20] = 0;
X[21] = 1;
Z[21] = 0.5;
Y[21] = 0;
X[22] = 0.5;
Z[22] = 0;
Y[22] = 1;
X[23] = 0;
Z[23] = 0.5;
Y[23] = 1;
X[24] = 0.5;
Z[24] = 1;
Y[24] = 1;
X[25] = 1;
Z[25] = 0.5;
Y[25] = 1;
}
}

View file

@ -0,0 +1,42 @@
package mekanism.client.render.block;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
/**
* Multi-texture class adapted from Chisel
* Code licensed under GPLv2
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
public class TextureSubmap
{
public int width, height;
public IIcon icon;
public IIcon icons[];
public TextureSubmap(IIcon i, int w, int h)
{
icon = i;
width = w;
height = h;
icons = new IIcon[width * height];
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void TexturesStitched(TextureStitchEvent.Post event)
{
for(int x = 0; x < width; x++)
{
for(int y = 0; y < height; y++)
{
icons[y * width + x] = new TextureVirtual(icon, width, height, x, y);
}
}
}
}

View file

@ -0,0 +1,97 @@
package mekanism.client.render.block;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Texture component class adapted from Chisel
* Code licensed under GPLv2
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
public class TextureVirtual implements IIcon
{
int ox, oy;
float u0, u1, v0, v1;
String name;
IIcon icon;
TextureVirtual(IIcon parent, int w, int h, int x, int y)
{
icon = parent;
u0 = icon.getInterpolatedU(16.0 * (x) / w);
u1 = icon.getInterpolatedU(16.0 * (x + 1) / w);
v0 = icon.getInterpolatedV(16.0 * (y) / h);
v1 = icon.getInterpolatedV(16.0 * (y + 1) / h);
name = icon.getIconName() + "|" + x + "." + y;
ox = icon.getIconWidth();
oy = icon.getIconHeight();
}
@Override
@SideOnly(Side.CLIENT)
public float getMinU()
{
return u0;
}
@Override
@SideOnly(Side.CLIENT)
public float getMaxU()
{
return u1;
}
@Override
@SideOnly(Side.CLIENT)
public float getInterpolatedU(double d0)
{
return (float) (u0 + (u1 - u0) * d0 / 16.0);
}
@Override
@SideOnly(Side.CLIENT)
public float getMinV()
{
return v0;
}
@Override
@SideOnly(Side.CLIENT)
public float getMaxV()
{
return v1;
}
@Override
@SideOnly(Side.CLIENT)
public float getInterpolatedV(double d0)
{
return (float) (v0 + (v1 - v0) * d0 / 16.0);
}
@Override
@SideOnly(Side.CLIENT)
public String getIconName()
{
return name;
}
@Override
@SideOnly(Side.CLIENT)
public int getIconWidth()
{
return ox;
}
@Override
@SideOnly(Side.CLIENT)
public int getIconHeight()
{
return oy;
}
}

View file

@ -0,0 +1,47 @@
package mekanism.common;
import java.util.List;
import mekanism.api.Coord4D;
import mekanism.client.render.block.TextureSubmap;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CTMData
{
public IIcon icon;
public TextureSubmap submap;
public TextureSubmap submapSmall;
public String texture;
public List<Integer> acceptableMetas;
public CTMData(String textureName, List<Integer> connectableMeta)
{
texture = textureName;
acceptableMetas = connectableMeta;
}
public void registerIcons(IIconRegister register)
{
icon = register.registerIcon("mekanism:" + texture);
submap = new TextureSubmap(register.registerIcon("mekanism:" + texture + "-ctm"), 4, 4);
submapSmall = new TextureSubmap(icon, 2, 2);
}
@SideOnly(Side.CLIENT)
public boolean shouldRenderSide(IBlockAccess world, int x, int y, int z, int side, Block block)
{
Coord4D obj = new Coord4D(x, y, z);
return !(obj.getBlock(world).equals(block) && acceptableMetas.contains(obj.getMetadata(world)));
}
}

View file

@ -1,127 +0,0 @@
package mekanism.common;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mekanism.api.Coord4D;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ConnectedTextureRenderer
{
public static final byte[][] sideEdges = {{2, 5, 3, 4}, {2, 5, 3, 4}, {1, 4, 0, 5}, {1, 5, 0, 4}, {1, 3, 0, 2}, {1, 2, 0, 3}};
public Block block;
public List<Integer> metadata;
public String iconTitle;
public Map<Integer, IIcon> glassMap = new HashMap<Integer, IIcon>();
public ConnectedTextureRenderer(String title, Block b, List<Integer> meta)
{
iconTitle = title;
block = b;
metadata = meta;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister register)
{
glassMap.put(0, register.registerIcon("mekanism:" + iconTitle + "_13"));
glassMap.put(1, register.registerIcon("mekanism:" + iconTitle + "_20"));
glassMap.put(4, register.registerIcon("mekanism:" + iconTitle + "_19"));
glassMap.put(5, register.registerIcon("mekanism:" + iconTitle + "_23"));
glassMap.put(7, register.registerIcon("mekanism:" + iconTitle + "_1"));
glassMap.put(16, register.registerIcon("mekanism:" + iconTitle + "_7"));
glassMap.put(17, register.registerIcon("mekanism:" + iconTitle + "_35"));
glassMap.put(20, register.registerIcon("mekanism:" + iconTitle + "_40"));
glassMap.put(21, register.registerIcon("mekanism:" + iconTitle + "_21"));
glassMap.put(23, register.registerIcon("mekanism:" + iconTitle + "_31"));
glassMap.put(28, register.registerIcon("mekanism:" + iconTitle + "_14"));
glassMap.put(29, register.registerIcon("mekanism:" + iconTitle + "_45"));
glassMap.put(31, register.registerIcon("mekanism:" + iconTitle + "_2"));
glassMap.put(64, register.registerIcon("mekanism:" + iconTitle + "_8"));
glassMap.put(65, register.registerIcon("mekanism:" + iconTitle + "_41"));
glassMap.put(68, register.registerIcon("mekanism:" + iconTitle + "_46"));
glassMap.put(69, register.registerIcon("mekanism:" + iconTitle + "_22"));
glassMap.put(71, register.registerIcon("mekanism:" + iconTitle + "_32"));
glassMap.put(80, register.registerIcon("mekanism:" + iconTitle + "_11"));
glassMap.put(81, register.registerIcon("mekanism:" + iconTitle + "_10"));
glassMap.put(84, register.registerIcon("mekanism:" + iconTitle + "_9"));
glassMap.put(85, register.registerIcon("mekanism:" + iconTitle + "_17"));
glassMap.put(87, register.registerIcon("mekanism:" + iconTitle + "_5"));
glassMap.put(92, register.registerIcon("mekanism:" + iconTitle + "_34"));
glassMap.put(93, register.registerIcon("mekanism:" + iconTitle + "_18"));
glassMap.put(95, register.registerIcon("mekanism:" + iconTitle + "_6"));
glassMap.put(112, register.registerIcon("mekanism:" + iconTitle + "_25"));
glassMap.put(113, register.registerIcon("mekanism:" + iconTitle + "_43"));
glassMap.put(116, register.registerIcon("mekanism:" + iconTitle + "_42"));
glassMap.put(117, register.registerIcon("mekanism:" + iconTitle + "_29"));
glassMap.put(119, register.registerIcon("mekanism:" + iconTitle + "_37"));
glassMap.put(124, register.registerIcon("mekanism:" + iconTitle + "_26"));
glassMap.put(125, register.registerIcon("mekanism:" + iconTitle + "_30"));
glassMap.put(127, register.registerIcon("mekanism:" + iconTitle + "_38"));
glassMap.put(193, register.registerIcon("mekanism:" + iconTitle + "_12"));
glassMap.put(197, register.registerIcon("mekanism:" + iconTitle + "_44"));
glassMap.put(199, register.registerIcon("mekanism:" + iconTitle + "_0"));
glassMap.put(209, register.registerIcon("mekanism:" + iconTitle + "_33"));
glassMap.put(213, register.registerIcon("mekanism:" + iconTitle + "_16"));
glassMap.put(215, register.registerIcon("mekanism:" + iconTitle + "_4"));
glassMap.put(221, register.registerIcon("mekanism:" + iconTitle + "_15"));
glassMap.put(223, register.registerIcon("mekanism:" + iconTitle + "_3"));
glassMap.put(241, register.registerIcon("mekanism:" + iconTitle + "_24"));
glassMap.put(245, register.registerIcon("mekanism:" + iconTitle + "_28"));
glassMap.put(247, register.registerIcon("mekanism:" + iconTitle + "_36"));
glassMap.put(253, register.registerIcon("mekanism:" + iconTitle + "_27"));
glassMap.put(255, register.registerIcon("mekanism:" + iconTitle + "_39"));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
{
int map = 0;
for(int face = 0; face < 4; face++)
{
int side0 = sideEdges[side][((face + 3) % 4)];
int side1 = sideEdges[side][face];
if(!canConnect(world, new Coord4D(x, y, z), sideEdges[side][face], side))
{
map |= (7 << face * 2) % 256 | 7 >>> 8 - face * 2;
}
else if(!canConnect(world, new Coord4D(x, y, z).getFromSide(ForgeDirection.getOrientation(side0)), side1, side))
{
map |= 1 << face * 2;
}
else if(!canConnect(world, new Coord4D(x, y, z).getFromSide(ForgeDirection.getOrientation(side1)), side0, side))
{
map |= 1 << face * 2;
}
}
return glassMap.get(map);
}
private boolean canConnect(IBlockAccess access, Coord4D obj, int side, int face)
{
Coord4D coord = obj.getFromSide(ForgeDirection.getOrientation(side));
Coord4D coordAbove = obj.getFromSide(ForgeDirection.getOrientation(face));
return (coord.getBlock(access) == block && metadata.contains(coord.getMetadata(access))) && (coordAbove.getBlock(access) != block || metadata.contains(coordAbove.getMetadata(access)));
}
@SideOnly(Side.CLIENT)
public boolean shouldRenderSide(IBlockAccess world, int x, int y, int z, int side)
{
Coord4D obj = new Coord4D(x, y, z).getFromSide(ForgeDirection.getOrientation(side).getOpposite());
return obj.getBlock(world) != block || !metadata.contains(obj.getMetadata(world));
}
}

View file

@ -0,0 +1,8 @@
package mekanism.common.base;
import mekanism.common.CTMData;
public interface IBlockCTM
{
public CTMData getCTMData(int meta);
}

View file

@ -8,7 +8,8 @@ import java.util.Random;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.Range4D; import mekanism.api.Range4D;
import mekanism.client.ClientProxy; import mekanism.client.ClientProxy;
import mekanism.common.ConnectedTextureRenderer; import mekanism.common.base.IBlockCTM;
import mekanism.common.CTMData;
import mekanism.common.ItemAttacher; import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks; import mekanism.common.MekanismBlocks;
@ -72,11 +73,13 @@ import cpw.mods.fml.relauncher.SideOnly;
* @author AidanBrady * @author AidanBrady
* *
*/ */
public class BlockBasic extends Block public class BlockBasic extends Block implements IBlockCTM
{ {
public IIcon[][] icons = new IIcon[256][6]; public IIcon[][] icons = new IIcon[256][6];
public ConnectedTextureRenderer glassRenderer = new ConnectedTextureRenderer("glass/DynamicGlass", this, Arrays.asList(10)); public CTMData dynamicTankCTM = new CTMData("ctm/DynamicTank", Arrays.asList(9, 11));
public CTMData dynamicGlassCTM = new CTMData("ctm/DynamicGlass",Arrays.asList(10));
public CTMData dynamicValveCTM = new CTMData("ctm/DynamicValve", Arrays.asList(11, 9));
public BlockBasic() public BlockBasic()
{ {
@ -134,7 +137,9 @@ public class BlockBasic extends Block
icons[14][2] = register.registerIcon("mekanism:SalinationBlock"); icons[14][2] = register.registerIcon("mekanism:SalinationBlock");
icons[15][0] = register.registerIcon("mekanism:SalinationValve"); icons[15][0] = register.registerIcon("mekanism:SalinationValve");
glassRenderer.registerIcons(register); dynamicTankCTM.registerIcons(register);
dynamicGlassCTM.registerIcons(register);
dynamicValveCTM.registerIcons(register);
} }
else if(this == MekanismBlocks.BasicBlock2) else if(this == MekanismBlocks.BasicBlock2)
{ {
@ -150,40 +155,42 @@ public class BlockBasic extends Block
if(this == MekanismBlocks.BasicBlock) if(this == MekanismBlocks.BasicBlock)
{ {
if(metadata == 6) switch(metadata)
{ {
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z); case 6:
TileEntityBasicBlock tileEntity6 = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
if(side == 0 || side == 1) if(side == 0 || side == 1)
{ {
return MekanismUtils.isActive(world, x, y, z) ? icons[6][3] : icons[6][1]; return MekanismUtils.isActive(world, x, y, z) ? icons[6][3] : icons[6][1];
} }
else if(side == tileEntity.facing) else if(side == tileEntity6.facing)
{ {
return MekanismUtils.isActive(world, x, y, z) ? icons[6][4] : icons[6][2]; return MekanismUtils.isActive(world, x, y, z) ? icons[6][4] : icons[6][2];
} }
else { else
return icons[6][0]; {
} return icons[6][0];
} }
else if(metadata == 10) case 9:
{ return dynamicTankCTM.icon;
return glassRenderer.getIcon(world, x, y, z, side); case 10:
} return dynamicGlassCTM.icon;
else if(metadata == 14) case 11:
{ return dynamicValveCTM.icon;
TileEntitySalinationController tileEntity = (TileEntitySalinationController)world.getTileEntity(x, y, z); case 14:
TileEntitySalinationController tileEntity14 = (TileEntitySalinationController)world.getTileEntity(x, y, z);
if(side == tileEntity.facing) if(side == tileEntity14.facing)
{ {
return tileEntity.structured ? icons[14][1] : icons[14][0]; return tileEntity14.structured ? icons[14][1] : icons[14][0];
} }
else { else
return icons[14][2]; {
} return icons[14][2];
} }
else { default:
return getIcon(side, metadata); return getIcon(side, metadata);
} }
} }
else if(this == MekanismBlocks.BasicBlock2) else if(this == MekanismBlocks.BasicBlock2)
@ -583,7 +590,7 @@ public class BlockBasic extends Block
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getRenderType() public int getRenderType()
{ {
return ClientProxy.BASIC_RENDER_ID; return ClientProxy.CTM_RENDER_ID;
} }
@Override @Override
@ -795,9 +802,10 @@ public class BlockBasic extends Block
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side)
{ {
if(this == MekanismBlocks.BasicBlock && world.getBlockMetadata(x, y, z) == 10) Coord4D obj = new Coord4D(x, y, z).getFromSide(ForgeDirection.getOrientation(side).getOpposite());
if(this == MekanismBlocks.BasicBlock && obj.getMetadata(world) == 10)
{ {
return glassRenderer.shouldRenderSide(world, x, y, z, side); return dynamicGlassCTM.shouldRenderSide(world, x, y, z, side, this);
} }
else { else {
return super.shouldSideBeRendered(world, x, y, z, side); return super.shouldSideBeRendered(world, x, y, z, side);
@ -843,4 +851,22 @@ public class BlockBasic extends Block
return false; return false;
} }
@Override
public CTMData getCTMData(int meta)
{
if(this == MekanismBlocks.BasicBlock)
{
switch(meta)
{
case 9:
return dynamicTankCTM;
case 10:
return dynamicGlassCTM;
case 11:
return dynamicValveCTM;
}
}
return null;
}
} }

View file

@ -1,10 +1,16 @@
package mekanism.generators.common.block; package mekanism.generators.common.block;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import mekanism.api.Coord4D;
import mekanism.client.ClientProxy;
import mekanism.common.CTMData;
import mekanism.common.ItemAttacher; import mekanism.common.ItemAttacher;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.base.IBlockCTM;
import mekanism.common.tile.TileEntityBasicBlock; import mekanism.common.tile.TileEntityBasicBlock;
import mekanism.common.tile.TileEntityElectricBlock; import mekanism.common.tile.TileEntityElectricBlock;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
@ -29,15 +35,21 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.tools.IToolWrench; import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.ModAPIManager; import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockReactor extends BlockContainer public class BlockReactor extends BlockContainer implements IBlockCTM
{ {
public IIcon[][] icons = new IIcon[16][16]; public IIcon[][] icons = new IIcon[16][16];
public CTMData reactorGlassCTM = new CTMData("ctm/ReactorGlass", Arrays.asList(0, 1));
public CTMData reactorLaserFocusCTM = new CTMData("ctm/ReactorLaserFocus", Arrays.asList(1, 0));
public BlockReactor() public BlockReactor()
{ {
super(Material.iron); super(Material.iron);
@ -63,6 +75,9 @@ public class BlockReactor extends BlockContainer
{ {
icons[0][0] = register.registerIcon("mekanism:ReactorGlass"); icons[0][0] = register.registerIcon("mekanism:ReactorGlass");
icons[1][0] = register.registerIcon("mekanism:ReactorLaserFocus"); icons[1][0] = register.registerIcon("mekanism:ReactorLaserFocus");
reactorGlassCTM.registerIcons(register);
reactorLaserFocusCTM.registerIcons(register);
} }
} }
@ -253,6 +268,12 @@ public class BlockReactor extends BlockContainer
return this == GeneratorsBlocks.Reactor ? 0 : 1; return this == GeneratorsBlocks.Reactor ? 0 : 1;
} }
@Override
public int getRenderType()
{
return ClientProxy.CTM_RENDER_ID;
}
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
@ -280,6 +301,44 @@ public class BlockReactor extends BlockContainer
return null; return null;
} }
@Override
public CTMData getCTMData(int meta)
{
if(this == GeneratorsBlocks.ReactorGlass)
{
switch(meta)
{
case 0:
return reactorGlassCTM;
case 1:
return reactorLaserFocusCTM;
}
}
return null;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side)
{
Coord4D obj = new Coord4D(x, y, z).getFromSide(ForgeDirection.getOrientation(side).getOpposite());
if(this == GeneratorsBlocks.ReactorGlass)
{
switch(obj.getMetadata(world))
{
case 0:
return reactorGlassCTM.shouldRenderSide(world, x, y, z, side, this);
case 1:
return reactorLaserFocusCTM.shouldRenderSide(world, x, y, z, side, this);
default:
return super.shouldSideBeRendered(world, x, y, z, side);
}
}
else {
return super.shouldSideBeRendered(world, x, y, z, side);
}
}
public static enum ReactorBlockType public static enum ReactorBlockType
{ {
CONTROLLER(GeneratorsBlocks.Reactor, 0, "ReactorController", 10, TileEntityReactorController.class), CONTROLLER(GeneratorsBlocks.Reactor, 0, "ReactorController", 10, TileEntityReactorController.class),

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB