Fixing electric bolt render

This commit is contained in:
Calclavia 2013-08-02 09:21:15 -04:00
parent 86e62265fd
commit 3bebb340c2
2 changed files with 36 additions and 33 deletions

View file

@ -236,19 +236,19 @@ public class FXElectricBolt extends EntityFX
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
tessellator.draw(); tessellator.draw();
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(FADED_SPHERE);
GL11.glPushMatrix();
/** /**
* Do rendering here. * Do rendering here.
*/ */
GL11.glPushMatrix();
GL11.glDepthMask(true); GL11.glDepthMask(true);
GL11.glEnable(3042); GL11.glEnable(3042);
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(FADED_SPHERE);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.setBrightness(15728880); tessellator.setBrightness(15728880);
Vector3 playerVector = new Vector3(sinYaw * -cosPitch, -cosSinPitch / cosYaw, cosYaw * cosPitch); 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) 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(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); 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) if (segment.prev == null)
{ {
Vector3 roundend = segment.start.clone().difference(segment.difference.clone().normalize().scale(width)); 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(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); 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(); tessellator.draw();
GL11.glDisable(3042); GL11.glDisable(3042);
GL11.glDepthMask(false); GL11.glDepthMask(false);
GL11.glPopMatrix(); GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(PARTICLE_RESOURCE); FMLClientHandler.instance().getClient().renderEngine.func_110577_a(PARTICLE_RESOURCE);
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
} }

View file

@ -53,7 +53,7 @@ public class TileEntityTesla extends TileEntityBase implements ITesla
for (ITesla tesla : transferTeslaCoils) for (ITesla tesla : transferTeslaCoils)
{ {
tesla.transfer(transferEnergy * (1 - (this.worldObj.rand.nextFloat() * 0.1f))); 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); this.transfer(-transferEnergy);
} }
} }
@ -70,26 +70,29 @@ public class TileEntityTesla extends TileEntityBase implements ITesla
{ {
TileEntityFurnace furnaceTile = (TileEntityFurnace) tileEntity; TileEntityFurnace furnaceTile = (TileEntityFurnace) tileEntity;
boolean doBlockStateUpdate = furnaceTile.furnaceBurnTime > 0; if (furnaceTile.getStackInSlot(0) == null)
if (furnaceTile.furnaceBurnTime == 0)
{ {
int burnTime = TileEntityFurnace.getItemBurnTime(furnaceTile.getStackInSlot(1)); boolean doBlockStateUpdate = furnaceTile.furnaceBurnTime > 0;
if (burnTime > 0)
if (furnaceTile.furnaceBurnTime == 0)
{ {
furnaceTile.decrStackSize(1, 1); int burnTime = TileEntityFurnace.getItemBurnTime(furnaceTile.getStackInSlot(1));
furnaceTile.furnaceBurnTime = burnTime; 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) if (doBlockStateUpdate != furnaceTile.furnaceBurnTime > 0)
{ {
BlockFurnace.updateFurnaceBlockState(furnaceTile.furnaceBurnTime > 0, furnaceTile.worldObj, furnaceTile.xCoord, furnaceTile.yCoord, furnaceTile.zCoord); BlockFurnace.updateFurnaceBlockState(furnaceTile.furnaceBurnTime > 0, furnaceTile.worldObj, furnaceTile.xCoord, furnaceTile.yCoord, furnaceTile.zCoord);
}
} }
} }
} }