diff --git a/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java b/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java index a75cb94..03ed5d9 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/WireMod.java @@ -1,11 +1,13 @@ package net.brokenmoon.afloydwiremod; +import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; import net.brokenmoon.afloydwiremod.item.ToolWiring; import net.brokenmoon.afloydwiremod.tile.ChipTile; import net.brokenmoon.afloydwiremod.item.ToolProgrammer; import net.brokenmoon.afloydwiremod.tile.RedstoneLinkTile; import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity; import net.brokenmoon.afloydwiremod.tileentity.RedstoneLinkTileEntity; +import net.brokenmoon.afloydwiremod.tileentity.TERWire; import net.fabricmc.api.ModInitializer; import net.minecraft.src.Block; import net.minecraft.src.Item; @@ -35,5 +37,6 @@ public class WireMod implements ModInitializer { LinkTileActive.notInCreativeMenu = true; EntityHelper.createTileEntity(ChipTileEntity.class, "Chip"); EntityHelper.createTileEntity(RedstoneLinkTileEntity.class, "Redstone Link"); + EntityHelper.createSpecialTileEntity(AbstractWireTileEntity.class, new TERWire(), "Wire"); } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java index 57a456a..0be15e6 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java @@ -58,9 +58,4 @@ public abstract class AbstractWireTile extends BlockContainer { public int getRenderType(){ return 28; } - - @Override - public int getRenderBlockPass() { - return 1; - } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/api/WireConnection.java b/src/main/java/net/brokenmoon/afloydwiremod/api/WireConnection.java index 3a5ba07..b99f0cf 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/api/WireConnection.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/api/WireConnection.java @@ -21,7 +21,7 @@ public class WireConnection { public float green = 0; public float blue = 0; public float alpha = 1; - public float width = 5f; + public float width = 0.5f; public WireConnection(){ this.isMade = false; diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWireTool.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWireTool.java index 2197757..9509bf9 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWireTool.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWireTool.java @@ -2,13 +2,19 @@ package net.brokenmoon.afloydwiremod.gui; import net.brokenmoon.afloydwiremod.item.ToolWiring; import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity; -import net.minecraft.src.EntityPlayerSP; -import net.minecraft.src.GuiButton; -import net.minecraft.src.GuiScreen; -import net.minecraft.src.GuiSlider; +import net.minecraft.client.Minecraft; +import net.minecraft.src.*; +import net.minecraft.src.render.Shaders; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; public class GuiWireTool extends GuiScreen { public ToolWiring tool; + public GuiSlider red; + public GuiSlider green; + public GuiSlider blue; + public GuiSlider alpha; + public GuiSlider widthslider; public GuiWireTool(EntityPlayerSP entityPlayerSP, ToolWiring toolWiring) { super.initGui(); this.tool = toolWiring; @@ -16,33 +22,34 @@ public class GuiWireTool extends GuiScreen { @Override public void initGui() { - this.controlList.add(new GuiSlider(1, this.width/2-100, this.height/2-40, 200, 20, "Red", tool.red)); - this.controlList.add(new GuiSlider(2, this.width/2-100, this.height/2-20, 200, 20, "Green", tool.green)); - this.controlList.add(new GuiSlider(3, this.width/2-100, this.height/2+00, 200, 20, "Blue", tool.blue)); - this.controlList.add(new GuiSlider(4, this.width/2-100, this.height/2+20, 200, 20, "Alpha", tool.alpha)); - this.controlList.add(new GuiSlider(5, this.width/2-100, this.height/2+40, 200, 20, "Width", tool.width)); + red = new GuiSlider(1, this.width/2-100, this.height/2-40, 200, 20, "Red", tool.red); + green = new GuiSlider(2, this.width/2-100, this.height/2-20, 200, 20, "Blue", tool.green); + blue = new GuiSlider(3, this.width/2-100, this.height/2-0, 200, 20, "Green", tool.blue); + alpha = new GuiSlider(4, this.width/2-100, this.height/2+20, 200, 20, "Alpha", tool.alpha); + widthslider = new GuiSlider(5, this.width/2-100, this.height/2+40, 200, 20, "Width", tool.width); + this.controlList.add(red); + this.controlList.add(green); + this.controlList.add(blue); + this.controlList.add(alpha); + this.controlList.add(widthslider); } - @Override - protected void actionPerformed(GuiButton guiButton){ - if(guiButton instanceof GuiSlider){ - switch(guiButton.id){ - case 1: - tool.red = ((GuiSlider) guiButton).sliderValue; - break; - case 2: - tool.green = ((GuiSlider) guiButton).sliderValue; - break; - case 3: - tool.blue = ((GuiSlider) guiButton).sliderValue; - break; - case 4: - tool.alpha = ((GuiSlider) guiButton).sliderValue; - break; - case 5: - tool.width = ((GuiSlider) guiButton).sliderValue; - break; - } + public void drawScreen(int x, int y, float renderPartialTicks) { + super.drawScreen(x, y, renderPartialTicks); + if (this.red.dragging) { + this.tool.red = red.sliderValue; + } + if (this.green.dragging) { + this.tool.green = green.sliderValue; + } + if (this.blue.dragging) { + this.tool.blue = blue.sliderValue; + } + if (this.alpha.dragging) { + this.tool.alpha = alpha.sliderValue; + } + if (this.widthslider.dragging) { + this.tool.width = widthslider.sliderValue; } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java index 17485d5..4d1d112 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/gui/GuiWiring.java @@ -73,8 +73,6 @@ public class GuiWiring extends GuiScrollable { } else if(!this.tool.type.equals("unpaired")) { if(this.tool.type.equals("input")) { wireEntity.outputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width); - Minecraft.getMinecraft().theWorld.markBlocksDirty(x, y, z, x, y, z); - Minecraft.getMinecraft().theWorld.markBlocksDirty(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord); tool.xadd = new ArrayList(); tool.yadd = new ArrayList(); tool.zadd = new ArrayList(); @@ -84,8 +82,6 @@ public class GuiWiring extends GuiScrollable { AbstractWireTileEntity otherEntity = (AbstractWireTileEntity)Minecraft.getMinecraft().theWorld.getBlockTileEntity(tool.x, tool.y, tool.z); if(otherEntity != null) otherEntity.outputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width); - Minecraft.getMinecraft().theWorld.markBlocksDirty(x, y, z, x, y, z); - Minecraft.getMinecraft().theWorld.markBlocksDirty(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord); tool.xadd = new ArrayList(); tool.yadd = new ArrayList(); tool.zadd = new ArrayList(); diff --git a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java index 4088dd4..b494d71 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java @@ -26,32 +26,18 @@ public class MixinBlockRenderer { @Inject(method = "Lnet/minecraft/src/RenderBlocks;renderBlockByRenderType(Lnet/minecraft/src/Block;III)Z", at = @At("HEAD"), cancellable = true) public void injectMethod(Block block, int i, int j, int k, CallbackInfoReturnable cir){ if(block.getRenderType() == 28){ - AbstractWireTileEntity wireEntity = (AbstractWireTileEntity)this.world.getBlockTileEntity(i, j, k); if(block instanceof AbstractWireTileSided) { this.renderSidedBlock(block, i, j, k); } else { this.renderStandardBlock(block, i, j, k); } - if(wireEntity.outputs != null){ - for(int it = 0; it < wireEntity.outputs.length; it++){ - if(wireEntity.outputs[it].wire != null && wireEntity.outputs[it].wire.isMade){ - this.renderLineBetweenTwoPoints( - i, j, k, - wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z, - wireEntity.outputs[it].wire.red, wireEntity.outputs[it].wire.green, wireEntity.outputs[it].wire.blue, wireEntity.outputs[it].wire.alpha, wireEntity.outputs[it].wire.width * 10, - wireEntity.outputs[it].wire.xadd, wireEntity.outputs[it].wire.yadd, wireEntity.outputs[it].wire.zadd, wireEntity.outputs[it].wire.sideadd, - wireEntity.outputs[it].wire.backwired, - block instanceof AbstractWireTileSided, - Block.getBlock(world.getBlockId(wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z)) instanceof AbstractWireTileSided); - } - } - } cir.setReturnValue(true); } } public boolean renderSidedBlock(Block block, int i, int j, int k) { Tessellator tessellator = Tessellator.instance; + GL11.glDisable(GL11.GL_BLEND); int l = block.getBlockTextureFromSide(0); if (this.overrideBlockTexture >= 0) { l = this.overrideBlockTexture; @@ -107,272 +93,4 @@ public class MixinBlockRenderer { } return true; } - public void renderLineBetweenTwoPoints(long x1, long y1, long z1, long x2, long y2, long z2, float red, float green, float blue, float alpha, float width, ArrayList xadd, ArrayList yadd, ArrayList zadd, ArrayList sideadd, boolean backwired, boolean firstblocksided, boolean secondblocksided){ - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(red, green, blue, alpha); - GL11.glLineWidth(width); - GL11.glBegin(GL11.GL_LINE_STRIP); - if(!backwired) { - if(firstblocksided){ - float xoffset = 0; - float yoffset = 0; - float zoffset = 0; - switch(world.getBlockMetadata((int)x1,(int)y1,(int)z1)){ - case 0: - xoffset = 0.5f; - yoffset = 0.9f; - zoffset = 0.5f; - break; - case 1: - xoffset = 0.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 2: - xoffset = 0.9f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 3: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.1f; - break; - case 4: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.9f; - break; - case 5: - xoffset = 0.5f; - yoffset = 0.1f; - zoffset = 0.5f; - break; - } - GL11.glVertex3f(Math.floorMod(x1, 16l) + xoffset, Math.floorMod(y1, 16l) + yoffset, Math.floorMod(z1, 16l) + zoffset); - } else { - GL11.glVertex3f(Math.floorMod(x1, 16l) + 0.5f, Math.floorMod(y1, 16l) + 0.5f, Math.floorMod(z1, 16l) + 0.5f); - } - } else{ - if(secondblocksided) { - float xoffset = 0; - float yoffset = 0; - float zoffset = 0; - switch (world.getBlockMetadata((int) x2, (int) y2, (int) z2)) { - case 0: - xoffset = 0.5f; - yoffset = 0.9f; - zoffset = 0.5f; - break; - case 1: - xoffset = 0.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 2: - xoffset = 0.9f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 3: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.1f; - break; - case 4: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.9f; - break; - case 5: - xoffset = 0.5f; - yoffset = 0.1f; - zoffset = 0.5f; - break; - } - GL11.glVertex3f(Math.floorMod(x1, 16l) - (x1 - x2) + xoffset, Math.floorMod(y1, 16l) - (y1 - y2) + yoffset, Math.floorMod(z1, 16l) - (z1 - z2) + zoffset); - } else { - GL11.glVertex3f(Math.floorMod(x1, 16l) - (x1 - x2) + 0.5f, Math.floorMod(y1, 16l) - (y1 - y2) + 0.5f, Math.floorMod(z1, 16l) - (z1 - z2) + 0.5f); - } - } - if(backwired){ - for(int i = 0; i < xadd.size(); i++){ - float xoffset = 0; - float yoffset = 0; - float zoffset = 0; - switch(sideadd.get(i)){ - case 0: - xoffset = 0.5f; - yoffset = -0.1f; - zoffset = 0.5f; - break; - case 1: - xoffset = 0.5f; - yoffset = 1.1f; - zoffset = 0.5f; - break; - case 2: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = -0.1f; - break; - case 3: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 1.1f; - break; - case 4: - xoffset = -0.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 5: - xoffset = 1.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - } - GL11.glVertex3f(Math.floorMod(x1, 16l) - (x1 - xadd.get(i)) + xoffset, Math.floorMod(y1, 16l) - (y1 - yadd.get(i)) + yoffset, Math.floorMod(z1, 16l) - (z1 - zadd.get(i)) + zoffset); - } - } else{ - for(int i = xadd.size() - 1; i >= 0 ; i--){ - float xoffset = 0; - float yoffset = 0; - float zoffset = 0; - switch(sideadd.get(i)){ - case 0: - xoffset = 0.5f; - yoffset = -0.1f; - zoffset = 0.5f; - break; - case 1: - xoffset = 0.5f; - yoffset = 1.1f; - zoffset = 0.5f; - break; - case 2: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = -0.1f; - break; - case 3: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 1.1f; - break; - case 4: - xoffset = -0.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 5: - xoffset = 1.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - } - GL11.glVertex3f(Math.floorMod(x1, 16l) - (x1 - xadd.get(i)) + xoffset, Math.floorMod(y1, 16l) - (y1 - yadd.get(i)) + yoffset, Math.floorMod(z1, 16l) - (z1 - zadd.get(i)) + zoffset); - } - } - if(backwired) { - if(firstblocksided){ - float xoffset = 0; - float yoffset = 0; - float zoffset = 0; - switch(world.getBlockMetadata((int) x1, (int) y1, (int) z1)){ - case 0: - xoffset = 0.5f; - yoffset = 0.9f; - zoffset = 0.5f; - break; - case 1: - xoffset = 0.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 2: - xoffset = 0.9f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 3: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.1f; - break; - case 4: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.9f; - break; - case 5: - xoffset = 0.5f; - yoffset = 0.1f; - zoffset = 0.5f; - break; - } - GL11.glVertex3f(Math.floorMod(x1, 16l) + xoffset, Math.floorMod(y1, 16l) + yoffset, Math.floorMod(z1, 16l) + zoffset); - } else { - GL11.glVertex3f(Math.floorMod(x1, 16l) + 0.5f, Math.floorMod(y1, 16l) + 0.5f, Math.floorMod(z1, 16l) + 0.5f); - } - } else{ - if(secondblocksided) { - float xoffset = 0; - float yoffset = 0; - float zoffset = 0; - switch (world.getBlockMetadata((int) x2, (int) y2, (int) z2)) { - case 0: - xoffset = 0.5f; - yoffset = 0.9f; - zoffset = 0.5f; - break; - case 1: - xoffset = 0.1f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 2: - xoffset = 0.9f; - yoffset = 0.5f; - zoffset = 0.5f; - break; - case 3: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.1f; - break; - case 4: - xoffset = 0.5f; - yoffset = 0.5f; - zoffset = 0.9f; - break; - case 5: - xoffset = 0.5f; - yoffset = 0.1f; - zoffset = 0.5f; - break; - } - GL11.glVertex3f(Math.floorMod(x1, 16l) - (x1 - x2) + xoffset, Math.floorMod(y1, 16l) - (y1 - y2) + yoffset, Math.floorMod(z1, 16l) - (z1 - z2) + zoffset); - } else { - GL11.glVertex3f(Math.floorMod(x1, 16l) - (x1 - x2) + 0.5f, Math.floorMod(y1, 16l) - (y1 - y2) + 0.5f, Math.floorMod(z1, 16l) - (z1 - z2) + 0.5f); - } - } - GL11.glEnd(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glPopMatrix(); - } - public void renderLineBetweenTwoPoints(long x1, long y1, long z1, long x2, long y2, long z2, float red, float green, float blue, float alpha, ArrayList xadd, ArrayList yadd, ArrayList zadd, ArrayList sideadd, boolean backwired, boolean firstblocksided, boolean secondblocksided){ - renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, red, green, blue, alpha, 1, xadd, yadd, zadd, sideadd, backwired, firstblocksided, secondblocksided); - } - - public void renderLineBetweenTwoPoints(long x1, long y1, long z1, long x2, long y2, long z2, float red, float green, float blue, ArrayList xadd, ArrayList yadd, ArrayList zadd, ArrayList sideadd, boolean backwired, boolean firstblocksided, boolean secondblocksided){ - renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, red, green, blue, 255, 1, xadd, yadd, zadd, sideadd, backwired, firstblocksided, secondblocksided); - } - public void renderLineBetweenTwoPoints(long x1, long y1, long z1, long x2, long y2, long z2, ArrayList xadd, ArrayList yadd, ArrayList zadd, ArrayList sideadd, boolean backwired, boolean firstblocksided, boolean secondblocksided){ - renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, 255, 0, 0, 255f / 2, 5, xadd, yadd, zadd, sideadd, backwired, firstblocksided, secondblocksided); - } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/tileentity/TERWire.java b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/TERWire.java new file mode 100644 index 0000000..a332963 --- /dev/null +++ b/src/main/java/net/brokenmoon/afloydwiremod/tileentity/TERWire.java @@ -0,0 +1,258 @@ +package net.brokenmoon.afloydwiremod.tileentity; + +import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; +import net.brokenmoon.afloydwiremod.api.AbstractWireTileSided; +import net.minecraft.client.Minecraft; +import net.minecraft.src.*; +import org.lwjgl.Sys; +import org.lwjgl.opengl.GL11; + +import java.util.ArrayList; + +public class TERWire extends TileEntitySpecialRenderer { + @Override + public void renderTileEntityAt(TileEntity tileEntity, double d, double e, double f, float g) { + this.renderWireAt((AbstractWireTileEntity)tileEntity, d, e, f, g); + } + + public void renderWireAt(AbstractWireTileEntity wireEntity, double x, double y, double z, float weird) { + if(wireEntity.outputs != null){ + for(int it = 0; it < wireEntity.outputs.length; it++){ + if(wireEntity.outputs[it].wire != null && wireEntity.outputs[it].wire.isMade){ + this.renderLineBetweenTwoPoints( + wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord, + wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z, + wireEntity.outputs[it].wire.red, wireEntity.outputs[it].wire.green, wireEntity.outputs[it].wire.blue, wireEntity.outputs[it].wire.alpha, wireEntity.outputs[it].wire.width * 10, + wireEntity.outputs[it].wire.xadd, wireEntity.outputs[it].wire.yadd, wireEntity.outputs[it].wire.zadd, wireEntity.outputs[it].wire.sideadd, + wireEntity.outputs[it].wire.backwired, + Block.getBlock(Minecraft.getMinecraft().theWorld.getBlockId(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord)) instanceof AbstractWireTileSided, + Block.getBlock(Minecraft.getMinecraft().theWorld.getBlockId(wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z)) instanceof AbstractWireTileSided, x, y, z); + } + } + } + } + public void renderLineBetweenTwoPoints(int x1, int y1, int z1, long x2, long y2, long z2, float red, float green, float blue, float alpha, float width, ArrayList xadd, ArrayList yadd, ArrayList zadd, ArrayList sideadd, boolean backwired, boolean firstblocksided, boolean secondblocksided, double x, double y, double z){ + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(red, green, blue, alpha); + GL11.glLineWidth(width); + GL11.glTranslated(x, y, z); + GL11.glDepthMask(false); + GL11.glBegin(GL11.GL_LINE_STRIP); + //First + if(!backwired) { + if(firstblocksided){ + float xoffset = 0; + float yoffset = 0; + float zoffset = 0; + switch(Minecraft.getMinecraft().theWorld.getBlockMetadata((int)x1,(int)y1,(int)z1)){ + case 0: + xoffset = 0.5f; + yoffset = 0.9f; + zoffset = 0.5f; + break; + case 1: + xoffset = 0.1f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 2: + xoffset = 0.9f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 3: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.1f; + break; + case 4: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.9f; + break; + case 5: + xoffset = 0.5f; + yoffset = 0.1f; + zoffset = 0.5f; + break; + } + GL11.glVertex3f(xoffset, yoffset, zoffset); + } else { + GL11.glVertex3f(0.5f, 0.5f, 0.5f); + } + } else{ + if(secondblocksided) { + float xoffset = 0; + float yoffset = 0; + float zoffset = 0; + switch (Minecraft.getMinecraft().theWorld.getBlockMetadata((int) x2, (int) y2, (int) z2)) { + case 0: + xoffset = 0.5f; + yoffset = 0.9f; + zoffset = 0.5f; + break; + case 1: + xoffset = 0.1f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 2: + xoffset = 0.9f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 3: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.1f; + break; + case 4: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.9f; + break; + case 5: + xoffset = 0.5f; + yoffset = 0.1f; + zoffset = 0.5f; + break; + } + GL11.glVertex3d(-(x1 - x2) + xoffset,-(y1 - y2) + yoffset, -(z1 - z2) + zoffset); + } else { + GL11.glVertex3d(-(x1 - x2) + 0.5f, -(y1 - y2) + 0.5f, -(z1 - z2) + 0.5f); + } + } + //Middle + for(int i = xadd.size() - 1; i >= 0 ; i--){ + float xoffset = 0; + float yoffset = 0; + float zoffset = 0; + switch(sideadd.get(i)){ + case 0: + xoffset = 0.5f; + yoffset = -0.1f; + zoffset = 0.5f; + break; + case 1: + xoffset = 0.5f; + yoffset = 1.1f; + zoffset = 0.5f; + break; + case 2: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = -0.1f; + break; + case 3: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 1.1f; + break; + case 4: + xoffset = -0.1f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 5: + xoffset = 1.1f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + } + GL11.glVertex3d(-(x1 - xadd.get(i)) + xoffset, -(y1 - yadd.get(i)) + yoffset, -(z1 - zadd.get(i)) + zoffset); + } + //Second + if(backwired) { + if(firstblocksided){ + float xoffset = 0; + float yoffset = 0; + float zoffset = 0; + switch(Minecraft.getMinecraft().theWorld.getBlockMetadata(x1, y1, z1)){ + case 0: + xoffset = 0.5f; + yoffset = 0.9f; + zoffset = 0.5f; + break; + case 1: + xoffset = 0.1f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 2: + xoffset = 0.9f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 3: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.1f; + break; + case 4: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.9f; + break; + case 5: + xoffset = 0.5f; + yoffset = 0.1f; + zoffset = 0.5f; + break; + } + GL11.glVertex3f(xoffset, yoffset, zoffset); + } else { + GL11.glVertex3f(0.5f, 0.5f, 0.5f); + } + } else{ + if(secondblocksided) { + float xoffset = 0; + float yoffset = 0; + float zoffset = 0; + switch (Minecraft.getMinecraft().theWorld.getBlockMetadata((int) x2, (int) y2, (int) z2)) { + case 0: + xoffset = 0.5f; + yoffset = 0.9f; + zoffset = 0.5f; + break; + case 1: + xoffset = 0.1f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 2: + xoffset = 0.9f; + yoffset = 0.5f; + zoffset = 0.5f; + break; + case 3: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.1f; + break; + case 4: + xoffset = 0.5f; + yoffset = 0.5f; + zoffset = 0.9f; + break; + case 5: + xoffset = 0.5f; + yoffset = 0.1f; + zoffset = 0.5f; + break; + } + GL11.glVertex3d(-(x1 - x2) + xoffset, -(y1 - y2) + yoffset, -(z1 - z2) + zoffset); + } else { + GL11.glVertex3d(-(x1 - x2) + 0.5f, -(y1 - y2) + 0.5f, -(z1 - z2) + 0.5f); + } + } + GL11.glEnd(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + } +}