|
|
|
@ -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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|