|
|
|
@ -11,6 +11,8 @@ import org.spongepowered.asm.mixin.injection.At;
|
|
|
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
|
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
@Mixin(value = RenderBlocks.class, remap = false)
|
|
|
|
|
public class MixinBlockRenderer {
|
|
|
|
|
@Shadow
|
|
|
|
@ -24,7 +26,7 @@ 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);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -33,26 +35,72 @@ public class MixinBlockRenderer {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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){
|
|
|
|
|
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){
|
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
|
|
|
|
GL11.glColor4f(red, green, blue, alpha);
|
|
|
|
|
GL11.glLineWidth(width);
|
|
|
|
|
GL11.glBegin(GL11.GL_LINE_STRIP);
|
|
|
|
|
GL11.glVertex3f(Math.floorMod(x1, 16l), Math.floorMod(y1, 16l), Math.floorMod(z1, 16l));
|
|
|
|
|
GL11.glVertex3f(Math.floorMod(x1, 16l) - (x1 - x2), Math.floorMod(y1, 16l) - (y1 - y2), Math.floorMod(z1, 16l) - (z1 - z2));
|
|
|
|
|
if(!backwired) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
if(backwired) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
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){
|
|
|
|
|
renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, red, green, blue, alpha, 1);
|
|
|
|
|
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){
|
|
|
|
|
renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, red, green, blue, 255, 1);
|
|
|
|
|
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){
|
|
|
|
|
renderLineBetweenTwoPoints(x1, y1, z1, x2, y2, z2, 255, 0, 0, 255 / 2, 1);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|