From 0b3f3893373bf5ff22a7a73ecd5e2ab5cad5d2d2 Mon Sep 17 00:00:00 2001 From: Astoria Date: Sun, 2 Apr 2023 11:06:16 -0500 Subject: [PATCH] Sided wires, better backwiring --- .../afloydwiremod/api/AbstractWireTile.java | 1 + .../api/AbstractWireTileSided.java | 138 +++++++ .../mixin/MixinBlockRenderer.java | 370 +++++++++++++++--- .../afloydwiremod/tile/ChipTile.java | 4 +- 4 files changed, 459 insertions(+), 54 deletions(-) create mode 100644 src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileSided.java diff --git a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java index 0be15e6..50d512b 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTile.java @@ -25,6 +25,7 @@ public abstract class AbstractWireTile extends BlockContainer { return true; } } + System.out.println(world.getBlockMetadata(x, y, z)); return false; } public void displayWiringGui(EntityPlayer player, AbstractWireTileEntity chip, ToolWiring tool, int x, int y, int z) { diff --git a/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileSided.java b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileSided.java new file mode 100644 index 0000000..3869de6 --- /dev/null +++ b/src/main/java/net/brokenmoon/afloydwiremod/api/AbstractWireTileSided.java @@ -0,0 +1,138 @@ +package net.brokenmoon.afloydwiremod.api; + +import net.minecraft.src.*; +import net.minecraft.src.helper.Direction; + +public abstract class AbstractWireTileSided extends AbstractWireTile{ + public AbstractWireTileSided(int i, Material material) { + super(i, material); + this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + } + @Override + public void onBlockPlaced(World world, int x, int y, int z, Direction side, EntityLiving player, double sideHeight) { + int l = Direction.getLegacySide(side); + int i1 = 5; + if (l == 1 && this.canPlaceOnTop(world, x, y - 1, z)) { + i1 = 5; + } else if (l == 2 && world.isBlockNormalCube(x, y, z + 1)) { + i1 = 4; + } else if (l == 3 && world.isBlockNormalCube(x, y, z - 1)) { + i1 = 3; + } else if (l == 4 && world.isBlockNormalCube(x + 1, y, z)) { + i1 = 2; + } else if (l == 5 && world.isBlockNormalCube(x - 1, y, z)) { + i1 = 1; + } else if (l == 0 && world.isBlockNormalCube(x, y + 1, z)) { + i1 = 0; + } + world.setBlockMetadataWithNotify(x, y, z, i1); + } + + @Override + public void onBlockAdded(World world, int i, int j, int k) { + super.onBlockAdded(world, i, j, k); + if (world.isBlockNormalCube(i - 1, j, k)) { + world.setBlockMetadataWithNotify(i, j, k, 1); + } else if (world.isBlockNormalCube(i + 1, j, k)) { + world.setBlockMetadataWithNotify(i, j, k, 2); + } else if (world.isBlockNormalCube(i, j, k - 1)) { + world.setBlockMetadataWithNotify(i, j, k, 3); + } else if (world.isBlockNormalCube(i, j, k + 1)) { + world.setBlockMetadataWithNotify(i, j, k, 4); + } else if (world.isBlockNormalCube(i, j + 1, k)) { + world.setBlockMetadataWithNotify(i, j, k, 0); + } else if (this.canPlaceOnTop(world, i, j - 1, k)) { + world.setBlockMetadataWithNotify(i, j, k, 5); + } + this.dropTileIfCantStay(world, i, j, k); + } + + private boolean canPlaceOnTop(World world, int i, int j, int k) { + return world.isBlockNormalCube(i, j, k); + } + + @Override + public boolean canPlaceBlockAt(World world, int i, int j, int k) { + if (world.isBlockNormalCube(i - 1, j, k)) { + return true; + } + if (world.isBlockNormalCube(i + 1, j, k)) { + return true; + } + if (world.isBlockNormalCube(i, j, k - 1)) { + return true; + } + if (world.isBlockNormalCube(i, j, k + 1)) { + return true; + } + if (world.isBlockNormalCube(i, j + 1, k)) { + return true; + } + return world.canPlaceOnSurfaceOfBlock(i, j - 1, k); + } + + @Override + public void onNeighborBlockChange(World world, int i, int j, int k, int l) { + this.dropTileIfCantStay(world, i, j, k); + } + + private boolean dropTileIfCantStay(World world, int i, int j, int k) { + if (!this.canPlaceBlockAt(world, i, j, k)) { + this.dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k)); + world.setBlockWithNotify(i, j, k, 0); + return false; + } + return true; + } + @Override + public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k) { + this.setBlockBoundsBasedOnState(world, i, j, k); + return super.getSelectedBoundingBoxFromPool(world, i, j, k); + } + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) { + this.setBlockBoundsBasedOnState(world, i, j, k); + return super.getCollisionBoundingBoxFromPool(world, i, j, k); + } + @Override + public void setBlockBoundsBasedOnState(World world, int i, int j, int k) { + this.setBlockBoundsForBlockRender(world.getBlockMetadata(i, j, k)); + } + @Override + public void setBlockBoundsForItemRender() { + float f = 0.1875f; + this.setBlockBounds(0.0f, 0.5f - f / 2.0f, 0.0f, 1.0f, 0.5f + f / 2.0f, 1.0f); + } + + public void setBlockBoundsForBlockRender(int i) { + float f = 0.1875f; + if (i == 4) { + this.setBlockBounds(0.0f, 0.0f, 1.0f - f, 1.0f, 1.0f, 1.0f); + } + if (i == 3) { + this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, f); + } + if (i == 2) { + this.setBlockBounds(1.0f - f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + } + if (i == 1) { + this.setBlockBounds(0.0f, 0.0f, 0.0f, f, 1.0f, 1.0f); + } + if (i == 0) { + this.setBlockBounds(0.0f, 1.0f - f, 0.0f, 1.0f, 1.0f, 1.0f); + } + if (i == 5) { + this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, f, 1.0f); + } + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } +} diff --git a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java index e591f21..948ffb7 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/mixin/MixinBlockRenderer.java @@ -1,9 +1,8 @@ package net.brokenmoon.afloydwiremod.mixin; import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity; -import net.minecraft.src.Block; -import net.minecraft.src.RenderBlocks; -import net.minecraft.src.World; +import net.brokenmoon.afloydwiremod.api.AbstractWireTileSided; +import net.minecraft.src.*; import org.lwjgl.opengl.GL11; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -15,6 +14,11 @@ import java.util.ArrayList; @Mixin(value = RenderBlocks.class, remap = false) public class MixinBlockRenderer { + @Shadow + private int overrideBlockTexture; + @Shadow + private IBlockAccess blockAccess; + @Shadow public boolean renderStandardBlock(Block block, int i, int j, int k) { return false; } @Shadow @@ -26,81 +30,343 @@ public class MixinBlockRenderer { 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.xadd, wireEntity.outputs[it].wire.yadd, wireEntity.outputs[it].wire.zadd, wireEntity.outputs[it].wire.sideadd, wireEntity.outputs[it].wire.backwired); + this.renderLineBetweenTwoPoints(i, j, k, + wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z, + 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); } } } - this.renderStandardBlock(block, i, j, k); + if(block instanceof AbstractWireTileSided) { + this.renderSidedBlock(block, i, j, k); + } else { + this.renderStandardBlock(block, i, j, k); + } } } - 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){ + public boolean renderSidedBlock(Block block, int i, int j, int k) { + Tessellator tessellator = Tessellator.instance; + int l = block.getBlockTextureFromSide(0); + if (this.overrideBlockTexture >= 0) { + l = this.overrideBlockTexture; + } + float f = block.getBlockBrightness(this.blockAccess, i, j, k); + tessellator.setColorOpaque_F(f, f, f); + int i1 = l % net.minecraft.shared.Minecraft.TEXTURE_ATLAS_WIDTH_TILES * TextureFX.tileWidthTerrain; + int j1 = l / net.minecraft.shared.Minecraft.TEXTURE_ATLAS_WIDTH_TILES * TextureFX.tileWidthTerrain; + double d = (float)i1 / (float)(TextureFX.tileWidthTerrain * net.minecraft.shared.Minecraft.TEXTURE_ATLAS_WIDTH_TILES); + double d1 = ((float)i1 + ((float)TextureFX.tileWidthTerrain - 0.01f)) / (float)(TextureFX.tileWidthTerrain * net.minecraft.shared.Minecraft.TEXTURE_ATLAS_WIDTH_TILES); + double d2 = (float)j1 / (float)(TextureFX.tileWidthTerrain * net.minecraft.shared.Minecraft.TEXTURE_ATLAS_WIDTH_TILES); + double d3 = ((float)j1 + ((float)TextureFX.tileWidthTerrain - 0.01f)) / (float)(TextureFX.tileWidthTerrain * net.minecraft.shared.Minecraft.TEXTURE_ATLAS_WIDTH_TILES); + int k1 = this.blockAccess.getBlockMetadata(i, j, k); + float f1 = 0.0f; + float f2 = 0.15f; + //Top + if (k1 == 5) { + tessellator.addVertexWithUV((float)i + 0, (float)(j + 0 +f2 ) + f1, (float)(k + 1) + f1, d, d2); + tessellator.addVertexWithUV((float)i + 1, (float)(j + 0 + f2) - f1, (float)(k + 1) + f1, d, d3); + tessellator.addVertexWithUV((float)i + 1, (float)(j + 0 + f2) - f1, (float)(k + 0) - f1, d1, d3); + tessellator.addVertexWithUV((float)i + 0, (float)(j + 0 + f2) + f1, (float)(k + 0) - f1, d1, d2); + } + //Bottom + if (k1 == 0) { + tessellator.addVertexWithUV((float)i + 1, (float)(j + 1 - f2) + 0, (float)(k + 1) + f1, d, d3); + tessellator.addVertexWithUV((float)i + 0, (float)(j + 1 - f2) + 0, (float)(k + 1) + f1, d, d2); + tessellator.addVertexWithUV((float)i + 0, (float)(j + 1 - f2) + 0, (float)(k + 0) - f1, d1, d2); + tessellator.addVertexWithUV((float)i + 1, (float)(j + 1 - f2) + 0, (float)(k + 0) - f1, d1, d3); + } + if (k1 == 1) { + tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d, d2); + tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d, d3); + tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d1, d3); + tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d1, d2); + } + if (k1 == 4) { + tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d, d2); + tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d, d3); + tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d1, d3); + tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d1, d2); + } + if (k1 == 3) { + tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)k + f2, d1, d3); + tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)k + f2, d1, d2); + tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)k + f2, d, d2); + tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)k + f2, d, d3); + } + if (k1 == 2) { + tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d1, d3); + tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d1, d2); + tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d, d2); + tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d, d3); + } + 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.glColor4f(red, green, blue, alpha); GL11.glLineWidth(width); GL11.glBegin(GL11.GL_LINE_STRIP); if(!backwired) { - GL11.glVertex3f(Math.floorMod(x1, 16l) + 0.5f, Math.floorMod(y1, 16l) + 0.5f, Math.floorMod(z1, 16l) + 0.5f); + 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{ - 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(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); + } } - 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; + 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); } - 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) { - GL11.glVertex3f(Math.floorMod(x1, 16l) + 0.5f, Math.floorMod(y1, 16l) + 0.5f, Math.floorMod(z1, 16l) + 0.5f); + 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{ - 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(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.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){ - renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, red, green, blue, alpha, 1, xadd, yadd, zadd, sideadd, backwired); + 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){ - renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, red, green, blue, 255, 1, xadd, yadd, zadd, sideadd, backwired); + 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){ - renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, 255, 0, 0, 255 / 2, 5, xadd, yadd, zadd, sideadd, backwired); + 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, 255 / 2, 5, xadd, yadd, zadd, sideadd, backwired, firstblocksided, secondblocksided); } } diff --git a/src/main/java/net/brokenmoon/afloydwiremod/tile/ChipTile.java b/src/main/java/net/brokenmoon/afloydwiremod/tile/ChipTile.java index bca5e30..db3bd8f 100644 --- a/src/main/java/net/brokenmoon/afloydwiremod/tile/ChipTile.java +++ b/src/main/java/net/brokenmoon/afloydwiremod/tile/ChipTile.java @@ -1,10 +1,10 @@ package net.brokenmoon.afloydwiremod.tile; -import net.brokenmoon.afloydwiremod.api.AbstractWireTile; +import net.brokenmoon.afloydwiremod.api.AbstractWireTileSided; import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity; import net.minecraft.src.*; -public class ChipTile extends AbstractWireTile { +public class ChipTile extends AbstractWireTileSided { public ChipTile(int i, Material material) { super(i, material); }