mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 13:09:53 +00:00
quick fix : Constant conditions & exceptions
This commit is contained in:
1 parent
2b6b01314d
commit
d12e70dd52
4 files changed
+46
-61
No files matched your search
@@ -33,47 +33,45 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler {
|
||||
static final float LIGHT_XZ_POS = 0.6F;
|
||||
|
||||
public boolean renderRotatedBlock(Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer) {
|
||||
if (true) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int bMeta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iconStill = block.getIcon(1, bMeta);
|
||||
float flowDir = (float) (bMeta / 8f * 2 * Math.PI); // Tau, radians
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int bMeta = world.getBlockMetadata(x, y, z);
|
||||
IIcon iconStill = block.getIcon(1, bMeta);
|
||||
float flowDir = (float) (bMeta / 8f * 2 * Math.PI); // Tau, radians
|
||||
|
||||
double u1, u2, u3, u4, v1, v2, v3, v4;
|
||||
double u1, u2, u3, u4, v1, v2, v3, v4;
|
||||
|
||||
if (flowDir < -999.0F) {
|
||||
u2 = iconStill.getInterpolatedU(0.0D);
|
||||
v2 = iconStill.getInterpolatedV(0.0D);
|
||||
u1 = u2;
|
||||
v1 = iconStill.getInterpolatedV(16.0D);
|
||||
u4 = iconStill.getInterpolatedU(16.0D);
|
||||
v4 = v1;
|
||||
u3 = u4;
|
||||
v3 = v2;
|
||||
} else {
|
||||
float xFlow = MathHelper.sin(flowDir) * 0.25F;
|
||||
float zFlow = MathHelper.cos(flowDir) * 0.25F;
|
||||
u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
|
||||
v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
|
||||
u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
|
||||
v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
|
||||
u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
|
||||
v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
|
||||
u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
|
||||
v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
|
||||
}
|
||||
int color = block.colorMultiplier(world, x, y, z);
|
||||
float red = (color >> 16 & 255) / 255.0F;
|
||||
float green = (color >> 8 & 255) / 255.0F;
|
||||
float blue = (color & 255) / 255.0F;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
|
||||
|
||||
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 0, u2, v2);
|
||||
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 1, u1, v1);
|
||||
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 1, u4, v4);
|
||||
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 0, u3, v3);
|
||||
if (flowDir < -999.0F) {
|
||||
u2 = iconStill.getInterpolatedU(0.0D);
|
||||
v2 = iconStill.getInterpolatedV(0.0D);
|
||||
u1 = u2;
|
||||
v1 = iconStill.getInterpolatedV(16.0D);
|
||||
u4 = iconStill.getInterpolatedU(16.0D);
|
||||
v4 = v1;
|
||||
u3 = u4;
|
||||
v3 = v2;
|
||||
} else {
|
||||
float xFlow = MathHelper.sin(flowDir) * 0.25F;
|
||||
float zFlow = MathHelper.cos(flowDir) * 0.25F;
|
||||
u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
|
||||
v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
|
||||
u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
|
||||
v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
|
||||
u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
|
||||
v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
|
||||
u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
|
||||
v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
|
||||
}
|
||||
int color = block.colorMultiplier(world, x, y, z);
|
||||
float red = (color >> 16 & 255) / 255.0F;
|
||||
float green = (color >> 8 & 255) / 255.0F;
|
||||
float blue = (color & 255) / 255.0F;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
|
||||
|
||||
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 0, u2, v2);
|
||||
tessellator.addVertexWithUV(x + 0, y + 0.5, z + 1, u1, v1);
|
||||
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 1, u4, v4);
|
||||
tessellator.addVertexWithUV(x + 1, y + 0.5, z + 0, u3, v3);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
/*
|
||||
* int direction = world.getBlockMetadata(x, y, z) % 4; if (direction ==
|
||||
|
||||
Reference in new issue
Block a user