diff --git a/src/main/java/com/hbm/blocks/network/PylonLarge.java b/src/main/java/com/hbm/blocks/network/PylonLarge.java index 140a4ff1b..e0457f924 100644 --- a/src/main/java/com/hbm/blocks/network/PylonLarge.java +++ b/src/main/java/com/hbm/blocks/network/PylonLarge.java @@ -21,7 +21,10 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider { @Override public TileEntity createNewTileEntity(World world, int meta) { - return new TileEntityPylonLarge(); + + if(meta >= 12) + return new TileEntityPylonLarge(); + return null; } @Override @@ -33,7 +36,7 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider { @Override public int[] getDimensions() { - return new int[] {9, 0, 1, 1, 1, 1}; + return new int[] {0, 0, 1, 1, 1, 1}; } @Override diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index e7ab91d8b..ca6cc9532 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -77,17 +77,9 @@ import com.hbm.tileentity.bomb.*; import com.hbm.tileentity.conductor.*; import com.hbm.tileentity.deco.*; import com.hbm.tileentity.machine.*; -import com.hbm.tileentity.machine.oil.TileEntityMachineCatalyticCracker; -import com.hbm.tileentity.machine.oil.TileEntityMachineFrackingTower; -import com.hbm.tileentity.machine.oil.TileEntityMachineFractionTower; -import com.hbm.tileentity.machine.oil.TileEntityMachineGasFlare; -import com.hbm.tileentity.machine.oil.TileEntityMachineOilWell; -import com.hbm.tileentity.machine.oil.TileEntityMachinePumpjack; -import com.hbm.tileentity.machine.oil.TileEntityMachineRefinery; -import com.hbm.tileentity.machine.oil.TileEntitySpacer; +import com.hbm.tileentity.machine.oil.*; import com.hbm.tileentity.machine.rbmk.*; -import com.hbm.tileentity.network.TileEntityConnector; -import com.hbm.tileentity.network.TileEntityPylon; +import com.hbm.tileentity.network.*; import com.hbm.tileentity.turret.*; import cpw.mods.fml.client.registry.ClientRegistry; @@ -238,6 +230,7 @@ public class ClientProxy extends ServerProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRFDuct.class, new RenderRFCable()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPylon.class, new RenderPylon()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConnector.class, new RenderConnector()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPylonLarge.class, new RenderPylonLarge()); //multiblocks ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStructureMarker.class, new RenderStructureMaker()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMultiblock.class, new RenderMultiblock()); diff --git a/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java b/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java index 2824bdad8..8d3916a5a 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java +++ b/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java @@ -3,6 +3,7 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; import com.hbm.tileentity.network.TileEntityPylonBase; +import com.hbm.tileentity.network.TileEntityPylonBase.ConnectionType; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; @@ -59,7 +60,7 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { int lY = brightness / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lX / 1.0F, (float)lY / 1.0F); - drawPowerLine( + drawLineSegment( x + myOffset.xCoord + (wX * j / count), y + myOffset.yCoord + (wY * j / count) - Math.sin(j / count * Math.PI * 0.5) * hang, z + myOffset.zCoord + (wZ * j / count), @@ -73,10 +74,42 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { public void renderLinesGeneric(TileEntityPylonBase pyl, double x, double y, double z) { + for(int i = 0; i < pyl.connected.size(); i++) { + + int[] wire = pyl.connected.get(i); + TileEntity tile = pyl.getWorldObj().getTileEntity(wire[0], wire[1], wire[2]); + + if(tile instanceof TileEntityPylonBase) { + TileEntityPylonBase pylon = (TileEntityPylonBase) tile; + + Vec3[] m1 = pyl.getMountPos(); + Vec3[] m2 = pylon.getMountPos(); + + int lineCount = Math.max(pyl.getConnectionType() == ConnectionType.QUAD ? 4 : 1, pylon.getConnectionType() == ConnectionType.QUAD ? 4 : 1); + + for(int line = 0; line < lineCount; line++) { + + Vec3 first = m1[line % m1.length]; + Vec3 second = m2[line % m2.length]; + double sX = second.xCoord + pylon.xCoord - pyl.xCoord; + double sY = second.yCoord + pylon.yCoord - pyl.yCoord; + double sZ = second.zCoord + pylon.zCoord - pyl.zCoord; + + renderLine(pyl.getWorldObj(), pyl, x, y, z, + first.xCoord, + first.yCoord, + first.zCoord, + first.xCoord + (sX - first.xCoord) * 0.5, + first.yCoord + (sY - first.yCoord) * 0.5, + first.zCoord + (sZ - first.zCoord) * 0.5); + } + } + } } public void renderLine(World world, TileEntityPylonBase pyl, double x, double y, double z, double x0, double y0, double z0, double x1, double y1, double z1) { + GL11.glPushMatrix(); GL11.glTranslated(x, y, z); float count = 10; @@ -98,7 +131,7 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { int lY = brightness / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lX / 1.0F, (float)lY / 1.0F); - drawPowerLine( + drawLineSegment( x0 + (deltaX * j / count), y0 + (deltaY * j / count) - Math.sin(j / count * Math.PI * 0.5), z0 + (deltaZ * j / count), @@ -106,9 +139,12 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { y0 + (deltaY * k / count) - Math.sin(k / count * Math.PI * 0.5), z0 + (deltaZ * k / count)); } + GL11.glPopMatrix(); } - public void drawPowerLine(double x, double y, double z, double a, double b, double c) { + public void drawLineSegment(double x, double y, double z, double a, double b, double c) { + + double girth = 0.03125D; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); @@ -116,24 +152,18 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { Tessellator tessellator = Tessellator.instance; tessellator.startDrawing(5); tessellator.setColorOpaque_I(0xBB3311); - tessellator.addVertex(x, y + 0.05F, z); - tessellator.addVertex(x, y - 0.05F, z); - tessellator.addVertex(a, b + 0.05F, c); - tessellator.addVertex(a, b - 0.05F, c); - tessellator.draw(); - tessellator.startDrawing(5); - tessellator.setColorOpaque_I(0xBB3311); - tessellator.addVertex(x + 0.05F, y, z); - tessellator.addVertex(x - 0.05F, y, z); - tessellator.addVertex(a + 0.05F, b, c); - tessellator.addVertex(a - 0.05F, b, c); - tessellator.draw(); - tessellator.startDrawing(5); - tessellator.setColorOpaque_I(0xBB3311); - tessellator.addVertex(x, y, z + 0.05F); - tessellator.addVertex(x, y, z - 0.05F); - tessellator.addVertex(a, b, c + 0.05F); - tessellator.addVertex(a, b, c - 0.05F); + tessellator.addVertex(x, y + girth, z); + tessellator.addVertex(x, y - girth, z); + tessellator.addVertex(a, b + girth, c); + tessellator.addVertex(a, b - girth, c); + tessellator.addVertex(x + girth, y, z); + tessellator.addVertex(x - girth, y, z); + tessellator.addVertex(a + girth, b, c); + tessellator.addVertex(a - girth, b, c); + tessellator.addVertex(x, y, z + girth); + tessellator.addVertex(x, y, z - girth); + tessellator.addVertex(a, b, c + girth); + tessellator.addVertex(a, b, c - girth); tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); diff --git a/src/main/java/com/hbm/render/tileentity/RenderPylonLarge.java b/src/main/java/com/hbm/render/tileentity/RenderPylonLarge.java new file mode 100644 index 000000000..d5ad3f7ce --- /dev/null +++ b/src/main/java/com/hbm/render/tileentity/RenderPylonLarge.java @@ -0,0 +1,38 @@ +package com.hbm.render.tileentity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.blocks.BlockDummyable; +import com.hbm.main.ResourceManager; +import com.hbm.tileentity.network.TileEntityPylonLarge; + +import net.minecraft.tileentity.TileEntity; + +public class RenderPylonLarge extends RenderPylonBase { + + @Override + public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) { + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5, y, z + 0.5); + + switch(tile.getBlockMetadata() - BlockDummyable.offset) { + case 2: GL11.glRotatef(90, 0F, 1F, 0F); break; + case 4: GL11.glRotatef(180, 0F, 1F, 0F); break; + case 3: GL11.glRotatef(270, 0F, 1F, 0F); break; + case 5: GL11.glRotatef(0, 0F, 1F, 0F); break; + } + + GL11.glDisable(GL11.GL_CULL_FACE); + bindTexture(ResourceManager.pylon_large_tex); + ResourceManager.pylon_large.renderAll(); + GL11.glEnable(GL11.GL_CULL_FACE); + + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + TileEntityPylonLarge pyl = (TileEntityPylonLarge)tile; + this.renderLinesGeneric(pyl, x, y, z); + GL11.glPopMatrix(); + } + +} diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java b/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java index bd908f869..a4824bd2f 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java @@ -116,7 +116,7 @@ public abstract class TileEntityPylonBase extends TileEntityCableBaseNT { if(mounts == null || mounts.length == 0) return Vec3.createVectorHelper(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); - return mounts[0]; + return mounts[0].addVector(xCoord, yCoord, zCoord); } @Override diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java b/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java index beb4088a1..8cbe4638c 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java @@ -11,7 +11,14 @@ public class TileEntityPylonLarge extends TileEntityPylonBase { @Override public Vec3[] getMountPos() { - return null; + double topOff = 0.75 + 0.0625; + double sideOff = 3.375; + return new Vec3[] { + Vec3.createVectorHelper(0.5 + sideOff, 11.5 + topOff, 0.5), + Vec3.createVectorHelper(0.5 + sideOff, 11.5 - topOff, 0.5), + Vec3.createVectorHelper(0.5 - sideOff, 11.5 + topOff, 0.5), + Vec3.createVectorHelper(0.5 - sideOff, 11.5 - topOff, 0.5), + }; } @Override diff --git a/src/main/resources/assets/hbm/textures/blocks/charge_dynamite.png b/src/main/resources/assets/hbm/textures/blocks/charge_dynamite.png new file mode 100644 index 000000000..49c5cb40d Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/charge_dynamite.png differ diff --git a/src/main/resources/assets/hbm/textures/models/network/pylon_large.png b/src/main/resources/assets/hbm/textures/models/network/pylon_large.png index 87d5bfb0e..85cc9be03 100644 Binary files a/src/main/resources/assets/hbm/textures/models/network/pylon_large.png and b/src/main/resources/assets/hbm/textures/models/network/pylon_large.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 0c3c83c32..bd32b450a 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -7,7 +7,7 @@ "mcversion": "1.7.10", "url": "", "updateUrl": "", - "credits": "HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms), Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models, porting), UFFR (fork with all sorts of features), Pu-238 (Tom impact effects), Bismarck (chinese localization), FirzzleFrazzle (models), Minecreep (models), VT-6/24 (models, textures), PheodoreKaczynski (textures, various machines), Vær (fibrosis code), Adam29 (liquid petroleum, ethanol), Pashtet (russian localization), Sten89 (models), Pixelguru26 (textures), impbk2002 (project settings), OvermindDL1 (project settings), TehTemmie (reacher radiation function)", + "credits": "HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms), Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models, porting), UFFR (fork with all sorts of features), Pu-238 (Tom impact effects), Bismarck (chinese localization), Frooz (models), Minecreep (models), VT-6/24 (models, textures), Pheo (textures, various machines), Vær (fibrosis, gas centrifuges), Adam29 (liquid petroleum, ethanol), Pashtet (russian localization), Sten89 (models), Pixelguru26 (textures), TheBlueHat (textures), impbk2002 (project settings), OvermindDL1 (project settings), TehTemmie (reacher radiation function)", "logoFile": "", "screenshots": [], "dependencies": []