From 3bebb340c222442dcda2f8c828859a404ea4745b Mon Sep 17 00:00:00 2001 From: Calclavia Date: Fri, 2 Aug 2013 09:21:15 -0400 Subject: [PATCH] Fixing electric bolt render --- src/resonantinduction/fx/FXElectricBolt.java | 32 ++++++++-------- .../tesla/TileEntityTesla.java | 37 ++++++++++--------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/resonantinduction/fx/FXElectricBolt.java b/src/resonantinduction/fx/FXElectricBolt.java index 0b1076491..2875e98b1 100644 --- a/src/resonantinduction/fx/FXElectricBolt.java +++ b/src/resonantinduction/fx/FXElectricBolt.java @@ -236,19 +236,19 @@ public class FXElectricBolt extends EntityFX EntityPlayer player = Minecraft.getMinecraft().thePlayer; tessellator.draw(); - FMLClientHandler.instance().getClient().renderEngine.func_110577_a(FADED_SPHERE); - GL11.glPushMatrix(); /** * Do rendering here. */ + GL11.glPushMatrix(); GL11.glDepthMask(true); GL11.glEnable(3042); + + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(FADED_SPHERE); tessellator.startDrawingQuads(); tessellator.setBrightness(15728880); Vector3 playerVector = new Vector3(sinYaw * -cosPitch, -cosSinPitch / cosYaw, cosYaw * cosPitch); - int renderLength = (int) ((this.particleAge + partialFrame + this.boltLength * 3) / (this.boltLength * 3 * this.segmentCount)); for (BoltSegment segment : this.segments) { @@ -272,18 +272,6 @@ public class FXElectricBolt extends EntityFX tessellator.addVertexWithUV(rx1 + prevDiff.x, ry1 + prevDiff.y, rz1 + prevDiff.z, 0.5D, 1.0D); tessellator.addVertexWithUV(rx2 + nextDiff.x, ry2 + nextDiff.y, rz2 + nextDiff.z, 0.5D, 1.0D); - if (segment.next == null) - { - Vector3 roundend = segment.end.clone().translate(segment.difference.clone().normalize().scale(width)); - float rx3 = (float) (roundend.x - interpPosX); - float ry3 = (float) (roundend.y - interpPosY); - float rz3 = (float) (roundend.z - interpPosZ); - tessellator.addVertexWithUV(rx3 - nextDiff.x, ry3 - nextDiff.y, rz3 - nextDiff.z, 0.0D, 0.0D); - tessellator.addVertexWithUV(rx2 - nextDiff.x, ry2 - nextDiff.y, rz2 - nextDiff.z, 0.5D, 0.0D); - tessellator.addVertexWithUV(rx2 + nextDiff.x, ry2 + nextDiff.y, rz2 + nextDiff.z, 0.5D, 1.0D); - tessellator.addVertexWithUV(rx3 + nextDiff.x, ry3 + nextDiff.y, rz3 + nextDiff.z, 0.0D, 1.0D); - } - if (segment.prev == null) { Vector3 roundend = segment.start.clone().difference(segment.difference.clone().normalize().scale(width)); @@ -295,13 +283,25 @@ public class FXElectricBolt extends EntityFX tessellator.addVertexWithUV(rx3 + prevDiff.x, ry3 + prevDiff.y, rz3 + prevDiff.z, 0.0D, 1.0D); tessellator.addVertexWithUV(rx1 + prevDiff.x, ry1 + prevDiff.y, rz1 + prevDiff.z, 0.5D, 1.0D); } + + if (segment.next == null) + { + Vector3 roundend = segment.end.clone().translate(segment.difference.clone().normalize().scale(width)); + float rx3 = (float) (roundend.x - interpPosX); + float ry3 = (float) (roundend.y - interpPosY); + float rz3 = (float) (roundend.z - interpPosZ); + tessellator.addVertexWithUV(rx3 - nextDiff.x, ry3 - nextDiff.y, rz3 - nextDiff.z, 0.0D, 0.0D); + tessellator.addVertexWithUV(rx2 - nextDiff.x, ry2 - nextDiff.y, rz2 - nextDiff.z, 0.5D, 0.0D); + tessellator.addVertexWithUV(rx2 + nextDiff.x, ry2 + nextDiff.y, rz2 + nextDiff.z, 0.5D, 1.0D); + tessellator.addVertexWithUV(rx3 + nextDiff.x, ry3 + nextDiff.y, rz3 + nextDiff.z, 0.0D, 1.0D); + } } tessellator.draw(); GL11.glDisable(3042); GL11.glDepthMask(false); - GL11.glPopMatrix(); + FMLClientHandler.instance().getClient().renderEngine.func_110577_a(PARTICLE_RESOURCE); tessellator.startDrawingQuads(); } diff --git a/src/resonantinduction/tesla/TileEntityTesla.java b/src/resonantinduction/tesla/TileEntityTesla.java index 7ad1303a7..b00a2d554 100644 --- a/src/resonantinduction/tesla/TileEntityTesla.java +++ b/src/resonantinduction/tesla/TileEntityTesla.java @@ -53,7 +53,7 @@ public class TileEntityTesla extends TileEntityBase implements ITesla for (ITesla tesla : transferTeslaCoils) { tesla.transfer(transferEnergy * (1 - (this.worldObj.rand.nextFloat() * 0.1f))); - ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(this), new Vector3((TileEntity) tesla)); + ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(this).translate(new Vector3(0.5)), new Vector3((TileEntity) tesla).translate(new Vector3(0.5))); this.transfer(-transferEnergy); } } @@ -70,26 +70,29 @@ public class TileEntityTesla extends TileEntityBase implements ITesla { TileEntityFurnace furnaceTile = (TileEntityFurnace) tileEntity; - boolean doBlockStateUpdate = furnaceTile.furnaceBurnTime > 0; - - if (furnaceTile.furnaceBurnTime == 0) + if (furnaceTile.getStackInSlot(0) == null) { - int burnTime = TileEntityFurnace.getItemBurnTime(furnaceTile.getStackInSlot(1)); - if (burnTime > 0) + boolean doBlockStateUpdate = furnaceTile.furnaceBurnTime > 0; + + if (furnaceTile.furnaceBurnTime == 0) { - furnaceTile.decrStackSize(1, 1); - furnaceTile.furnaceBurnTime = burnTime; + int burnTime = TileEntityFurnace.getItemBurnTime(furnaceTile.getStackInSlot(1)); + if (burnTime > 0) + { + furnaceTile.decrStackSize(1, 1); + furnaceTile.furnaceBurnTime = burnTime; + } + } + else + { + this.transfer(ResonantInduction.POWER_PER_COAL / 20); + furnaceTile.furnaceBurnTime--; } - } - else - { - this.transfer(ResonantInduction.POWER_PER_COAL / 20); - furnaceTile.furnaceBurnTime--; - } - if (doBlockStateUpdate != furnaceTile.furnaceBurnTime > 0) - { - BlockFurnace.updateFurnaceBlockState(furnaceTile.furnaceBurnTime > 0, furnaceTile.worldObj, furnaceTile.xCoord, furnaceTile.yCoord, furnaceTile.zCoord); + if (doBlockStateUpdate != furnaceTile.furnaceBurnTime > 0) + { + BlockFurnace.updateFurnaceBlockState(furnaceTile.furnaceBurnTime > 0, furnaceTile.worldObj, furnaceTile.xCoord, furnaceTile.yCoord, furnaceTile.zCoord); + } } } }