diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelLaserRelay.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelLaserRelay.java index ca660758c..ac9b60b27 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelLaserRelay.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/ModelLaserRelay.java @@ -194,7 +194,7 @@ public class ModelLaserRelay extends ModelBaseAA{ for(LaserRelayConnectionHandler.ConnectionPair aPair : network){ TileEntityLaserRelay firstRelay = (TileEntityLaserRelay) aPair.firstRelay.getTileEntity(); if(aPair.contains(firstWP) && aPair.firstRelay.isEqual(firstWP)){ - firstRelay.firstDraw(aPair.firstRelay, aPair.secondRelay); + firstRelay.drawLine(aPair.firstRelay, aPair.secondRelay); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderLaserRelay.java b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderLaserRelay.java index 2aa680065..e65b9524a 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderLaserRelay.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/render/RenderLaserRelay.java @@ -54,10 +54,9 @@ public class RenderLaserRelay extends RenderTileEntity{ } theModel.render(0.0625F); + //A Random texture, so it is a smooth Laser! bindTexture(new ResourceLocation("actuallyadditions:textures/blocks/blockBreaker.png")); theModel.renderExtra(0.0625F, tile); - bindTexture(resLoc); - GL11.glPopMatrix(); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLaserRelay.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLaserRelay.java index 3bc956f4b..ff0910afe 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLaserRelay.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLaserRelay.java @@ -18,7 +18,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -26,6 +25,7 @@ import java.util.ArrayList; public class TileEntityLaserRelay extends TileEntityBase implements IEnergyReceiver{ + private GLColor laserColor = GLColor.RED_PURE; @Override public void invalidate(){ @@ -101,25 +101,23 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei return true; } - public void firstDraw(WorldPos firstPos, WorldPos secondPos){ + public void drawLine(WorldPos firstPos, WorldPos secondPos){ double x = firstPos.getX() - secondPos.getX(); double y = firstPos.getY() - secondPos.getY() + 1; double z = -(firstPos.getZ() - secondPos.getZ()); - double player = Minecraft.getMinecraft().thePlayer.posY-firstPos.getY(); - float f = 5; - System.out.println(player); - if(player < 10) f=5; - else if(player < 20 && player > 10) f = 4; - else if(player < 30 && player > 20) f = 3; - else if(player < 40 && player > 30) f = 2; - else if(player < 50 && player > 40) f = 1; + double relativePlayerBlockLocation = Minecraft.getMinecraft().thePlayer.posY - firstPos.getY(); + float f; + if(relativePlayerBlockLocation < 10) f=5; + else if(relativePlayerBlockLocation < 20 && relativePlayerBlockLocation > 10) f = 4; + else if(relativePlayerBlockLocation < 30 && relativePlayerBlockLocation > 20) f = 3; + else if(relativePlayerBlockLocation < 40 && relativePlayerBlockLocation > 30) f = 2; + else if(relativePlayerBlockLocation < 50 && relativePlayerBlockLocation > 40) f = 1; else f=1; - GL11.glPushMatrix(); GL11.glLineWidth(f); GL11.glBegin(GL11.GL_LINE_STRIP); { - GL11.glColor3f(1.0F, 0, 0); + GL11.glColor3f(this.laserColor.getRed(), this.laserColor.getGreen(), this.laserColor.getBlue()); GL11.glVertex3d(x, y, z); GL11.glVertex3d(0, 1, 0); } @@ -128,4 +126,34 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei GL11.glPopMatrix(); } + public void changeLineColor(GLColor color){this.laserColor = color;} + + + //Colors for the Laser: + public enum GLColor{ + + RED_PURE(1.0F, 0, 0), + GREEN_PURE(0, 1.0F, 0), + BLUE_PURE(0, 0, 1.0F), + DARK_YELLOW(1, 1, 0); + + private float red, green, blue; + GLColor(float red, float green, float blue){ + this.red = red; + this.green = green; + this.blue = blue; + } + + public float getRed() { + return red; + } + + public float getGreen() { + return green; + } + + public float getBlue() { + return blue; + } + } }