mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-18 19:49:12 +00:00
The great format and clean up. IMPORTANT: Read below.
All devs and contributors should use the provided formatter settings. If your IDE does not support the format, the rules are simple, it is the default java formatting rules, with 200char line lengths and 1 extra line after class definitions.
This commit is contained in:
1 parent
06c5f5930f
commit
82792ed22e
136 files changed
+10365
-11272
No files matched your search
+49
-56
@@ -15,74 +15,67 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockAdvancedMarbleRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public RenderBlocksCTM rendererCTM = new RenderBlocksCTM();
|
||||
RenderBlocksColumn rendererColumn = new RenderBlocksColumn();
|
||||
public class BlockAdvancedMarbleRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockAdvancedMarbleRenderer()
|
||||
{
|
||||
if(Chisel.RenderCTMId == 0)
|
||||
{
|
||||
Chisel.RenderCTMId = RenderingRegistry.getNextAvailableRenderId();
|
||||
public RenderBlocksCTM rendererCTM = new RenderBlocksCTM();
|
||||
RenderBlocksColumn rendererColumn = new RenderBlocksColumn();
|
||||
|
||||
}
|
||||
}
|
||||
public BlockAdvancedMarbleRenderer() {
|
||||
if (Chisel.RenderCTMId == 0) {
|
||||
Chisel.RenderCTMId = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
CarvableVariation var = ((ICarvable) block).getVariation(meta);
|
||||
@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);
|
||||
|
||||
switch(var == null ? 0 : var.kind)
|
||||
{
|
||||
case CarvableHelper.CTMX:
|
||||
rendererCTM.blockAccess = world;
|
||||
rendererCTM.renderMaxX = 1.0;
|
||||
rendererCTM.renderMaxY = 1.0;
|
||||
rendererCTM.renderMaxZ = 1.0;
|
||||
CarvableVariation var = ((ICarvable) block).getVariation(meta);
|
||||
|
||||
rendererCTM.submap = var.submap;
|
||||
rendererCTM.submapSmall = var.submapSmall;
|
||||
switch (var == null ? 0 : var.kind) {
|
||||
case CarvableHelper.CTMX:
|
||||
rendererCTM.blockAccess = world;
|
||||
rendererCTM.renderMaxX = 1.0;
|
||||
rendererCTM.renderMaxY = 1.0;
|
||||
rendererCTM.renderMaxZ = 1.0;
|
||||
|
||||
rendererCTM.rendererOld = rendererOld;
|
||||
rendererCTM.submap = var.submap;
|
||||
rendererCTM.submapSmall = var.submapSmall;
|
||||
|
||||
return rendererCTM.renderStandardBlock(block, x, y, z);
|
||||
case CarvableHelper.CTMV:
|
||||
rendererColumn.blockAccess = world;
|
||||
rendererColumn.renderMaxX = 1.0;
|
||||
rendererColumn.renderMaxY = 1.0;
|
||||
rendererColumn.renderMaxZ = 1.0;
|
||||
rendererCTM.rendererOld = rendererOld;
|
||||
|
||||
rendererColumn.submap = var.seamsCtmVert;
|
||||
rendererColumn.iconTop = var.iconTop;
|
||||
return rendererCTM.renderStandardBlock(block, x, y, z);
|
||||
case CarvableHelper.CTMV:
|
||||
rendererColumn.blockAccess = world;
|
||||
rendererColumn.renderMaxX = 1.0;
|
||||
rendererColumn.renderMaxY = 1.0;
|
||||
rendererColumn.renderMaxZ = 1.0;
|
||||
|
||||
return rendererColumn.renderStandardBlock(block, x, y, z);
|
||||
default:
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
rendererColumn.submap = var.seamsCtmVert;
|
||||
rendererColumn.iconTop = var.iconTop;
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return rendererColumn.renderStandardBlock(block, x, y, z);
|
||||
default:
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return Chisel.RenderCTMId;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.RenderCTMId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,22 +4,18 @@ import com.cricketcraft.chisel.Chisel;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockCarpetRenderer extends BlockAdvancedMarbleRenderer {
|
||||
|
||||
public class BlockCarpetRenderer extends BlockAdvancedMarbleRenderer
|
||||
{
|
||||
public BlockCarpetRenderer() {
|
||||
super();
|
||||
|
||||
public BlockCarpetRenderer()
|
||||
{
|
||||
super();
|
||||
Chisel.RenderCarpetId = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
Chisel.RenderCarpetId = RenderingRegistry.getNextAvailableRenderId();
|
||||
rendererCTM = new RenderBlocksCTMCarpet();
|
||||
}
|
||||
|
||||
rendererCTM = new RenderBlocksCTMCarpet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return Chisel.RenderCarpetId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.RenderCarpetId;
|
||||
}
|
||||
}
|
||||
@@ -12,105 +12,90 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockEldritchRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public BlockEldritchRenderer()
|
||||
{
|
||||
Chisel.RenderEldritchId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public class BlockEldritchRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
public BlockEldritchRenderer() {
|
||||
Chisel.RenderEldritchId = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
RenderBlocksEldritch renderer = new RenderBlocksEldritch();
|
||||
RenderBlocksEldritch renderer = new RenderBlocksEldritch();
|
||||
|
||||
@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);
|
||||
@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);
|
||||
|
||||
// tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
/*
|
||||
double d0 = 0.4000000059604645D;
|
||||
double d1 = 0.5D - d0;
|
||||
double d2 = 0.20000000298023224D;
|
||||
// tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x,
|
||||
// y, z));
|
||||
/*
|
||||
* double d0 = 0.4000000059604645D; double d1 = 0.5D - d0; double d2 =
|
||||
* 0.20000000298023224D;
|
||||
*/
|
||||
// renderer.renderTorchAtAngle(Block.torchWood, x - d1, y + d2, z, -d0,
|
||||
// 0.0D, 0);
|
||||
/*
|
||||
* Icon icon = block.getIcon(2, meta); double u0 = icon.getMinU();
|
||||
* double v0 = icon.getMaxV(); double u1 = icon.getMaxU(); double v1 =
|
||||
* icon.getMinV(); double uu = icon.getInterpolatedU(8.0D); double vv =
|
||||
* icon.getInterpolatedV(8.0D);
|
||||
*
|
||||
*
|
||||
* int lyp=block.getMixedBrightnessForBlock(world, x, y+1, z); int
|
||||
* lym=block.getMixedBrightnessForBlock(world, x, y-1, z); int
|
||||
* lxp=block.getMixedBrightnessForBlock(world, x+1, y, z); int
|
||||
* lxm=block.getMixedBrightnessForBlock(world, x-1, y, z); int
|
||||
* lzp=block.getMixedBrightnessForBlock(world, x, y, z+1); int
|
||||
* lzm=block.getMixedBrightnessForBlock(world, x, y, z-1);
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* icon = block.getIcon(0, meta); u0 = icon.getMinU(); v0 =
|
||||
* icon.getMinV(); u1 = icon.getMaxU(); v1 = icon.getMaxV();
|
||||
* vertex(1,u0,v0); vertex(5,u1,v0); vertex(6,u1,v1); vertex(2,u0,v1);
|
||||
*
|
||||
* icon = block.getIcon(1, meta); u0 = icon.getMinU(); v0 =
|
||||
* icon.getMinV(); u1 = icon.getMaxU(); v1 = icon.getMaxV();
|
||||
* vertex(0,u0,v0); vertex(3,u0,v1); vertex(7,u1,v1); vertex(4,u1,v0);
|
||||
*/
|
||||
|
||||
*/
|
||||
// renderer.renderTorchAtAngle(Block.torchWood, x - d1, y + d2, z, -d0, 0.0D, 0);
|
||||
/*
|
||||
Icon icon = block.getIcon(2, meta);
|
||||
double u0 = icon.getMinU();
|
||||
double v0 = icon.getMaxV();
|
||||
double u1 = icon.getMaxU();
|
||||
double v1 = icon.getMinV();
|
||||
double uu = icon.getInterpolatedU(8.0D);
|
||||
double vv = icon.getInterpolatedV(8.0D);
|
||||
|
||||
|
||||
int lyp=block.getMixedBrightnessForBlock(world, x, y+1, z);
|
||||
int lym=block.getMixedBrightnessForBlock(world, x, y-1, z);
|
||||
int lxp=block.getMixedBrightnessForBlock(world, x+1, y, z);
|
||||
int lxm=block.getMixedBrightnessForBlock(world, x-1, y, z);
|
||||
int lzp=block.getMixedBrightnessForBlock(world, x, y, z+1);
|
||||
int lzm=block.getMixedBrightnessForBlock(world, x, y, z-1);
|
||||
renderer.blockAccess = world;
|
||||
renderer.renderMaxX = 1.0;
|
||||
renderer.renderMaxY = 1.0;
|
||||
renderer.renderMaxZ = 1.0;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
return true;
|
||||
/*
|
||||
*
|
||||
* boolean flag = renderer.renderStandardBlock(block, x, y, z);
|
||||
*
|
||||
* return flag;
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
icon = block.getIcon(0, meta);
|
||||
u0 = icon.getMinU();
|
||||
v0 = icon.getMinV();
|
||||
u1 = icon.getMaxU();
|
||||
v1 = icon.getMaxV();
|
||||
vertex(1,u0,v0); vertex(5,u1,v0); vertex(6,u1,v1); vertex(2,u0,v1);
|
||||
|
||||
icon = block.getIcon(1, meta);
|
||||
u0 = icon.getMinU();
|
||||
v0 = icon.getMinV();
|
||||
u1 = icon.getMaxU();
|
||||
v1 = icon.getMaxV();
|
||||
vertex(0,u0,v0); vertex(3,u0,v1); vertex(7,u1,v1); vertex(4,u1,v0);
|
||||
|
||||
*/
|
||||
|
||||
renderer.blockAccess = world;
|
||||
renderer.renderMaxX = 1.0;
|
||||
renderer.renderMaxY = 1.0;
|
||||
renderer.renderMaxZ = 1.0;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
return true;
|
||||
/*
|
||||
|
||||
boolean flag = renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
return flag;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return Chisel.RenderEldritchId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return Chisel.RenderEldritchId;
|
||||
}
|
||||
|
||||
}
|
||||
+259
-278
@@ -15,326 +15,307 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockMarblePaneRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int id;
|
||||
public class BlockMarblePaneRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockMarblePaneRenderer()
|
||||
{
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public static int id;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glScalef(1.25f, 1.25f, 1.25f);
|
||||
renderer.setRenderBounds(0.0f, 0.0f, 0.5f - 0.0625f, 1.0f, 1.0f, 0.5f + 0.0625f);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
public BlockMarblePaneRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
class PaneRenderer
|
||||
{
|
||||
Tessellator tessellator;
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
GL11.glScalef(1.25f, 1.25f, 1.25f);
|
||||
renderer.setRenderBounds(0.0f, 0.0f, 0.5f - 0.0625f, 1.0f, 1.0f, 0.5f + 0.0625f);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
double i0u0;
|
||||
double i0uh;
|
||||
double i0u1;
|
||||
double i0v0;
|
||||
double i0v1;
|
||||
class PaneRenderer {
|
||||
|
||||
double i1u0;
|
||||
double i1u1;
|
||||
double i1v0;
|
||||
double i1vh;
|
||||
double i1v1;
|
||||
double i1v;
|
||||
Tessellator tessellator;
|
||||
|
||||
double i2u0;
|
||||
double i2u1;
|
||||
double i2v0;
|
||||
double i2v1;
|
||||
double i2v;
|
||||
double i0u0;
|
||||
double i0uh;
|
||||
double i0u1;
|
||||
double i0v0;
|
||||
double i0v1;
|
||||
|
||||
double x0;
|
||||
double xh;
|
||||
double x1;
|
||||
double xp0;
|
||||
double xp1;
|
||||
double i1u0;
|
||||
double i1u1;
|
||||
double i1v0;
|
||||
double i1vh;
|
||||
double i1v1;
|
||||
double i1v;
|
||||
|
||||
double z0;
|
||||
double zh;
|
||||
double z1;
|
||||
double zp0;
|
||||
double zp1;
|
||||
double i2u0;
|
||||
double i2u1;
|
||||
double i2v0;
|
||||
double i2v1;
|
||||
double i2v;
|
||||
|
||||
double y0;
|
||||
double y1;
|
||||
double x0;
|
||||
double xh;
|
||||
double x1;
|
||||
double xp0;
|
||||
double xp1;
|
||||
|
||||
void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2)
|
||||
{
|
||||
tessellator = Tessellator.instance;
|
||||
double z0;
|
||||
double zh;
|
||||
double z1;
|
||||
double zp0;
|
||||
double zp1;
|
||||
|
||||
i0u0 = icon.getMinU();
|
||||
i0uh = icon.getInterpolatedU(8.0D);
|
||||
i0u1 = icon.getMaxU();
|
||||
i0v0 = icon.getMinV();
|
||||
i0v1 = icon.getMaxV();
|
||||
double y0;
|
||||
double y1;
|
||||
|
||||
i1u0 = icon1.getInterpolatedU(7.0D);
|
||||
i1u1 = icon1.getInterpolatedU(9.0D);
|
||||
i1v0 = icon1.getMinV();
|
||||
i1vh = icon1.getInterpolatedV(8.0D);
|
||||
i1v1 = icon1.getMaxV();
|
||||
i1v = i1v1 - i1v0;
|
||||
void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2) {
|
||||
tessellator = Tessellator.instance;
|
||||
|
||||
i2u0 = icon2.getInterpolatedU(7.0D);
|
||||
i2u1 = icon2.getInterpolatedU(9.0D);
|
||||
i2v0 = icon2.getMinV();
|
||||
i2v1 = icon2.getMaxV();
|
||||
i2v = i2v1 - i2v0;
|
||||
i0u0 = icon.getMinU();
|
||||
i0uh = icon.getInterpolatedU(8.0D);
|
||||
i0u1 = icon.getMaxU();
|
||||
i0v0 = icon.getMinV();
|
||||
i0v1 = icon.getMaxV();
|
||||
|
||||
x0 = x;
|
||||
xh = x0 + 0.5D;
|
||||
x1 = x + 1;
|
||||
xp0 = x0 + 0.5D - 0.0625D;
|
||||
xp1 = x0 + 0.5D + 0.0625D;
|
||||
i1u0 = icon1.getInterpolatedU(7.0D);
|
||||
i1u1 = icon1.getInterpolatedU(9.0D);
|
||||
i1v0 = icon1.getMinV();
|
||||
i1vh = icon1.getInterpolatedV(8.0D);
|
||||
i1v1 = icon1.getMaxV();
|
||||
i1v = i1v1 - i1v0;
|
||||
|
||||
z0 = z;
|
||||
zh = z0 + 0.5D;
|
||||
z1 = z + 1;
|
||||
zp0 = z0 + 0.5D - 0.0625D;
|
||||
zp1 = z0 + 0.5D + 0.0625D;
|
||||
i2u0 = icon2.getInterpolatedU(7.0D);
|
||||
i2u1 = icon2.getInterpolatedU(9.0D);
|
||||
i2v0 = icon2.getMinV();
|
||||
i2v1 = icon2.getMaxV();
|
||||
i2v = i2v1 - i2v0;
|
||||
|
||||
y0 = y;
|
||||
y1 = y + 1;
|
||||
}
|
||||
x0 = x;
|
||||
xh = x0 + 0.5D;
|
||||
x1 = x + 1;
|
||||
xp0 = x0 + 0.5D - 0.0625D;
|
||||
xp1 = x0 + 0.5D + 0.0625D;
|
||||
|
||||
public void renderNorthPane()
|
||||
{
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
}
|
||||
z0 = z;
|
||||
zh = z0 + 0.5D;
|
||||
z1 = z + 1;
|
||||
zp0 = z0 + 0.5D - 0.0625D;
|
||||
zp1 = z0 + 0.5D + 0.0625D;
|
||||
|
||||
public void renderSouthPane()
|
||||
{
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
y0 = y;
|
||||
y1 = y + 1;
|
||||
}
|
||||
|
||||
public void renderWestPane()
|
||||
{
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
}
|
||||
public void renderNorthPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z0, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z0, i0uh, i0v0);
|
||||
}
|
||||
|
||||
public void renderEastPane()
|
||||
{
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
public void renderSouthPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, z1, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, z1, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
|
||||
public void renderVerticalNS(double y, double zoff0, double zoff1, double v0, double v1)
|
||||
{
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
}
|
||||
public void renderWestPane() {
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u0, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u0, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x0, y1, zh, i0uh, i0v0);
|
||||
}
|
||||
|
||||
public void renderVerticalWE(double y, double xoff0, double xoff1, double v0, double v1)
|
||||
{
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
}
|
||||
public void renderEastPane() {
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y1, zh, i0uh, i0v0);
|
||||
tessellator.addVertexWithUV(x1, y0, zh, i0uh, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y0, zh, i0u1, i0v1);
|
||||
tessellator.addVertexWithUV(xh, y1, zh, i0u1, i0v0);
|
||||
}
|
||||
|
||||
public void renderVerticalNS(double y, double zoff0, double zoff1, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff1, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0 + y, z0 + zoff0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff0, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0 + y, z0 + zoff1, i1u1, i1v0 + i1v * v1);
|
||||
}
|
||||
|
||||
public void renderHorizontalNS(double zoff, double v0, double v1)
|
||||
{
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
public void renderVerticalWE(double y, double xoff0, double xoff1, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp1, i1u1, i1v0 + i1v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp1, i1u1, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff0, y0 + y, zp0, i1u0, i1v0 + i1v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff1, y0 + y, zp0, i1u0, i1v0 + i1v * v1);
|
||||
}
|
||||
|
||||
}
|
||||
public void renderHorizontalNS(double zoff, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y1, z0 + zoff, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(xp1, y0, z0 + zoff, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y0, z0 + zoff, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(xp0, y1, z0 + zoff, i2u0, i2v0 + i2v * v1);
|
||||
|
||||
public void renderHorizontalWE(double xoff, double v0, double v1)
|
||||
{
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PaneRenderer paneRenderer = new PaneRenderer();
|
||||
public void renderHorizontalWE(double xoff, double v0, double v1) {
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp1, i2u1, i2v0 + i2v * v1);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp1, i2u1, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y0, zp0, i2u0, i2v0 + i2v * v0);
|
||||
tessellator.addVertexWithUV(x0 + xoff, y1, zp0, i2u0, i2v0 + i2v * v1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
BlockPane block = (BlockPane) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
PaneRenderer paneRenderer = new PaneRenderer();
|
||||
|
||||
int worldHeight = world.getHeight();
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer) {
|
||||
BlockPane block = (BlockPane) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
int worldHeight = world.getHeight();
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
|
||||
if(EntityRenderer.anaglyphEnable)
|
||||
{
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iconPane = block.getIcon(2, meta);
|
||||
IIcon iconTop = block.getIcon(1, meta);
|
||||
IIcon iconSide = block.getIcon(0, meta);
|
||||
if(iconPane == null || iconTop == null || iconSide == null) return false;
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
|
||||
paneRenderer.set(x, y, z, iconPane, iconTop, iconSide);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iconPane = block.getIcon(2, meta);
|
||||
IIcon iconTop = block.getIcon(1, meta);
|
||||
IIcon iconSide = block.getIcon(0, meta);
|
||||
if (iconPane == null || iconTop == null || iconSide == null)
|
||||
return false;
|
||||
|
||||
boolean connectsNorth = block.canPaneConnectToBlock(world.getBlock(x, y, z - 1));
|
||||
boolean connectsSouth = block.canPaneConnectToBlock(world.getBlock(x, y, z + 1));
|
||||
boolean connectsWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y, z));
|
||||
boolean connectsEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y, z));
|
||||
boolean connectsTop = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z));
|
||||
boolean connectsBottom = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z));
|
||||
paneRenderer.set(x, y, z, iconPane, iconTop, iconSide);
|
||||
|
||||
boolean connectsTopNorth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z - 1));
|
||||
boolean connectsTopSouth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z + 1));
|
||||
boolean connectsTopWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y + 1, z));
|
||||
boolean connectsTopEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y + 1, z));
|
||||
boolean connectsNorth = block.canPaneConnectToBlock(world.getBlock(x, y, z - 1));
|
||||
boolean connectsSouth = block.canPaneConnectToBlock(world.getBlock(x, y, z + 1));
|
||||
boolean connectsWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y, z));
|
||||
boolean connectsEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y, z));
|
||||
boolean connectsTop = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z));
|
||||
boolean connectsBottom = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z));
|
||||
|
||||
boolean connectsBottomNorth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z - 1));
|
||||
boolean connectsBottomSouth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z + 1));
|
||||
boolean connectsBottomWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y - 1, z));
|
||||
boolean connectsBottomEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y - 1, z));
|
||||
boolean connectsTopNorth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z - 1));
|
||||
boolean connectsTopSouth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z + 1));
|
||||
boolean connectsTopWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y + 1, z));
|
||||
boolean connectsTopEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y + 1, z));
|
||||
|
||||
boolean isolatedTop = !connectsTopNorth && !connectsTopSouth && !connectsTopWest && !connectsTopEast;
|
||||
boolean isolatedBottom = !connectsBottomNorth && !connectsBottomSouth && !connectsBottomWest && !connectsBottomEast;
|
||||
boolean connectsBottomNorth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z - 1));
|
||||
boolean connectsBottomSouth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z + 1));
|
||||
boolean connectsBottomWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y - 1, z));
|
||||
boolean connectsBottomEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y - 1, z));
|
||||
|
||||
if(!connectsNorth && !connectsSouth && !connectsWest && !connectsEast)
|
||||
{
|
||||
connectsNorth = connectsSouth = connectsWest = connectsEast = true;
|
||||
}
|
||||
boolean isolatedTop = !connectsTopNorth && !connectsTopSouth && !connectsTopWest && !connectsTopEast;
|
||||
boolean isolatedBottom = !connectsBottomNorth && !connectsBottomSouth && !connectsBottomWest && !connectsBottomEast;
|
||||
|
||||
int connections = 0;
|
||||
if(connectsNorth)
|
||||
{
|
||||
paneRenderer.renderNorthPane();
|
||||
if(!connectsBottom || !connectsBottomNorth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
if(!connectsTop || !connectsTopNorth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if(connectsSouth)
|
||||
{
|
||||
paneRenderer.renderSouthPane();
|
||||
if(!connectsBottom || !connectsBottomSouth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
if(!connectsTop || !connectsTopSouth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
if(connectsWest)
|
||||
{
|
||||
paneRenderer.renderWestPane();
|
||||
if(!connectsBottom || !connectsBottomWest && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
if(!connectsTop || !connectsTopWest && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if(connectsEast)
|
||||
{
|
||||
paneRenderer.renderEastPane();
|
||||
if(!connectsBottom || !connectsBottomEast && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
if(!connectsTop || !connectsTopEast && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
if (!connectsNorth && !connectsSouth && !connectsWest && !connectsEast) {
|
||||
connectsNorth = connectsSouth = connectsWest = connectsEast = true;
|
||||
}
|
||||
|
||||
int connections = 0;
|
||||
if (connectsNorth) {
|
||||
paneRenderer.renderNorthPane();
|
||||
if (!connectsBottom || !connectsBottomNorth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
if (!connectsTop || !connectsTopNorth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0003, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if (connectsSouth) {
|
||||
paneRenderer.renderSouthPane();
|
||||
if (!connectsBottom || !connectsBottomSouth && !isolatedBottom)
|
||||
paneRenderer.renderVerticalNS(-0.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
if (!connectsTop || !connectsTopSouth && !isolatedTop)
|
||||
paneRenderer.renderVerticalNS(+1.0004, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
if (connectsWest) {
|
||||
paneRenderer.renderWestPane();
|
||||
if (!connectsBottom || !connectsBottomWest && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
if (!connectsTop || !connectsTopWest && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0001, 0.0, 0.5, 0.5, 0.0);
|
||||
connections++;
|
||||
}
|
||||
if (connectsEast) {
|
||||
paneRenderer.renderEastPane();
|
||||
if (!connectsBottom || !connectsBottomEast && !isolatedBottom)
|
||||
paneRenderer.renderVerticalWE(-0.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
if (!connectsTop || !connectsTopEast && !isolatedTop)
|
||||
paneRenderer.renderVerticalWE(+1.0002, 0.5, 1.0, 1.0, 0.5);
|
||||
connections++;
|
||||
}
|
||||
|
||||
if(connections == 1)
|
||||
{
|
||||
if(connectsNorth) paneRenderer.renderHorizontalNS(0.5, 1.0, 0.0);
|
||||
if(connectsSouth) paneRenderer.renderHorizontalNS(0.5, 0.0, 1.0);
|
||||
if(connectsEast) paneRenderer.renderHorizontalWE(0.5, 0.0, 1.0);
|
||||
if(connectsWest) paneRenderer.renderHorizontalWE(0.5, 1.0, 0.0);
|
||||
} else if(connections == 4)
|
||||
{
|
||||
paneRenderer.renderHorizontalNS(0.0, 1.0, 0.0);
|
||||
paneRenderer.renderHorizontalNS(1.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(0.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(1.0, 1.0, 0.0);
|
||||
}
|
||||
if (connections == 1) {
|
||||
if (connectsNorth)
|
||||
paneRenderer.renderHorizontalNS(0.5, 1.0, 0.0);
|
||||
if (connectsSouth)
|
||||
paneRenderer.renderHorizontalNS(0.5, 0.0, 1.0);
|
||||
if (connectsEast)
|
||||
paneRenderer.renderHorizontalWE(0.5, 0.0, 1.0);
|
||||
if (connectsWest)
|
||||
paneRenderer.renderHorizontalWE(0.5, 1.0, 0.0);
|
||||
} else if (connections == 4) {
|
||||
paneRenderer.renderHorizontalNS(0.0, 1.0, 0.0);
|
||||
paneRenderer.renderHorizontalNS(1.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(0.0, 0.0, 1.0);
|
||||
paneRenderer.renderHorizontalWE(1.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
+112
-127
@@ -13,163 +13,148 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockMarblePillarRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int id;
|
||||
public class BlockMarblePillarRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockMarblePillarRenderer()
|
||||
{
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public static int id;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blck, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if(!(blck instanceof BlockMarblePillar))
|
||||
return;
|
||||
public BlockMarblePillarRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
BlockMarblePillar block = (BlockMarblePillar) blck;
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blck, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (!(blck instanceof BlockMarblePillar))
|
||||
return;
|
||||
|
||||
block.sides[0] = block.sides[1] = block.getCtmIcon(4, metadata);
|
||||
block.sides[2] = block.sides[3] = block.sides[4] = block.sides[5] = block.getCtmIcon(0, metadata);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
}
|
||||
BlockMarblePillar block = (BlockMarblePillar) blck;
|
||||
|
||||
boolean connected(IBlockAccess world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
return world.getBlock(x, y, z).equals(block) && world.getBlockMetadata(x, y, z) == meta;
|
||||
block.sides[0] = block.sides[1] = block.getCtmIcon(4, metadata);
|
||||
block.sides[2] = block.sides[3] = block.sides[4] = block.sides[5] = block.getCtmIcon(0, metadata);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, metadata, renderer);
|
||||
}
|
||||
|
||||
}
|
||||
boolean connected(IBlockAccess world, int x, int y, int z, Block block, int meta) {
|
||||
return world.getBlock(x, y, z).equals(block) && world.getBlockMetadata(x, y, z) == meta;
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
if(!(blck instanceof BlockMarblePillar))
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockMarblePillar block = (BlockMarblePillar) blck;
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
|
||||
if (!(blck instanceof BlockMarblePillar))
|
||||
return false;
|
||||
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
BlockMarblePillar block = (BlockMarblePillar) blck;
|
||||
|
||||
if(block.carverHelper.variations.get(metadata).kind != CarvableHelper.CTMV)
|
||||
{
|
||||
block.sides[0] = block.carverHelper.getIcon(0, metadata);
|
||||
block.sides[1] = block.carverHelper.getIcon(1, metadata);
|
||||
block.sides[2] = block.carverHelper.getIcon(2, metadata);
|
||||
block.sides[3] = block.carverHelper.getIcon(3, metadata);
|
||||
block.sides[4] = block.carverHelper.getIcon(4, metadata);
|
||||
block.sides[5] = block.carverHelper.getIcon(5, metadata);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
return renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (block.carverHelper.variations.get(metadata).kind != CarvableHelper.CTMV) {
|
||||
block.sides[0] = block.carverHelper.getIcon(0, metadata);
|
||||
block.sides[1] = block.carverHelper.getIcon(1, metadata);
|
||||
block.sides[2] = block.carverHelper.getIcon(2, metadata);
|
||||
block.sides[3] = block.carverHelper.getIcon(3, metadata);
|
||||
block.sides[4] = block.carverHelper.getIcon(4, metadata);
|
||||
block.sides[5] = block.carverHelper.getIcon(5, metadata);
|
||||
|
||||
boolean yp = connected(world, x, y + 1, z, block, metadata);
|
||||
boolean yn = connected(world, x, y - 1, z, block, metadata);
|
||||
return renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if(yp || yn)
|
||||
{
|
||||
block.sides[0] = block.getCtmIcon(4, metadata);
|
||||
block.sides[1] = block.getCtmIcon(4, metadata);
|
||||
boolean yp = connected(world, x, y + 1, z, block, metadata);
|
||||
boolean yn = connected(world, x, y - 1, z, block, metadata);
|
||||
|
||||
if(yp && yn)
|
||||
block.sides[2] = block.getCtmIcon(2, metadata);
|
||||
else if(yp)
|
||||
block.sides[2] = block.getCtmIcon(3, metadata);
|
||||
else
|
||||
block.sides[2] = block.getCtmIcon(1, metadata);
|
||||
if (yp || yn) {
|
||||
block.sides[0] = block.getCtmIcon(4, metadata);
|
||||
block.sides[1] = block.getCtmIcon(4, metadata);
|
||||
|
||||
block.sides[3] = block.sides[4] = block.sides[5] = block.sides[2];
|
||||
} else
|
||||
{
|
||||
boolean xp = connected(world, x + 1, y, z, block, metadata);
|
||||
boolean xn = connected(world, x - 1, y, z, block, metadata);
|
||||
if (yp && yn)
|
||||
block.sides[2] = block.getCtmIcon(2, metadata);
|
||||
else if (yp)
|
||||
block.sides[2] = block.getCtmIcon(3, metadata);
|
||||
else
|
||||
block.sides[2] = block.getCtmIcon(1, metadata);
|
||||
|
||||
if(xp && (connected(world, x + 1, y + 1, z, block, metadata) || connected(world, x + 1, y - 1, z, block, metadata)))
|
||||
xp = false;
|
||||
if(xn && (connected(world, x - 1, y + 1, z, block, metadata) || connected(world, x - 1, y - 1, z, block, metadata)))
|
||||
xn = false;
|
||||
block.sides[3] = block.sides[4] = block.sides[5] = block.sides[2];
|
||||
} else {
|
||||
boolean xp = connected(world, x + 1, y, z, block, metadata);
|
||||
boolean xn = connected(world, x - 1, y, z, block, metadata);
|
||||
|
||||
if(xp || xn)
|
||||
{
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
if (xp && (connected(world, x + 1, y + 1, z, block, metadata) || connected(world, x + 1, y - 1, z, block, metadata)))
|
||||
xp = false;
|
||||
if (xn && (connected(world, x - 1, y + 1, z, block, metadata) || connected(world, x - 1, y - 1, z, block, metadata)))
|
||||
xn = false;
|
||||
|
||||
block.sides[4] = block.getCtmIcon(4, metadata);
|
||||
block.sides[5] = block.getCtmIcon(4, metadata);
|
||||
if (xp || xn) {
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
|
||||
if(xp && xn)
|
||||
block.sides[0] = block.getCtmIcon(2, metadata);
|
||||
else if(xp)
|
||||
block.sides[0] = block.getCtmIcon(3, metadata);
|
||||
else
|
||||
block.sides[0] = block.getCtmIcon(1, metadata);
|
||||
block.sides[4] = block.getCtmIcon(4, metadata);
|
||||
block.sides[5] = block.getCtmIcon(4, metadata);
|
||||
|
||||
block.sides[1] = block.sides[2] = block.sides[3] = block.sides[0];
|
||||
} else
|
||||
{
|
||||
boolean zp = connected(world, x, y, z + 1, block, metadata);
|
||||
boolean zn = connected(world, x, y, z - 1, block, metadata);
|
||||
if (xp && xn)
|
||||
block.sides[0] = block.getCtmIcon(2, metadata);
|
||||
else if (xp)
|
||||
block.sides[0] = block.getCtmIcon(3, metadata);
|
||||
else
|
||||
block.sides[0] = block.getCtmIcon(1, metadata);
|
||||
|
||||
if(zp && (connected(world, x, y + 1, z + 1, block, metadata) || connected(world, x, y - 1, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if(zp && (connected(world, x + 1, y, z + 1, block, metadata) || connected(world, x - 1, y, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if(zn && (connected(world, x, y + 1, z - 1, block, metadata) || connected(world, x, y - 1, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
if(zn && (connected(world, x + 1, y, z - 1, block, metadata) || connected(world, x - 1, y, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
block.sides[1] = block.sides[2] = block.sides[3] = block.sides[0];
|
||||
} else {
|
||||
boolean zp = connected(world, x, y, z + 1, block, metadata);
|
||||
boolean zn = connected(world, x, y, z - 1, block, metadata);
|
||||
|
||||
if(zp || zn)
|
||||
{
|
||||
renderer.uvRotateSouth = 1;
|
||||
renderer.uvRotateNorth = 2;
|
||||
if (zp && (connected(world, x, y + 1, z + 1, block, metadata) || connected(world, x, y - 1, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if (zp && (connected(world, x + 1, y, z + 1, block, metadata) || connected(world, x - 1, y, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if (zn && (connected(world, x, y + 1, z - 1, block, metadata) || connected(world, x, y - 1, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
if (zn && (connected(world, x + 1, y, z - 1, block, metadata) || connected(world, x - 1, y, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
|
||||
block.sides[2] = block.getCtmIcon(4, metadata);
|
||||
block.sides[3] = block.getCtmIcon(4, metadata);
|
||||
if (zp || zn) {
|
||||
renderer.uvRotateSouth = 1;
|
||||
renderer.uvRotateNorth = 2;
|
||||
|
||||
if(zp && zn)
|
||||
block.sides[0] = block.getCtmIcon(2, metadata);
|
||||
else if(zp)
|
||||
block.sides[0] = block.getCtmIcon(1, metadata);
|
||||
else
|
||||
block.sides[0] = block.getCtmIcon(3, metadata);
|
||||
block.sides[2] = block.getCtmIcon(4, metadata);
|
||||
block.sides[3] = block.getCtmIcon(4, metadata);
|
||||
|
||||
block.sides[1] = block.sides[4] = block.sides[5] = block.sides[0];
|
||||
} else
|
||||
{
|
||||
block.sides[0] = block.sides[1] = block.getCtmIcon(4, metadata);
|
||||
block.sides[2] = block.sides[3] = block.sides[4] = block.sides[5] = block.getCtmIcon(0, metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (zp && zn)
|
||||
block.sides[0] = block.getCtmIcon(2, metadata);
|
||||
else if (zp)
|
||||
block.sides[0] = block.getCtmIcon(1, metadata);
|
||||
else
|
||||
block.sides[0] = block.getCtmIcon(3, metadata);
|
||||
|
||||
block.sides[1] = block.sides[4] = block.sides[5] = block.sides[0];
|
||||
} else {
|
||||
block.sides[0] = block.sides[1] = block.getCtmIcon(4, metadata);
|
||||
block.sides[2] = block.sides[3] = block.sides[4] = block.sides[5] = block.getCtmIcon(0, metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean flag = renderer.renderStandardBlock(block, x, y, z);
|
||||
boolean flag = renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
renderer.uvRotateSouth = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateSouth = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
|
||||
return flag;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
+33
-39
@@ -12,52 +12,46 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockMarbleStairsRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int id;
|
||||
public class BlockMarbleStairsRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockMarbleStairsRenderer()
|
||||
{
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public static int id;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
public BlockMarbleStairsRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
if(blck == null || !(blck instanceof BlockMarbleStairs))
|
||||
return false;
|
||||
BlockMarbleStairs block = (BlockMarbleStairs) blck;
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
renderer.renderBlockStairs(block, x, y, z);
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockMarbleStairs))
|
||||
return false;
|
||||
BlockMarbleStairs block = (BlockMarbleStairs) blck;
|
||||
|
||||
return true;
|
||||
}
|
||||
renderer.renderBlockStairs(block, x, y, z);
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,45 +11,41 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockNoCTMRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
static int id;
|
||||
public class BlockNoCTMRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockNoCTMRenderer()
|
||||
{
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
static int id;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
public BlockNoCTMRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
if(meta != 0) renderer.overrideBlockTexture = block.getIcon(0, meta);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.overrideBlockTexture = null;
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
return false;
|
||||
}
|
||||
if (meta != 0)
|
||||
renderer.overrideBlockTexture = block.getIcon(0, meta);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,127 +13,111 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int id;
|
||||
public class BlockRoadLineRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockRoadLineRenderer()
|
||||
{
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public static int id;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
public BlockRoadLineRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
public void renderTopFace(double y, IIcon icon)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
}
|
||||
|
||||
tessellator.addVertexWithUV(1, y, 0, icon.getMaxU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 0, icon.getMinU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 1, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(1, y, 1, icon.getMaxU(), icon.getMaxV());
|
||||
}
|
||||
public void renderTopFace(double y, IIcon icon) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
BlockRoadLine block = (BlockRoadLine) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.addVertexWithUV(1, y, 0, icon.getMaxU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 0, icon.getMinU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(0, y, 1, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(1, y, 1, icon.getMaxU(), icon.getMaxV());
|
||||
}
|
||||
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
BlockRoadLine block = (BlockRoadLine) b;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
|
||||
if(EntityRenderer.anaglyphEnable)
|
||||
{
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
float f = 1.0F;
|
||||
int i1 = block.colorMultiplier(world, x, y, z);
|
||||
float f1 = (i1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (i1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (i1 & 255) / 255.0F;
|
||||
|
||||
boolean N = world.getBlock(x, y, z - 1).equals(block);
|
||||
boolean S = world.getBlock(x, y, z + 1).equals(block);
|
||||
boolean W = world.getBlock(x - 1, y, z).equals(block);
|
||||
boolean E = world.getBlock(x + 1, y, z).equals(block);
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
|
||||
if(!N && !S && !W && !E)
|
||||
{
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
boolean N = world.getBlock(x, y, z - 1).equals(block);
|
||||
boolean S = world.getBlock(x, y, z + 1).equals(block);
|
||||
boolean W = world.getBlock(x - 1, y, z).equals(block);
|
||||
boolean E = world.getBlock(x + 1, y, z).equals(block);
|
||||
|
||||
if(N && S)
|
||||
{
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
if (!N && !S && !W && !E) {
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
if(N)
|
||||
{
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if(S)
|
||||
{
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (N && S) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
}
|
||||
} else {
|
||||
if (N) {
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (S) {
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if(E && W)
|
||||
{
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
} else
|
||||
{
|
||||
if(E)
|
||||
{
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if(W)
|
||||
{
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = null;
|
||||
return true;
|
||||
}
|
||||
if (E && W) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.fullLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
} else {
|
||||
if (E) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (W) {
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.overrideBlockTexture = block.halfLineIcon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.overrideBlockTexture = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -12,129 +12,115 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockSnakeStoneRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int id;
|
||||
public class BlockSnakeStoneRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockSnakeStoneRenderer()
|
||||
{
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
public static int id;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
restoreRendererRotate(renderer);
|
||||
}
|
||||
public BlockSnakeStoneRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
restoreRendererRotate(renderer);
|
||||
}
|
||||
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
boolean didRender = renderer.renderStandardBlock(block, x, y, z);
|
||||
restoreRendererRotate(renderer);
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
return didRender;
|
||||
}
|
||||
setRenderRotate(renderer, (BlockSnakestone) block, meta);
|
||||
boolean didRender = renderer.renderStandardBlock(block, x, y, z);
|
||||
restoreRendererRotate(renderer);
|
||||
|
||||
private void restoreRendererRotate(RenderBlocks renderer)
|
||||
{
|
||||
renderer.uvRotateSouth = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
return didRender;
|
||||
}
|
||||
|
||||
private void setRenderRotate(RenderBlocks renderer, BlockSnakestone block, int meta)
|
||||
{
|
||||
int type = meta & 0xC;
|
||||
int orient = meta & 0x3;
|
||||
private void restoreRendererRotate(RenderBlocks renderer) {
|
||||
renderer.uvRotateSouth = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateWest = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
|
||||
private void setRenderRotate(RenderBlocks renderer, BlockSnakestone block, int meta) {
|
||||
int type = meta & 0xC;
|
||||
int orient = meta & 0x3;
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
switch(orient)
|
||||
{
|
||||
case 0:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 3;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
if (type == 0) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 3;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
}
|
||||
|
||||
} else if((type == 4) || (type == 8))
|
||||
{
|
||||
switch(orient)
|
||||
{
|
||||
case 0:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 1 : 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateEast = 2;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 0 : 3;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateSouth = 2;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateNorth = 2;
|
||||
}
|
||||
} else if ((type == 4) || (type == 8)) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 1 : 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateEast = 2;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateTop = block.flipTopTextures ? 0 : 3;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateSouth = 2;
|
||||
break;
|
||||
case 3:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateNorth = 2;
|
||||
}
|
||||
|
||||
} else if(type == 12)
|
||||
{
|
||||
switch(orient)
|
||||
{
|
||||
case 0:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateNorth = 2;
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == 12) {
|
||||
switch (orient) {
|
||||
case 0:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
break;
|
||||
case 1:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
break;
|
||||
case 2:
|
||||
renderer.uvRotateNorth = 2;
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int renderId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -13,78 +13,67 @@ import com.cricketcraft.chisel.utils.Drawing;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockTexturedOreRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
float bot = -0.001f, top = 1.0f - bot;
|
||||
public static int id;
|
||||
public class BlockTexturedOreRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public BlockTexturedOreRenderer()
|
||||
{
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
float bot = -0.001f, top = 1.0f - bot;
|
||||
public static int id;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if(blck == null || !(blck instanceof BlockTexturedOre))
|
||||
return;
|
||||
public BlockTexturedOreRenderer() {
|
||||
id = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
BlockTexturedOre block = (BlockTexturedOre) blck;
|
||||
@Override
|
||||
public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockTexturedOre))
|
||||
return;
|
||||
|
||||
if(block.icon != null)
|
||||
{
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderBlockAsItem(Blocks.stone, meta, 1.0f);
|
||||
renderer.overrideBlockTexture = null;
|
||||
} else if(block.base != null)
|
||||
{
|
||||
renderer.renderBlockAsItem(block.base, meta, 1.0f);
|
||||
}
|
||||
BlockTexturedOre block = (BlockTexturedOre) blck;
|
||||
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
renderer.setRenderBounds(bot, bot, bot, top, top, top);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
if (block.icon != null) {
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderBlockAsItem(Blocks.stone, meta, 1.0f);
|
||||
renderer.overrideBlockTexture = null;
|
||||
} else if (block.base != null) {
|
||||
renderer.renderBlockAsItem(block.base, meta, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
if(blck == null || !(blck instanceof BlockTexturedOre))
|
||||
return false;
|
||||
BlockTexturedOre block = (BlockTexturedOre) blck;
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
renderer.setRenderBounds(bot, bot, bot, top, top, top);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Drawing.drawBlock(block, meta, renderer);
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
|
||||
if(block.currentPass == 0)
|
||||
{
|
||||
if(block.icon != null)
|
||||
{
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.overrideBlockTexture = null;
|
||||
} else if(block.base != null)
|
||||
{
|
||||
renderer.renderBlockByRenderType(block.base, x, y, z);
|
||||
}
|
||||
} else
|
||||
{
|
||||
renderer.setRenderBounds(bot, bot, bot, top, top, top);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
|
||||
if (blck == null || !(blck instanceof BlockTexturedOre))
|
||||
return false;
|
||||
BlockTexturedOre block = (BlockTexturedOre) blck;
|
||||
|
||||
return true;
|
||||
}
|
||||
if (block.currentPass == 0) {
|
||||
if (block.icon != null) {
|
||||
renderer.overrideBlockTexture = block.icon;
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.overrideBlockTexture = null;
|
||||
} else if (block.base != null) {
|
||||
renderer.renderBlockByRenderType(block.base, x, y, z);
|
||||
}
|
||||
} else {
|
||||
renderer.setRenderBounds(bot, bot, bot, top, top, top);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -1,309 +1,236 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.IFacade;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
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},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
};
|
||||
import com.cricketcraft.chisel.api.IFacade;
|
||||
|
||||
public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int index = getTexture(world, x, y, z, side);
|
||||
public class CTM {
|
||||
|
||||
return submaps[index];
|
||||
}
|
||||
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 getTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if(world == null)
|
||||
return 0;
|
||||
public static int[] getSubmapIndices(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int index = getTexture(world, x, y, z, side);
|
||||
|
||||
int texture = 0;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int blockMetadata = world.getBlockMetadata(x, y, z);
|
||||
return submaps[index];
|
||||
}
|
||||
|
||||
boolean b[] = new boolean[6];
|
||||
if(side <= 1)
|
||||
{
|
||||
b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y, z + 1, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata);
|
||||
} else if(side == 2)
|
||||
{
|
||||
b[0] = isConnected(world, x + 1, y, z, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x - 1, y, z, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
} else if(side == 3)
|
||||
{
|
||||
b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
} else if(side == 4)
|
||||
{
|
||||
b[0] = isConnected(world, x, y, z - 1, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x, y, z + 1, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
} else if(side == 5)
|
||||
{
|
||||
b[0] = isConnected(world, x, y, z + 1, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x, y, z - 1, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
}
|
||||
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;
|
||||
public static int getTexture(IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (world == null)
|
||||
return 0;
|
||||
|
||||
boolean b2[] = new boolean[6];
|
||||
if(side <= 1)
|
||||
{
|
||||
b2[0] = !isConnected(world, x + 1, y, z + 1, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x - 1, y, z + 1, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x + 1, y, z - 1, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x - 1, y, z - 1, side, block, blockMetadata);
|
||||
} else if(side == 2)
|
||||
{
|
||||
b2[0] = !isConnected(world, x - 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x + 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x - 1, y + 1, z, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x + 1, y + 1, z, side, block, blockMetadata);
|
||||
} else if(side == 3)
|
||||
{
|
||||
b2[0] = !isConnected(world, x + 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x - 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x + 1, y + 1, z, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x - 1, y + 1, z, side, block, blockMetadata);
|
||||
} else if(side == 4)
|
||||
{
|
||||
b2[0] = !isConnected(world, x, y - 1, z + 1, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x, y - 1, z - 1, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x, y + 1, z + 1, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x, y + 1, z - 1, side, block, blockMetadata);
|
||||
} else if(side == 5)
|
||||
{
|
||||
b2[0] = !isConnected(world, x, y - 1, z - 1, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x, y - 1, z + 1, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x, y + 1, z - 1, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x, y + 1, z + 1, side, block, blockMetadata);
|
||||
}
|
||||
int texture = 0;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int blockMetadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
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;
|
||||
boolean b[] = new boolean[6];
|
||||
if (side <= 1) {
|
||||
b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y, z + 1, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y, z - 1, side, block, blockMetadata);
|
||||
} else if (side == 2) {
|
||||
b[0] = isConnected(world, x + 1, y, z, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x - 1, y, z, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
} else if (side == 3) {
|
||||
b[0] = isConnected(world, x - 1, y, z, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x + 1, y, z, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
} else if (side == 4) {
|
||||
b[0] = isConnected(world, x, y, z - 1, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x, y, z + 1, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
} else if (side == 5) {
|
||||
b[0] = isConnected(world, x, y, z + 1, side, block, blockMetadata);
|
||||
b[1] = isConnected(world, x, y, z - 1, side, block, blockMetadata);
|
||||
b[2] = isConnected(world, x, y - 1, z, side, block, blockMetadata);
|
||||
b[3] = isConnected(world, x, y + 1, z, side, block, blockMetadata);
|
||||
}
|
||||
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;
|
||||
|
||||
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;
|
||||
boolean b2[] = new boolean[6];
|
||||
if (side <= 1) {
|
||||
b2[0] = !isConnected(world, x + 1, y, z + 1, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x - 1, y, z + 1, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x + 1, y, z - 1, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x - 1, y, z - 1, side, block, blockMetadata);
|
||||
} else if (side == 2) {
|
||||
b2[0] = !isConnected(world, x - 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x + 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x - 1, y + 1, z, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x + 1, y + 1, z, side, block, blockMetadata);
|
||||
} else if (side == 3) {
|
||||
b2[0] = !isConnected(world, x + 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x - 1, y - 1, z, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x + 1, y + 1, z, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x - 1, y + 1, z, side, block, blockMetadata);
|
||||
} else if (side == 4) {
|
||||
b2[0] = !isConnected(world, x, y - 1, z + 1, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x, y - 1, z - 1, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x, y + 1, z + 1, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x, y + 1, z - 1, side, block, blockMetadata);
|
||||
} else if (side == 5) {
|
||||
b2[0] = !isConnected(world, x, y - 1, z - 1, side, block, blockMetadata);
|
||||
b2[1] = !isConnected(world, x, y - 1, z + 1, side, block, blockMetadata);
|
||||
b2[2] = !isConnected(world, x, y + 1, z - 1, side, block, blockMetadata);
|
||||
b2[3] = !isConnected(world, x, y + 1, z + 1, side, block, blockMetadata);
|
||||
}
|
||||
|
||||
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 == 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 = 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 == 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 == 34 && b2[0] && b2[1] && b2[2] && b2[3])
|
||||
texture = 58;
|
||||
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 = 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 = 58;
|
||||
|
||||
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 = 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 = 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 = 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 = 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;
|
||||
}
|
||||
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;
|
||||
|
||||
protected static boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta)
|
||||
{
|
||||
int x2 = x, y2 = y, z2 = z;
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if (getBlockOrFacade(world, x2, y2, z2, side) == null || getBlockOrFacade(world, x, y, z, side) == null || block == null)
|
||||
return false;
|
||||
protected static boolean isConnected(IBlockAccess world, int x, int y, int z, int side, Block block, int meta) {
|
||||
int x2 = x, y2 = y, z2 = z;
|
||||
|
||||
return getBlockOrFacade(world, x, y, z, side).equals(block) && getBlockOrFacadeMetadata(world, x, y, z, side) == meta && (!getBlockOrFacade(world, x2, y2, z2, side).equals(block) || getBlockOrFacadeMetadata(world, x2, y2, z2, side) != meta);
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (getBlockOrFacade(world, x2, y2, z2, side) == null || getBlockOrFacade(world, x, y, z, side) == null || block == null)
|
||||
return false;
|
||||
|
||||
public static int getBlockOrFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block blk = world.getBlock(x, y, z);
|
||||
if(blk instanceof IFacade) {
|
||||
return ((IFacade)blk).getFacadeMetadata(world, x, y, z, side);
|
||||
}
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
return getBlockOrFacade(world, x, y, z, side).equals(block) && getBlockOrFacadeMetadata(world, x, y, z, side) == meta
|
||||
&& (!getBlockOrFacade(world, x2, y2, z2, side).equals(block) || getBlockOrFacadeMetadata(world, x2, y2, z2, side) != meta);
|
||||
}
|
||||
|
||||
public static Block getBlockOrFacade(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block blk = world.getBlock(x, y, z);
|
||||
if(blk instanceof IFacade) {
|
||||
blk = ((IFacade)blk).getFacade(world, x, y, z, side);
|
||||
}
|
||||
return blk;
|
||||
}
|
||||
public static int getBlockOrFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block blk = world.getBlock(x, y, z);
|
||||
if (blk instanceof IFacade) {
|
||||
return ((IFacade) blk).getFacadeMetadata(world, x, y, z, side);
|
||||
}
|
||||
return world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
public static Block getBlockOrFacade(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block blk = world.getBlock(x, y, z);
|
||||
if (blk instanceof IFacade) {
|
||||
blk = ((IFacade) blk).getFacade(world, x, y, z, side);
|
||||
}
|
||||
return blk;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,423 +5,394 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class RenderBlocksCTM extends RenderBlocks
|
||||
{
|
||||
// globals added to save the JVM some trouble. No need to constantly create and destroy ints if we don't have to
|
||||
int blockLightBitChannel = 0;
|
||||
int redBitChannel = 0;
|
||||
int greenBitChannel = 0;
|
||||
int blueBitChannel = 0;
|
||||
int sunlightBitChannel = 0;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
// Updated to safely average light and color channels
|
||||
L[e] = averageBrightnessChannels(brightnessBottomLeft, brightnessTopLeft, brightnessTopRight, brightnessBottomRight);
|
||||
L[xa] = averageBrightnessChannels(L[a], L[b]);
|
||||
L[xb] = averageBrightnessChannels(L[b], L[c]);
|
||||
L[xc] = averageBrightnessChannels(L[c], L[d]);
|
||||
L[xd] = averageBrightnessChannels(L[d], L[a]);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Takes in a variable number of packed light-integers, and computes the average value
|
||||
* of each 4 bit channel
|
||||
*
|
||||
* For vanilla, these look like:
|
||||
* (S = skylight and L = block light)
|
||||
* 0000 0000 SSSS 0000 0000 0000 LLLL 0000
|
||||
* With the Colored Light Core installed, these look like:
|
||||
* (B = Blue, G = Green, R = Red)
|
||||
* 0000 0000 SSSS BBBB GGGG RRRR LLLL 0000
|
||||
*
|
||||
* This method will average all of the values appropriately for the more complex case,
|
||||
* by separating each color channel into a running total, then it will combine the
|
||||
* final results together using integer division and a lot of bit-cramming.
|
||||
*
|
||||
* While slightly more complex, the runtime should not be drastically effected, and
|
||||
* the averaging routine remains compatible with vanilla.
|
||||
*
|
||||
* Authored: CptSpaceToaster - 12/19/2014
|
||||
*/
|
||||
int averageBrightnessChannels(int ... lightVals) {
|
||||
blockLightBitChannel = 0;
|
||||
redBitChannel = 0;
|
||||
greenBitChannel = 0;
|
||||
blueBitChannel = 0;
|
||||
sunlightBitChannel = 0;
|
||||
|
||||
for (int light : lightVals) {
|
||||
blockLightBitChannel += (light & 0xFF);
|
||||
redBitChannel += (light & 0xF00);
|
||||
greenBitChannel += (light & 0xF000);
|
||||
blueBitChannel += (light & 0xF0000);
|
||||
sunlightBitChannel += (light & 0xF00000);
|
||||
}
|
||||
|
||||
return ((blockLightBitChannel/lightVals.length) & 0xFF) |
|
||||
((redBitChannel/lightVals.length) & 0xF00) |
|
||||
((greenBitChannel/lightVals.length) & 0xF000) |
|
||||
((blueBitChannel/lightVals.length) & 0xF0000) |
|
||||
((sunlightBitChannel/lightVals.length) & 0xF00000);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
public class RenderBlocksCTM extends RenderBlocks {
|
||||
|
||||
// globals added to save the JVM some trouble. No need to constantly create
|
||||
// and destroy ints if we don't have to
|
||||
int blockLightBitChannel = 0;
|
||||
int redBitChannel = 0;
|
||||
int greenBitChannel = 0;
|
||||
int blueBitChannel = 0;
|
||||
int sunlightBitChannel = 0;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
// Updated to safely average light and color channels
|
||||
L[e] = averageBrightnessChannels(brightnessBottomLeft, brightnessTopLeft, brightnessTopRight, brightnessBottomRight);
|
||||
L[xa] = averageBrightnessChannels(L[a], L[b]);
|
||||
L[xb] = averageBrightnessChannels(L[b], L[c]);
|
||||
L[xc] = averageBrightnessChannels(L[c], L[d]);
|
||||
L[xd] = averageBrightnessChannels(L[d], L[a]);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Takes in a variable number of packed light-integers, and computes the
|
||||
* average value of each 4 bit channel
|
||||
*
|
||||
* For vanilla, these look like: (S = skylight and L = block light) 0000
|
||||
* 0000 SSSS 0000 0000 0000 LLLL 0000 With the Colored Light Core installed,
|
||||
* these look like: (B = Blue, G = Green, R = Red) 0000 0000 SSSS BBBB GGGG
|
||||
* RRRR LLLL 0000
|
||||
*
|
||||
* This method will average all of the values appropriately for the more
|
||||
* complex case, by separating each color channel into a running total, then
|
||||
* it will combine the final results together using integer division and a
|
||||
* lot of bit-cramming.
|
||||
*
|
||||
* While slightly more complex, the runtime should not be drastically
|
||||
* effected, and the averaging routine remains compatible with vanilla.
|
||||
*
|
||||
* Authored: CptSpaceToaster - 12/19/2014
|
||||
*/
|
||||
int averageBrightnessChannels(int... lightVals) {
|
||||
blockLightBitChannel = 0;
|
||||
redBitChannel = 0;
|
||||
greenBitChannel = 0;
|
||||
blueBitChannel = 0;
|
||||
sunlightBitChannel = 0;
|
||||
|
||||
for (int light : lightVals) {
|
||||
blockLightBitChannel += (light & 0xFF);
|
||||
redBitChannel += (light & 0xF00);
|
||||
greenBitChannel += (light & 0xF000);
|
||||
blueBitChannel += (light & 0xF0000);
|
||||
sunlightBitChannel += (light & 0xF00000);
|
||||
}
|
||||
|
||||
return ((blockLightBitChannel / lightVals.length) & 0xFF) | ((redBitChannel / lightVals.length) & 0xF00) | ((greenBitChannel / lightVals.length) & 0xF000)
|
||||
| ((blueBitChannel / lightVals.length) & 0xF0000) | ((sunlightBitChannel / lightVals.length) & 0xF00000);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -3,47 +3,39 @@ package com.cricketcraft.chisel.client.render;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class RenderBlocksCTMCarpet extends RenderBlocksCTM
|
||||
{
|
||||
RenderBlocksCTMCarpet()
|
||||
{
|
||||
super();
|
||||
}
|
||||
public class RenderBlocksCTMCarpet extends RenderBlocksCTM {
|
||||
|
||||
@Override
|
||||
void resetVertices()
|
||||
{
|
||||
super.resetVertices();
|
||||
RenderBlocksCTMCarpet() {
|
||||
super();
|
||||
}
|
||||
|
||||
for(int i = 0; i < Y.length; i++)
|
||||
{
|
||||
Y[i] /= 16;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
void resetVertices() {
|
||||
super.resetVertices();
|
||||
|
||||
for (int i = 0; i < Y.length; i++) {
|
||||
Y[i] /= 16;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
rendererOld.renderFaceXNeg(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceXNeg(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
rendererOld.renderFaceXPos(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceXPos(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
rendererOld.renderFaceZNeg(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceZNeg(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
rendererOld.renderFaceZPos(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
rendererOld.renderFaceZPos(block, 0, 0, 0, submapSmall.icon);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,158 +5,140 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderBlocksColumn extends RenderBlocks
|
||||
{
|
||||
TextureSubmap submap;
|
||||
IIcon iconTop;
|
||||
IIcon sides[] = new IIcon[6];
|
||||
public class RenderBlocksColumn extends RenderBlocks {
|
||||
|
||||
RenderBlocksColumn()
|
||||
{
|
||||
super();
|
||||
}
|
||||
TextureSubmap submap;
|
||||
IIcon iconTop;
|
||||
IIcon sides[] = new IIcon[6];
|
||||
|
||||
boolean connected(IBlockAccess world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
return world.getBlock(x, y, z).equals(block) && world.getBlockMetadata(x, y, z) == meta;
|
||||
}
|
||||
RenderBlocksColumn() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z)
|
||||
{
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
boolean connected(IBlockAccess world, int x, int y, int z, Block block, int meta) {
|
||||
return world.getBlock(x, y, z).equals(block) && world.getBlockMetadata(x, y, z) == meta;
|
||||
}
|
||||
|
||||
boolean yp = connected(blockAccess, x, y + 1, z, block, metadata);
|
||||
boolean yn = connected(blockAccess, x, y - 1, z, block, metadata);
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
|
||||
if(yp || yn)
|
||||
{
|
||||
sides[0] = iconTop;
|
||||
sides[1] = iconTop;
|
||||
boolean yp = connected(blockAccess, x, y + 1, z, block, metadata);
|
||||
boolean yn = connected(blockAccess, x, y - 1, z, block, metadata);
|
||||
|
||||
if(yp && yn)
|
||||
sides[2] = submap.icons[2];
|
||||
else if(yp)
|
||||
sides[2] = submap.icons[3];
|
||||
else
|
||||
sides[2] = submap.icons[1];
|
||||
if (yp || yn) {
|
||||
sides[0] = iconTop;
|
||||
sides[1] = iconTop;
|
||||
|
||||
sides[3] = sides[4] = sides[5] = sides[2];
|
||||
} else
|
||||
{
|
||||
boolean xp = connected(blockAccess, x + 1, y, z, block, metadata);
|
||||
boolean xn = connected(blockAccess, x - 1, y, z, block, metadata);
|
||||
if (yp && yn)
|
||||
sides[2] = submap.icons[2];
|
||||
else if (yp)
|
||||
sides[2] = submap.icons[3];
|
||||
else
|
||||
sides[2] = submap.icons[1];
|
||||
|
||||
if(xp && (connected(blockAccess, x + 1, y + 1, z, block, metadata) || connected(blockAccess, x + 1, y - 1, z, block, metadata)))
|
||||
xp = false;
|
||||
if(xn && (connected(blockAccess, x - 1, y + 1, z, block, metadata) || connected(blockAccess, x - 1, y - 1, z, block, metadata)))
|
||||
xn = false;
|
||||
sides[3] = sides[4] = sides[5] = sides[2];
|
||||
} else {
|
||||
boolean xp = connected(blockAccess, x + 1, y, z, block, metadata);
|
||||
boolean xn = connected(blockAccess, x - 1, y, z, block, metadata);
|
||||
|
||||
if(xp || xn)
|
||||
{
|
||||
uvRotateEast = 2;
|
||||
uvRotateWest = 1;
|
||||
uvRotateTop = 1;
|
||||
uvRotateBottom = 1;
|
||||
if (xp && (connected(blockAccess, x + 1, y + 1, z, block, metadata) || connected(blockAccess, x + 1, y - 1, z, block, metadata)))
|
||||
xp = false;
|
||||
if (xn && (connected(blockAccess, x - 1, y + 1, z, block, metadata) || connected(blockAccess, x - 1, y - 1, z, block, metadata)))
|
||||
xn = false;
|
||||
|
||||
sides[4] = iconTop;
|
||||
sides[5] = iconTop;
|
||||
if (xp || xn) {
|
||||
uvRotateEast = 2;
|
||||
uvRotateWest = 1;
|
||||
uvRotateTop = 1;
|
||||
uvRotateBottom = 1;
|
||||
|
||||
if(xp && xn)
|
||||
sides[0] = submap.icons[2];
|
||||
else if(xp)
|
||||
sides[0] = submap.icons[3];
|
||||
else
|
||||
sides[0] = submap.icons[1];
|
||||
sides[4] = iconTop;
|
||||
sides[5] = iconTop;
|
||||
|
||||
sides[1] = sides[2] = sides[3] = sides[0];
|
||||
} else
|
||||
{
|
||||
boolean zp = connected(blockAccess, x, y, z + 1, block, metadata);
|
||||
boolean zn = connected(blockAccess, x, y, z - 1, block, metadata);
|
||||
if (xp && xn)
|
||||
sides[0] = submap.icons[2];
|
||||
else if (xp)
|
||||
sides[0] = submap.icons[3];
|
||||
else
|
||||
sides[0] = submap.icons[1];
|
||||
|
||||
if(zp && (connected(blockAccess, x, y + 1, z + 1, block, metadata) || connected(blockAccess, x, y - 1, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if(zp && (connected(blockAccess, x + 1, y, z + 1, block, metadata) || connected(blockAccess, x - 1, y, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if(zn && (connected(blockAccess, x, y + 1, z - 1, block, metadata) || connected(blockAccess, x, y - 1, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
if(zn && (connected(blockAccess, x + 1, y, z - 1, block, metadata) || connected(blockAccess, x - 1, y, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
sides[1] = sides[2] = sides[3] = sides[0];
|
||||
} else {
|
||||
boolean zp = connected(blockAccess, x, y, z + 1, block, metadata);
|
||||
boolean zn = connected(blockAccess, x, y, z - 1, block, metadata);
|
||||
|
||||
if(zp || zn)
|
||||
{
|
||||
uvRotateSouth = 1;
|
||||
uvRotateNorth = 2;
|
||||
if (zp && (connected(blockAccess, x, y + 1, z + 1, block, metadata) || connected(blockAccess, x, y - 1, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if (zp && (connected(blockAccess, x + 1, y, z + 1, block, metadata) || connected(blockAccess, x - 1, y, z + 1, block, metadata)))
|
||||
zp = false;
|
||||
if (zn && (connected(blockAccess, x, y + 1, z - 1, block, metadata) || connected(blockAccess, x, y - 1, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
if (zn && (connected(blockAccess, x + 1, y, z - 1, block, metadata) || connected(blockAccess, x - 1, y, z - 1, block, metadata)))
|
||||
zn = false;
|
||||
|
||||
sides[2] = iconTop;
|
||||
sides[3] = iconTop;
|
||||
if (zp || zn) {
|
||||
uvRotateSouth = 1;
|
||||
uvRotateNorth = 2;
|
||||
|
||||
if(zp && zn)
|
||||
sides[0] = submap.icons[2];
|
||||
else if(zp)
|
||||
sides[0] = submap.icons[1];
|
||||
else
|
||||
sides[0] = submap.icons[3];
|
||||
sides[2] = iconTop;
|
||||
sides[3] = iconTop;
|
||||
|
||||
sides[1] = sides[4] = sides[5] = sides[0];
|
||||
} else
|
||||
{
|
||||
sides[0] = sides[1] = iconTop;
|
||||
sides[2] = sides[3] = sides[4] = sides[5] = submap.icons[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (zp && zn)
|
||||
sides[0] = submap.icons[2];
|
||||
else if (zp)
|
||||
sides[0] = submap.icons[1];
|
||||
else
|
||||
sides[0] = submap.icons[3];
|
||||
|
||||
sides[1] = sides[4] = sides[5] = sides[0];
|
||||
} else {
|
||||
sides[0] = sides[1] = iconTop;
|
||||
sides[2] = sides[3] = sides[4] = sides[5] = submap.icons[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean flag = super.renderStandardBlock(block, x, y, z);
|
||||
boolean flag = super.renderStandardBlock(block, x, y, z);
|
||||
|
||||
uvRotateSouth = 0;
|
||||
uvRotateEast = 0;
|
||||
uvRotateWest = 0;
|
||||
uvRotateNorth = 0;
|
||||
uvRotateTop = 0;
|
||||
uvRotateBottom = 0;
|
||||
uvRotateSouth = 0;
|
||||
uvRotateEast = 0;
|
||||
uvRotateWest = 0;
|
||||
uvRotateNorth = 0;
|
||||
uvRotateTop = 0;
|
||||
uvRotateBottom = 0;
|
||||
|
||||
return flag;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXNeg(block, x, y, z, sides[4]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
super.renderFaceXNeg(block, x, y, z, sides[4]);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceXPos(block, x, y, z, sides[5]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
super.renderFaceXPos(block, x, y, z, sides[5]);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZNeg(block, x, y, z, sides[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
super.renderFaceZNeg(block, x, y, z, sides[2]);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceZPos(block, x, y, z, sides[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYNeg(block, x, y, z, sides[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
super.renderFaceZPos(block, x, y, z, sides[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
super.renderFaceYNeg(block, x, y, z, sides[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
super.renderFaceYPos(block, x, y, z, sides[1]);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
super.renderFaceYPos(block, x, y, z, sides[1]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,324 +5,290 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class RenderBlocksEldritch extends RenderBlocks
|
||||
{
|
||||
public class RenderBlocksEldritch extends RenderBlocks {
|
||||
|
||||
RenderBlocksEldritch()
|
||||
{
|
||||
super();
|
||||
}
|
||||
RenderBlocksEldritch() {
|
||||
super();
|
||||
}
|
||||
|
||||
static double displacementMap[] = {
|
||||
+0.1165, -0.0352, -0.1208, +0.0906, -0.0295, +0.0302, -0.0973, +0.0548,
|
||||
-0.1077, +0.0662, -0.0932, -0.0925, -0.1161, +0.0073, -0.1084, +0.1136,
|
||||
+0.0307, +0.0316, -0.1066, -0.0237, +0.0614, -0.0864, +0.0837, +0.1218,
|
||||
+0.0502, -0.0529, -0.0942, +0.1209, -0.0418, +0.1035, +0.0066, -0.0255,
|
||||
+0.0830, -0.0361, +0.0965, +0.0646, +0.1124, +0.0890, -0.0037, +0.0467,
|
||||
+0.1025, +0.1161, +0.0014, +0.0365, +0.0755, -0.0025, +0.0739, +0.0656,
|
||||
+0.0571, -0.0813, -0.0062, -0.0904, -0.0005, +0.0612, -0.0227, +0.0138,
|
||||
-0.0899, -0.0019, -0.1047, +0.1191, -0.1197, -0.1123, +0.0999, +0.0638,
|
||||
+0.0865, +0.0029, -0.0084, +0.1132, -0.0433, +0.0115, +0.0850, +0.0439,
|
||||
+0.0748, +0.0460, -0.0441, +0.0839, +0.0162, -0.0229, +0.0774, -0.0647,
|
||||
-0.0636, -0.0709, -0.0719, -0.0194, +0.1070, -0.0466, -0.1200, -0.0996,
|
||||
-0.0298, -0.1035, -0.0006, +0.0530, -0.0939, -0.1210, +0.0176, +0.0924,
|
||||
+0.0343, -0.0777, +0.1050, -0.0729, -0.0062, -0.1107, -0.0434, -0.0042,
|
||||
+0.0232, +0.0269, +0.0709, -0.0388, +0.0342, +0.0240, -0.0192, +0.0491,
|
||||
+0.0017, -0.1240, +0.0687, -0.1160, +0.1123, -0.0332, -0.0260, +0.0476,
|
||||
-0.0049, -0.0893, -0.0243, -0.0371, -0.0230, +0.0656, +0.1080, +0.0781,
|
||||
-0.0648, +0.0082, -0.1086, -0.0451, -0.0594, -0.1155, -0.0623, -0.0152,
|
||||
+0.0131, -0.0754, +0.0607, +0.0876, -0.0657, +0.0366, -0.0981, +0.1164,
|
||||
-0.0623, +0.0181, -0.0475, +0.0722, -0.0293, +0.0486, -0.0195, +0.1041,
|
||||
+0.1011, +0.0042, -0.0045, -0.1031, +0.0110, +0.0058, +0.0083, -0.0782,
|
||||
-0.1003, -0.0082, -0.0304, -0.0971, -0.0097, -0.0208, -0.1059, -0.0239,
|
||||
-0.0385, +0.0505, +0.0537, -0.1098, -0.0022, -0.0165, -0.0027, -0.0208,
|
||||
+0.0305, +0.0592, +0.0301, +0.0055, +0.1138, -0.0338, -0.0901, +0.1015,
|
||||
+0.0061, +0.0861, -0.1057, -0.0889, -0.0972, +0.0783, -0.1052, -0.0932,
|
||||
-0.1103, +0.0497, +0.1222, -0.0146, +0.0632, -0.0240, -0.0193, +0.0676,
|
||||
-0.1128, -0.0886, +0.0926, +0.0538, -0.0175, -0.0966, -0.0369, +0.1124,
|
||||
-0.0820, -0.1013, -0.0836, -0.0981, -0.0502, +0.0573, +0.0616, -0.0458,
|
||||
+0.0294, +0.0108, -0.0782, +0.0692, +0.0234, -0.0178, -0.0171, -0.0505,
|
||||
-0.0313, +0.0538, +0.0462, -0.0758, +0.0556, -0.0023, -0.1086, -0.0100,
|
||||
-0.0897, -0.0409, -0.1161, +0.0212, +0.1229, -0.0945, +0.0341, +0.1238,
|
||||
+0.0893, -0.1189, -0.1098, -0.0125, +0.1137, -0.0202, +0.0239, -0.0408,
|
||||
+0.0920, +0.0777, -0.0085, -0.0572, -0.0293, -0.0131, +0.0272, +0.0991,
|
||||
};
|
||||
static double displacementMap[] = { +0.1165, -0.0352, -0.1208, +0.0906, -0.0295, +0.0302, -0.0973, +0.0548, -0.1077, +0.0662, -0.0932, -0.0925, -0.1161, +0.0073, -0.1084, +0.1136, +0.0307,
|
||||
+0.0316, -0.1066, -0.0237, +0.0614, -0.0864, +0.0837, +0.1218, +0.0502, -0.0529, -0.0942, +0.1209, -0.0418, +0.1035, +0.0066, -0.0255, +0.0830, -0.0361, +0.0965, +0.0646, +0.1124,
|
||||
+0.0890, -0.0037, +0.0467, +0.1025, +0.1161, +0.0014, +0.0365, +0.0755, -0.0025, +0.0739, +0.0656, +0.0571, -0.0813, -0.0062, -0.0904, -0.0005, +0.0612, -0.0227, +0.0138, -0.0899,
|
||||
-0.0019, -0.1047, +0.1191, -0.1197, -0.1123, +0.0999, +0.0638, +0.0865, +0.0029, -0.0084, +0.1132, -0.0433, +0.0115, +0.0850, +0.0439, +0.0748, +0.0460, -0.0441, +0.0839, +0.0162,
|
||||
-0.0229, +0.0774, -0.0647, -0.0636, -0.0709, -0.0719, -0.0194, +0.1070, -0.0466, -0.1200, -0.0996, -0.0298, -0.1035, -0.0006, +0.0530, -0.0939, -0.1210, +0.0176, +0.0924, +0.0343,
|
||||
-0.0777, +0.1050, -0.0729, -0.0062, -0.1107, -0.0434, -0.0042, +0.0232, +0.0269, +0.0709, -0.0388, +0.0342, +0.0240, -0.0192, +0.0491, +0.0017, -0.1240, +0.0687, -0.1160, +0.1123,
|
||||
-0.0332, -0.0260, +0.0476, -0.0049, -0.0893, -0.0243, -0.0371, -0.0230, +0.0656, +0.1080, +0.0781, -0.0648, +0.0082, -0.1086, -0.0451, -0.0594, -0.1155, -0.0623, -0.0152, +0.0131,
|
||||
-0.0754, +0.0607, +0.0876, -0.0657, +0.0366, -0.0981, +0.1164, -0.0623, +0.0181, -0.0475, +0.0722, -0.0293, +0.0486, -0.0195, +0.1041, +0.1011, +0.0042, -0.0045, -0.1031, +0.0110,
|
||||
+0.0058, +0.0083, -0.0782, -0.1003, -0.0082, -0.0304, -0.0971, -0.0097, -0.0208, -0.1059, -0.0239, -0.0385, +0.0505, +0.0537, -0.1098, -0.0022, -0.0165, -0.0027, -0.0208, +0.0305,
|
||||
+0.0592, +0.0301, +0.0055, +0.1138, -0.0338, -0.0901, +0.1015, +0.0061, +0.0861, -0.1057, -0.0889, -0.0972, +0.0783, -0.1052, -0.0932, -0.1103, +0.0497, +0.1222, -0.0146, +0.0632,
|
||||
-0.0240, -0.0193, +0.0676, -0.1128, -0.0886, +0.0926, +0.0538, -0.0175, -0.0966, -0.0369, +0.1124, -0.0820, -0.1013, -0.0836, -0.0981, -0.0502, +0.0573, +0.0616, -0.0458, +0.0294,
|
||||
+0.0108, -0.0782, +0.0692, +0.0234, -0.0178, -0.0171, -0.0505, -0.0313, +0.0538, +0.0462, -0.0758, +0.0556, -0.0023, -0.1086, -0.0100, -0.0897, -0.0409, -0.1161, +0.0212, +0.1229,
|
||||
-0.0945, +0.0341, +0.1238, +0.0893, -0.1189, -0.1098, -0.0125, +0.1137, -0.0202, +0.0239, -0.0408, +0.0920, +0.0777, -0.0085, -0.0572, -0.0293, -0.0131, +0.0272, +0.0991, };
|
||||
|
||||
static int dmap1 = displacementMap.length * 1 / 6;
|
||||
static int dmap2 = displacementMap.length * 2 / 6;
|
||||
static int dmap3 = displacementMap.length * 3 / 6;
|
||||
static int dmap4 = displacementMap.length * 4 / 6;
|
||||
static int dmap5 = displacementMap.length * 5 / 6;
|
||||
static int dmap = displacementMap.length;
|
||||
static int dmap1 = displacementMap.length * 1 / 6;
|
||||
static int dmap2 = displacementMap.length * 2 / 6;
|
||||
static int dmap3 = displacementMap.length * 3 / 6;
|
||||
static int dmap4 = displacementMap.length * 4 / 6;
|
||||
static int dmap5 = displacementMap.length * 5 / 6;
|
||||
static int dmap = displacementMap.length;
|
||||
|
||||
Tessellator tessellator;
|
||||
double[] X = new double[14];
|
||||
double[] Y = new double[14];
|
||||
double[] Z = new double[14];
|
||||
double[] U = new double[14];
|
||||
double[] V = new double[14];
|
||||
int[] L = new int[14];
|
||||
float[] R = new float[14];
|
||||
float[] G = new float[14];
|
||||
float[] B = new float[14];
|
||||
Tessellator tessellator;
|
||||
double[] X = new double[14];
|
||||
double[] Y = new double[14];
|
||||
double[] Z = new double[14];
|
||||
double[] U = new double[14];
|
||||
double[] V = new double[14];
|
||||
int[] L = new int[14];
|
||||
float[] R = new float[14];
|
||||
float[] G = new float[14];
|
||||
float[] B = new float[14];
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z)
|
||||
{
|
||||
int index = x + y * 34573 + z * 32465781;
|
||||
if(index < 0) index = -index;
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block block, int x, int y, int z) {
|
||||
int index = x + y * 34573 + z * 32465781;
|
||||
if (index < 0)
|
||||
index = -index;
|
||||
|
||||
X[0] = x;
|
||||
Z[0] = z;
|
||||
Y[0] = y;
|
||||
X[0] = x;
|
||||
Z[0] = z;
|
||||
Y[0] = y;
|
||||
|
||||
X[1] = x;
|
||||
Z[1] = z;
|
||||
Y[1] = y + 1;
|
||||
X[1] = x;
|
||||
Z[1] = z;
|
||||
Y[1] = y + 1;
|
||||
|
||||
X[2] = x + 1;
|
||||
Z[2] = z;
|
||||
Y[2] = y + 1;
|
||||
X[2] = x + 1;
|
||||
Z[2] = z;
|
||||
Y[2] = y + 1;
|
||||
|
||||
X[3] = x + 1;
|
||||
Z[3] = z;
|
||||
Y[3] = y;
|
||||
X[3] = x + 1;
|
||||
Z[3] = z;
|
||||
Y[3] = y;
|
||||
|
||||
X[4] = x;
|
||||
Z[4] = z + 1;
|
||||
Y[4] = y;
|
||||
X[4] = x;
|
||||
Z[4] = z + 1;
|
||||
Y[4] = y;
|
||||
|
||||
X[5] = x;
|
||||
Z[5] = z + 1;
|
||||
Y[5] = y + 1;
|
||||
X[5] = x;
|
||||
Z[5] = z + 1;
|
||||
Y[5] = y + 1;
|
||||
|
||||
X[6] = x + 1;
|
||||
Z[6] = z + 1;
|
||||
Y[6] = y + 1;
|
||||
X[6] = x + 1;
|
||||
Z[6] = z + 1;
|
||||
Y[6] = y + 1;
|
||||
|
||||
X[7] = x + 1;
|
||||
Z[7] = z + 1;
|
||||
Y[7] = y;
|
||||
X[7] = x + 1;
|
||||
Z[7] = z + 1;
|
||||
Y[7] = y;
|
||||
|
||||
X[8] = x + 0.5 + displacementMap[(index + 0) % dmap];
|
||||
Z[8] = z - displacementMap[(index + 10) % dmap];
|
||||
Y[8] = y + 0.5 + displacementMap[(index + 20) % dmap];
|
||||
X[8] = x + 0.5 + displacementMap[(index + 0) % dmap];
|
||||
Z[8] = z - displacementMap[(index + 10) % dmap];
|
||||
Y[8] = y + 0.5 + displacementMap[(index + 20) % dmap];
|
||||
|
||||
X[9] = x - displacementMap[(index + 0 + dmap1) % dmap];
|
||||
Z[9] = z + 0.5 + displacementMap[(index + 10 + dmap1) % dmap];
|
||||
Y[9] = y + 0.5 + displacementMap[(index + 20 + dmap1) % dmap];
|
||||
X[9] = x - displacementMap[(index + 0 + dmap1) % dmap];
|
||||
Z[9] = z + 0.5 + displacementMap[(index + 10 + dmap1) % dmap];
|
||||
Y[9] = y + 0.5 + displacementMap[(index + 20 + dmap1) % dmap];
|
||||
|
||||
X[10] = x + 0.5 + displacementMap[(index + 0 + dmap2) % dmap];
|
||||
Z[10] = z + 1 + displacementMap[(index + 10 + dmap2) % dmap];
|
||||
Y[10] = y + 0.5 + displacementMap[(index + 20 + dmap2) % dmap];
|
||||
X[10] = x + 0.5 + displacementMap[(index + 0 + dmap2) % dmap];
|
||||
Z[10] = z + 1 + displacementMap[(index + 10 + dmap2) % dmap];
|
||||
Y[10] = y + 0.5 + displacementMap[(index + 20 + dmap2) % dmap];
|
||||
|
||||
X[11] = x + 1 + displacementMap[(index + 0 + dmap3) % dmap];
|
||||
Z[11] = z + 0.5 + displacementMap[(index + 10 + dmap3) % dmap];
|
||||
Y[11] = y + 0.5 + displacementMap[(index + 20 + dmap3) % dmap];
|
||||
X[11] = x + 1 + displacementMap[(index + 0 + dmap3) % dmap];
|
||||
Z[11] = z + 0.5 + displacementMap[(index + 10 + dmap3) % dmap];
|
||||
Y[11] = y + 0.5 + displacementMap[(index + 20 + dmap3) % dmap];
|
||||
|
||||
X[12] = x + 0.5 + displacementMap[(index + 0 + dmap4) % dmap];
|
||||
Z[12] = z + 0.5 + displacementMap[(index + 10 + dmap4) % dmap];
|
||||
Y[12] = y + 1;//+displacementMap[(index+20+dmap4)%dmap];
|
||||
X[12] = x + 0.5 + displacementMap[(index + 0 + dmap4) % dmap];
|
||||
Z[12] = z + 0.5 + displacementMap[(index + 10 + dmap4) % dmap];
|
||||
Y[12] = y + 1;// +displacementMap[(index+20+dmap4)%dmap];
|
||||
|
||||
X[13] = x + 0.5 + displacementMap[(index + 0 + dmap5) % dmap];
|
||||
Z[13] = z + 0.5 + displacementMap[(index + 10 + dmap5) % dmap];
|
||||
Y[13] = y + 0;//+displacementMap[(index+20+dmap5)%dmap];
|
||||
X[13] = x + 0.5 + displacementMap[(index + 0 + dmap5) % dmap];
|
||||
Z[13] = z + 0.5 + displacementMap[(index + 10 + dmap5) % dmap];
|
||||
Y[13] = y + 0;// +displacementMap[(index+20+dmap5)%dmap];
|
||||
|
||||
tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
tessellator = Tessellator.instance;
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
|
||||
return super.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
return super.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
void setupSides(IIcon icon, int a, int b, int c, int d, int e, int ta, int tb, int tc, int td)
|
||||
{
|
||||
L[a] = brightnessBottomLeft;
|
||||
L[b] = brightnessBottomRight;
|
||||
L[c] = brightnessTopRight;
|
||||
L[d] = brightnessTopLeft;
|
||||
L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4;
|
||||
void setupSides(IIcon icon, int a, int b, int c, int d, int e, int ta, int tb, int tc, int td) {
|
||||
L[a] = brightnessBottomLeft;
|
||||
L[b] = brightnessBottomRight;
|
||||
L[c] = brightnessTopRight;
|
||||
L[d] = brightnessTopLeft;
|
||||
L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4;
|
||||
|
||||
R[a] = colorRedBottomLeft;
|
||||
R[b] = colorRedBottomRight;
|
||||
R[c] = colorRedTopRight;
|
||||
R[d] = colorRedTopLeft;
|
||||
R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4;
|
||||
R[a] = colorRedBottomLeft;
|
||||
R[b] = colorRedBottomRight;
|
||||
R[c] = colorRedTopRight;
|
||||
R[d] = colorRedTopLeft;
|
||||
R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4;
|
||||
|
||||
G[a] = colorGreenBottomLeft;
|
||||
G[b] = colorGreenBottomRight;
|
||||
G[c] = colorGreenTopRight;
|
||||
G[d] = colorGreenTopLeft;
|
||||
G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4;
|
||||
G[a] = colorGreenBottomLeft;
|
||||
G[b] = colorGreenBottomRight;
|
||||
G[c] = colorGreenTopRight;
|
||||
G[d] = colorGreenTopLeft;
|
||||
G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4;
|
||||
|
||||
B[a] = colorBlueBottomLeft;
|
||||
B[b] = colorBlueBottomRight;
|
||||
B[c] = colorBlueTopRight;
|
||||
B[d] = colorBlueTopLeft;
|
||||
B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4;
|
||||
B[a] = colorBlueBottomLeft;
|
||||
B[b] = colorBlueBottomRight;
|
||||
B[c] = colorBlueTopRight;
|
||||
B[d] = colorBlueTopLeft;
|
||||
B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4;
|
||||
|
||||
double u0 = icon.getMaxU();
|
||||
double u1 = icon.getMinU();
|
||||
double v0 = icon.getMaxV();
|
||||
double v1 = icon.getMinV();
|
||||
double u0 = icon.getMaxU();
|
||||
double u1 = icon.getMinU();
|
||||
double v0 = icon.getMaxV();
|
||||
double v1 = icon.getMinV();
|
||||
|
||||
U[ta] = u0;
|
||||
U[tb] = u0;
|
||||
U[tc] = u1;
|
||||
U[td] = u1;
|
||||
U[e] = icon.getInterpolatedU(8.0D);
|
||||
U[ta] = u0;
|
||||
U[tb] = u0;
|
||||
U[tc] = u1;
|
||||
U[td] = u1;
|
||||
U[e] = icon.getInterpolatedU(8.0D);
|
||||
|
||||
V[ta] = v0;
|
||||
V[tb] = v1;
|
||||
V[tc] = v1;
|
||||
V[td] = v0;
|
||||
V[e] = icon.getInterpolatedV(8.0D);
|
||||
}
|
||||
V[ta] = v0;
|
||||
V[tb] = v1;
|
||||
V[tc] = v1;
|
||||
V[td] = v0;
|
||||
V[e] = icon.getInterpolatedV(8.0D);
|
||||
}
|
||||
|
||||
void vert(int index)
|
||||
{
|
||||
if(enableAO)
|
||||
{
|
||||
tessellator.setColorOpaque_F(R[index], G[index], B[index]);
|
||||
tessellator.setBrightness(L[index]);
|
||||
}
|
||||
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]);
|
||||
}
|
||||
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)
|
||||
{
|
||||
setupSides(icon, 1, 0, 4, 5, 9, 4, 5, 1, 0);
|
||||
vert(1);
|
||||
vert(0);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(0);
|
||||
vert(4);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(4);
|
||||
vert(5);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(5);
|
||||
vert(1);
|
||||
vert(9);
|
||||
vert(9);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 1, 0, 4, 5, 9, 4, 5, 1, 0);
|
||||
vert(1);
|
||||
vert(0);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(0);
|
||||
vert(4);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(4);
|
||||
vert(5);
|
||||
vert(9);
|
||||
vert(9);
|
||||
vert(5);
|
||||
vert(1);
|
||||
vert(9);
|
||||
vert(9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
setupSides(icon, 3, 2, 6, 7, 11, 3, 2, 6, 7);
|
||||
vert(6);
|
||||
vert(7);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(7);
|
||||
vert(3);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(3);
|
||||
vert(2);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(2);
|
||||
vert(6);
|
||||
vert(11);
|
||||
vert(11);
|
||||
@Override
|
||||
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 3, 2, 6, 7, 11, 3, 2, 6, 7);
|
||||
vert(6);
|
||||
vert(7);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(7);
|
||||
vert(3);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(3);
|
||||
vert(2);
|
||||
vert(11);
|
||||
vert(11);
|
||||
vert(2);
|
||||
vert(6);
|
||||
vert(11);
|
||||
vert(11);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
setupSides(icon, 2, 3, 0, 1, 8, 0, 1, 2, 3);
|
||||
vert(0);
|
||||
vert(1);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(1);
|
||||
vert(2);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(2);
|
||||
vert(3);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(3);
|
||||
vert(0);
|
||||
vert(8);
|
||||
vert(8);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 2, 3, 0, 1, 8, 0, 1, 2, 3);
|
||||
vert(0);
|
||||
vert(1);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(1);
|
||||
vert(2);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(2);
|
||||
vert(3);
|
||||
vert(8);
|
||||
vert(8);
|
||||
vert(3);
|
||||
vert(0);
|
||||
vert(8);
|
||||
vert(8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 4, 7, 6, 5, 10, 7, 6, 5, 4);
|
||||
vert(5);
|
||||
vert(4);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(6);
|
||||
vert(5);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(7);
|
||||
vert(6);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(4);
|
||||
vert(7);
|
||||
vert(10);
|
||||
vert(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
setupSides(icon, 4, 7, 6, 5, 10, 7, 6, 5, 4);
|
||||
vert(5);
|
||||
vert(4);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(6);
|
||||
vert(5);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(7);
|
||||
vert(6);
|
||||
vert(10);
|
||||
vert(10);
|
||||
vert(4);
|
||||
vert(7);
|
||||
vert(10);
|
||||
vert(10);
|
||||
}
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 0, 3, 7, 4, 13, 0, 3, 7, 4);
|
||||
vert(0);
|
||||
vert(3);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(3);
|
||||
vert(7);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(7);
|
||||
vert(4);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(4);
|
||||
vert(0);
|
||||
vert(13);
|
||||
vert(13);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
|
||||
setupSides(icon, 2, 1, 5, 6, 12, 2, 1, 5, 6);
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
setupSides(icon, 0, 3, 7, 4, 13, 0, 3, 7, 4);
|
||||
vert(0);
|
||||
vert(3);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(3);
|
||||
vert(7);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(7);
|
||||
vert(4);
|
||||
vert(13);
|
||||
vert(13);
|
||||
vert(4);
|
||||
vert(0);
|
||||
vert(13);
|
||||
vert(13);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon)
|
||||
{
|
||||
setupSides(icon, 2, 1, 5, 6, 12, 2, 1, 5, 6);
|
||||
|
||||
vert(2);
|
||||
vert(1);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(1);
|
||||
vert(5);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(5);
|
||||
vert(6);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(6);
|
||||
vert(2);
|
||||
vert(12);
|
||||
vert(12);
|
||||
}
|
||||
vert(2);
|
||||
vert(1);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(1);
|
||||
vert(5);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(5);
|
||||
vert(6);
|
||||
vert(12);
|
||||
vert(12);
|
||||
vert(6);
|
||||
vert(2);
|
||||
vert(12);
|
||||
vert(12);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,33 +5,29 @@ import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class TextureSubmap
|
||||
{
|
||||
public int width, height;
|
||||
public IIcon icon;
|
||||
public IIcon icons[];
|
||||
public class TextureSubmap {
|
||||
|
||||
public TextureSubmap(IIcon i, int w, int h)
|
||||
{
|
||||
icon = i;
|
||||
width = w;
|
||||
height = h;
|
||||
icons = new IIcon[width * height];
|
||||
public int width, height;
|
||||
public IIcon icon;
|
||||
public IIcon icons[];
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
public TextureSubmap(IIcon i, int w, int h) {
|
||||
icon = i;
|
||||
width = w;
|
||||
height = h;
|
||||
icons = new IIcon[width * height];
|
||||
|
||||
@SubscribeEvent
|
||||
public void TexturesStitched(TextureStitchEvent.Post event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,89 +4,79 @@ import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TextureVirtual implements IIcon
|
||||
{
|
||||
int ox, oy;
|
||||
float u0, u1, v0, v1;
|
||||
String name;
|
||||
IIcon icon;
|
||||
public class TextureVirtual implements IIcon {
|
||||
|
||||
TextureVirtual(IIcon parent, int w, int h, int x, int y)
|
||||
{
|
||||
icon = parent;
|
||||
int ox, oy;
|
||||
float u0, u1, v0, v1;
|
||||
String name;
|
||||
IIcon icon;
|
||||
|
||||
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);
|
||||
TextureVirtual(IIcon parent, int w, int h, int x, int y) {
|
||||
icon = parent;
|
||||
|
||||
name = icon.getIconName() + "|" + x + "." + y;
|
||||
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);
|
||||
|
||||
ox = icon.getIconWidth();
|
||||
oy = icon.getIconHeight();
|
||||
}
|
||||
name = icon.getIconName() + "|" + x + "." + y;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinU()
|
||||
{
|
||||
return u0;
|
||||
}
|
||||
ox = icon.getIconWidth();
|
||||
oy = icon.getIconHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxU()
|
||||
{
|
||||
return u1;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinU() {
|
||||
return u0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedU(double d0)
|
||||
{
|
||||
return (float) (u0 + (u1 - u0) * d0 / 16.0);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxU() {
|
||||
return u1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinV()
|
||||
{
|
||||
return v0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedU(double d0) {
|
||||
return (float) (u0 + (u1 - u0) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxV()
|
||||
{
|
||||
return v1;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinV() {
|
||||
return v0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedV(double d0)
|
||||
{
|
||||
return (float) (v0 + (v1 - v0) * d0 / 16.0);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxV() {
|
||||
return v1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getIconName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedV(double d0) {
|
||||
return (float) (v0 + (v1 - v0) * d0 / 16.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconWidth()
|
||||
{
|
||||
return ox;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getIconName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconHeight()
|
||||
{
|
||||
return oy;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconWidth() {
|
||||
return ox;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getIconHeight() {
|
||||
return oy;
|
||||
}
|
||||
|
||||
}
|
||||
+64
-64
@@ -10,74 +10,74 @@ import com.cricketcraft.chisel.client.model.ModelAutoChisel;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class ItemAutoChiselRenderer implements IItemRenderer{
|
||||
public class ItemAutoChiselRenderer implements IItemRenderer {
|
||||
|
||||
private final ModelAutoChisel model = new ModelAutoChisel();
|
||||
private ResourceLocation texture;
|
||||
private final ModelAutoChisel model = new ModelAutoChisel();
|
||||
private ResourceLocation texture;
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (item.getItemDamage()){
|
||||
case 0:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
case 1:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_speed.png");
|
||||
break;
|
||||
case 2:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_automation.png");
|
||||
break;
|
||||
case 3:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_stack.png");
|
||||
break;
|
||||
default:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
}
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
|
||||
switch (type){
|
||||
case ENTITY:
|
||||
renderBlock(0.0F, 1.0F, 0.0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBlock(0.5F, 1.5F, 0.5F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBlock(0.5F, 1.0F, 0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderInventory(0.0F, 0.625F, 0.0F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (item.getItemDamage()) {
|
||||
case 0:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
case 1:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_speed.png");
|
||||
break;
|
||||
case 2:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_automation.png");
|
||||
break;
|
||||
case 3:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_stack.png");
|
||||
break;
|
||||
default:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
}
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderBlock(0.0F, 1.0F, 0.0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBlock(0.5F, 1.5F, 0.5F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBlock(0.5F, 1.0F, 0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderInventory(0.0F, 0.625F, 0.0F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBlock(float x, float y, float z){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glScaled(-1, -1, 1);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
private void renderBlock(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glScaled(-1, -1, 1);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderInventory(float x, float y, float z){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glRotatef(180F, 1F, 0, 0);
|
||||
GL11.glRotatef(-90F, 0, 1F, 0);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
private void renderInventory(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glRotatef(180F, 1F, 0, 0);
|
||||
GL11.glRotatef(-90F, 0, 1F, 0);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.8F);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -9,42 +9,41 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ItemChiselRenderer implements IItemRenderer
|
||||
{
|
||||
RenderBlocks renderBlock = new RenderBlocks();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
public class ItemChiselRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY;
|
||||
}
|
||||
RenderBlocks renderBlock = new RenderBlocks();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack stack, Object... data)
|
||||
{
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return false;
|
||||
}
|
||||
|
||||
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0);
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
if(stack.stackTagCompound == null) return;
|
||||
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0);
|
||||
|
||||
ItemStack chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget"));
|
||||
if(chiselTarget == null) return;
|
||||
if (stack.stackTagCompound == null)
|
||||
return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.65f, 0.65f, 0.65f);
|
||||
GL11.glTranslatef(-8f, -8f, 0.0f);
|
||||
ItemStack chiselTarget = ItemStack.loadItemStackFromNBT(stack.stackTagCompound.getCompoundTag("chiselTarget"));
|
||||
if (chiselTarget == null)
|
||||
return;
|
||||
|
||||
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, chiselTarget, 8, 8);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.65f, 0.65f, 0.65f);
|
||||
GL11.glTranslatef(-8f, -8f, 0.0f);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, chiselTarget, 8, 8);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +1,74 @@
|
||||
package com.cricketcraft.chisel.client.render.item;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockPresent;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockPresent;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class ItemPresentRenderer implements IItemRenderer {
|
||||
private final ModelChest model = new ModelChest();
|
||||
BlockPresent present;
|
||||
private int meta;
|
||||
public ItemPresentRenderer(int type){
|
||||
present = new BlockPresent(type);
|
||||
this.meta = type;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
private final ModelChest model = new ModelChest();
|
||||
BlockPresent present;
|
||||
private int meta;
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, present.getKindOfChest(meta) + ".png"));
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderBlock(0.0F, 1.0F, 0.0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBlock(0.5F, 1.5F, 0.5F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBlock(0.5F, 1.0F, 0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderInventory(1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
public ItemPresentRenderer(int type) {
|
||||
present = new BlockPresent(type);
|
||||
this.meta = type;
|
||||
}
|
||||
|
||||
private void renderBlock(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glScaled(-1, -1, 1);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
private void renderInventory(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glRotatef(180F, 1F, 0, 0);
|
||||
GL11.glRotatef(-90F, 0, 1F, 0);
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, present.getKindOfChest(meta) + ".png"));
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderBlock(0.0F, 1.0F, 0.0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderBlock(0.5F, 1.5F, 0.5F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
renderBlock(0.5F, 1.0F, 0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
renderInventory(1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderBlock(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glScaled(-1, -1, 1);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderInventory(float x, float y, float z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, z);
|
||||
GL11.glRotatef(180F, 1F, 0, 0);
|
||||
GL11.glRotatef(-90F, 0, 1F, 0);
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
model.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
package com.cricketcraft.chisel.client.render.tile;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
import static org.lwjgl.opengl.GL11.glScalef;
|
||||
import static org.lwjgl.opengl.GL11.glTranslatef;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -22,108 +17,111 @@ import com.cricketcraft.chisel.client.model.ModelAutoChisel;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class RenderAutoChisel extends TileEntitySpecialRenderer {
|
||||
|
||||
private static EntityItem ghostItem;
|
||||
private static TileEntityAutoChisel autoChisel;
|
||||
private final ModelAutoChisel model;
|
||||
private ResourceLocation texture;
|
||||
private final RenderItem renderTargetAndChisel, renderBase;
|
||||
private static EntityItem ghostItem;
|
||||
private static TileEntityAutoChisel autoChisel;
|
||||
private final ModelAutoChisel model;
|
||||
private ResourceLocation texture;
|
||||
private final RenderItem renderTargetAndChisel, renderBase;
|
||||
|
||||
public RenderAutoChisel(){
|
||||
model = new ModelAutoChisel();
|
||||
renderTargetAndChisel = new RenderItem(){
|
||||
@Override
|
||||
public boolean shouldBob(){
|
||||
return false;
|
||||
}
|
||||
};
|
||||
renderTargetAndChisel.setRenderManager(RenderManager.instance);
|
||||
public RenderAutoChisel() {
|
||||
model = new ModelAutoChisel();
|
||||
renderTargetAndChisel = new RenderItem() {
|
||||
|
||||
renderBase = new RenderItem(){
|
||||
@Override
|
||||
public boolean shouldBob(){
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
renderTargetAndChisel.setRenderManager(RenderManager.instance);
|
||||
|
||||
renderBase.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
renderBase = new RenderItem() {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
|
||||
switch (tile.getBlockMetadata()){
|
||||
case 0:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
case 1:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_speed.png");
|
||||
break;
|
||||
case 2:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_automation.png");
|
||||
break;
|
||||
case 3:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_stack.png");
|
||||
break;
|
||||
default:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
}
|
||||
bindTexture(texture);
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
glScalef(0.89F, 1.0F, 0.89F);
|
||||
this.model.renderAll();
|
||||
glPopMatrix();
|
||||
@Override
|
||||
public boolean shouldBob() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//Render Blocks
|
||||
autoChisel = (TileEntityAutoChisel) tile;
|
||||
EntityItem item = autoChisel.getItemForRendering(1);
|
||||
renderBase.setRenderManager(RenderManager.instance);
|
||||
}
|
||||
|
||||
if(item != null){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
GL11.glScaled(3, 3, 3);
|
||||
renderTargetAndChisel.doRender(item, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) {
|
||||
switch (tile.getBlockMetadata()) {
|
||||
case 0:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
case 1:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_speed.png");
|
||||
break;
|
||||
case 2:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_automation.png");
|
||||
break;
|
||||
case 3:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel_stack.png");
|
||||
break;
|
||||
default:
|
||||
texture = new ResourceLocation("chisel:textures/blocks/autoChisel/autoChisel.png");
|
||||
break;
|
||||
}
|
||||
bindTexture(texture);
|
||||
glPushMatrix();
|
||||
glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
glScalef(0.89F, 1.0F, 0.89F);
|
||||
this.model.renderAll();
|
||||
glPopMatrix();
|
||||
|
||||
EntityItem item2 = autoChisel.getItemForRendering(0);
|
||||
// Render Blocks
|
||||
autoChisel = (TileEntityAutoChisel) tile;
|
||||
EntityItem item = autoChisel.getItemForRendering(1);
|
||||
|
||||
if(item2 != null){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glScaled(1, 1, 1);
|
||||
renderBase.doRender(item2, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (item != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
GL11.glScaled(3, 3, 3);
|
||||
renderTargetAndChisel.doRender(item, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/*EntityItem chisel = getGhostItem(autoChisel.getWorldObj(), new ItemStack(ModItems.chisel));
|
||||
EntityItem item2 = autoChisel.getItemForRendering(0);
|
||||
|
||||
if(chisel != null){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 1.5, y + 1.5, z + 1.5);
|
||||
GL11.glScaled(1, 1, 1);
|
||||
renderTargetAndChisel.doRender(chisel, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}*/
|
||||
}
|
||||
if (item2 != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||
GL11.glScaled(1, 1, 1);
|
||||
renderBase.doRender(item2, 0, 0, 0, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EntityItem getGhostItem(World world, ItemStack itemStack){
|
||||
if(ghostItem == null){
|
||||
ghostItem = new EntityItem(world);
|
||||
ghostItem.hoverStart = 0.0F;
|
||||
}
|
||||
/*
|
||||
* EntityItem chisel = getGhostItem(autoChisel.getWorldObj(), new
|
||||
* ItemStack(ModItems.chisel));
|
||||
*
|
||||
* if(chisel != null){ GL11.glPushMatrix(); GL11.glTranslated(x + 1.5, y
|
||||
* + 1.5, z + 1.5); GL11.glScaled(1, 1, 1);
|
||||
* renderTargetAndChisel.doRender(chisel, 0, 0, 0, 0, 0);
|
||||
* GL11.glPopMatrix(); }
|
||||
*/
|
||||
}
|
||||
|
||||
if(itemStack == null){
|
||||
return null;
|
||||
} else {
|
||||
ghostItem.setEntityItemStack(itemStack);
|
||||
return ghostItem;
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EntityItem getGhostItem(World world, ItemStack itemStack) {
|
||||
if (ghostItem == null) {
|
||||
ghostItem = new EntityItem(world);
|
||||
ghostItem.hoverStart = 0.0F;
|
||||
}
|
||||
|
||||
if (itemStack == null) {
|
||||
return null;
|
||||
} else {
|
||||
ghostItem.setEntityItemStack(itemStack);
|
||||
return ghostItem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,122 +1,126 @@
|
||||
package com.cricketcraft.chisel.client.render.tile;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockPresent;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.model.ModelLargeChest;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityChestRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.BlockPresent;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class RenderPresent extends TileEntityChestRenderer {
|
||||
private ModelChest smallChest = new ModelChest();
|
||||
private ModelChest largeChest = new ModelLargeChest();
|
||||
|
||||
public RenderPresent() {
|
||||
}
|
||||
private ModelChest smallChest = new ModelChest();
|
||||
private ModelChest largeChest = new ModelLargeChest();
|
||||
|
||||
public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) {
|
||||
int i;
|
||||
public RenderPresent() {
|
||||
}
|
||||
|
||||
if (!present.hasWorldObj()) {
|
||||
i = 0;
|
||||
} else {
|
||||
Block block = present.getBlockType();
|
||||
i = present.getBlockMetadata();
|
||||
public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) {
|
||||
int i;
|
||||
|
||||
if (block instanceof BlockPresent && i == 0) {
|
||||
try {
|
||||
((BlockPresent) block).func_149954_e(present.getWorldObj(), present.xCoord, present.yCoord, present.zCoord);
|
||||
} catch (ClassCastException e) {
|
||||
FMLLog.severe("[Chisel 2] Attempted to render a present at %d, %d, %d that was not a present", present.xCoord, present.yCoord, present.zCoord);
|
||||
}
|
||||
i = present.getBlockMetadata();
|
||||
}
|
||||
if (!present.hasWorldObj()) {
|
||||
i = 0;
|
||||
} else {
|
||||
Block block = present.getBlockType();
|
||||
i = present.getBlockMetadata();
|
||||
|
||||
present.checkForAdjacentChests();
|
||||
}
|
||||
if (block instanceof BlockPresent && i == 0) {
|
||||
try {
|
||||
((BlockPresent) block).func_149954_e(present.getWorldObj(), present.xCoord, present.yCoord, present.zCoord);
|
||||
} catch (ClassCastException e) {
|
||||
FMLLog.severe("[Chisel 2] Attempted to render a present at %d, %d, %d that was not a present", present.xCoord, present.yCoord, present.zCoord);
|
||||
}
|
||||
i = present.getBlockMetadata();
|
||||
}
|
||||
|
||||
if (present.adjacentChestZNeg == null && present.adjacentChestXNeg == null) {
|
||||
BlockPresent blockPresent = (BlockPresent) present.getWorldObj().getBlock(present.xCoord, present.yCoord, present.zCoord);
|
||||
ModelChest smallOrLargeChest;
|
||||
if (present.adjacentChestZPos == null && present.adjacentChestXPos == null) {
|
||||
smallOrLargeChest = smallChest;
|
||||
this.bindTexture(new ResourceLocation(Chisel.MOD_ID, blockPresent.getKindOfChest(present.type) + ".png"));
|
||||
} else {
|
||||
smallOrLargeChest = largeChest;
|
||||
this.bindTexture(new ResourceLocation(Chisel.MOD_ID, blockPresent.getKindOfChest(present.type) + "_double.png"));
|
||||
}
|
||||
present.checkForAdjacentChests();
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||
GL11.glScalef(1.0F, -1.0F, -1.0F);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
short short1 = 0;
|
||||
if (present.adjacentChestZNeg == null && present.adjacentChestXNeg == null) {
|
||||
BlockPresent blockPresent = (BlockPresent) present.getWorldObj().getBlock(present.xCoord, present.yCoord, present.zCoord);
|
||||
ModelChest smallOrLargeChest;
|
||||
if (present.adjacentChestZPos == null && present.adjacentChestXPos == null) {
|
||||
smallOrLargeChest = smallChest;
|
||||
this.bindTexture(new ResourceLocation(Chisel.MOD_ID, blockPresent.getKindOfChest(present.type) + ".png"));
|
||||
} else {
|
||||
smallOrLargeChest = largeChest;
|
||||
this.bindTexture(new ResourceLocation(Chisel.MOD_ID, blockPresent.getKindOfChest(present.type) + "_double.png"));
|
||||
}
|
||||
|
||||
if (i == 2) {
|
||||
short1 = 180;
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||
GL11.glScalef(1.0F, -1.0F, -1.0F);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
short short1 = 0;
|
||||
|
||||
if (i == 3) {
|
||||
short1 = 0;
|
||||
}
|
||||
if (i == 2) {
|
||||
short1 = 180;
|
||||
}
|
||||
|
||||
if (i == 4) {
|
||||
short1 = 90;
|
||||
}
|
||||
if (i == 3) {
|
||||
short1 = 0;
|
||||
}
|
||||
|
||||
if (i == 5) {
|
||||
short1 = -90;
|
||||
}
|
||||
if (i == 4) {
|
||||
short1 = 90;
|
||||
}
|
||||
|
||||
if (i == 2 && present.adjacentChestXPos != null) {
|
||||
GL11.glTranslatef(1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if (i == 5) {
|
||||
short1 = -90;
|
||||
}
|
||||
|
||||
if (i == 5 && present.adjacentChestZPos != null) {
|
||||
GL11.glTranslatef(0.0F, 0.0F, -1.0F);
|
||||
}
|
||||
if (i == 2 && present.adjacentChestXPos != null) {
|
||||
GL11.glTranslatef(1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
float f1 = present.prevLidAngle + (present.lidAngle - present.prevLidAngle) * partialTicks;
|
||||
float f2;
|
||||
if (i == 5 && present.adjacentChestZPos != null) {
|
||||
GL11.glTranslatef(0.0F, 0.0F, -1.0F);
|
||||
}
|
||||
|
||||
if (present.adjacentChestZNeg != null) {
|
||||
f2 = present.adjacentChestZNeg.prevLidAngle + (present.adjacentChestZNeg.lidAngle - present.adjacentChestZNeg.prevLidAngle) * partialTicks;
|
||||
GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
float f1 = present.prevLidAngle + (present.lidAngle - present.prevLidAngle) * partialTicks;
|
||||
float f2;
|
||||
|
||||
if (f2 > f1) {
|
||||
f1 = f2;
|
||||
}
|
||||
}
|
||||
if (present.adjacentChestZNeg != null) {
|
||||
f2 = present.adjacentChestZNeg.prevLidAngle + (present.adjacentChestZNeg.lidAngle - present.adjacentChestZNeg.prevLidAngle) * partialTicks;
|
||||
|
||||
if (present.adjacentChestXNeg != null) {
|
||||
f2 = present.adjacentChestXNeg.prevLidAngle + (present.adjacentChestXNeg.lidAngle - present.adjacentChestXNeg.prevLidAngle) * partialTicks;
|
||||
if (f2 > f1) {
|
||||
f1 = f2;
|
||||
}
|
||||
}
|
||||
|
||||
if (f2 > f1) {
|
||||
f1 = f2;
|
||||
}
|
||||
}
|
||||
if (present.adjacentChestXNeg != null) {
|
||||
f2 = present.adjacentChestXNeg.prevLidAngle + (present.adjacentChestXNeg.lidAngle - present.adjacentChestXNeg.prevLidAngle) * partialTicks;
|
||||
|
||||
f1 = 1.0F - f1;
|
||||
f1 = 1.0F - f1 * f1 * f1;
|
||||
smallOrLargeChest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
|
||||
smallOrLargeChest.renderAll();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
if (f2 > f1) {
|
||||
f1 = f2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileEntityPresent) tileEntity, x, y, z, partialTicks);
|
||||
}
|
||||
f1 = 1.0F - f1;
|
||||
f1 = 1.0F - f1 * f1 * f1;
|
||||
smallOrLargeChest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
|
||||
smallOrLargeChest.renderAll();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) {
|
||||
this.renderTileEntityAt((TileEntityPresent) tileEntity, x, y, z, partialTicks);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user