added cuboid
This commit is contained in:
@@ -2,13 +2,9 @@ package kaptainwutax.seedcracker.render;
|
||||
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
public class Cube extends Renderer {
|
||||
|
||||
public BlockPos pos;
|
||||
public Vector4f color;
|
||||
|
||||
private Line[] edges = new Line[12];
|
||||
public class Cube extends Cuboid {
|
||||
|
||||
public Cube() {
|
||||
this(BlockPos.ORIGIN, new Vector4f(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
@@ -19,30 +15,7 @@ public class Cube extends Renderer {
|
||||
}
|
||||
|
||||
public Cube(BlockPos pos, Vector4f color) {
|
||||
this.pos = pos;
|
||||
this.color = color;
|
||||
this.edges[0] = new Line(toVec3d(pos), toVec3d(pos.add(1, 0, 0)), this.color);
|
||||
this.edges[1] = new Line(toVec3d(pos), toVec3d(pos.add(0, 1, 0)), this.color);
|
||||
this.edges[2] = new Line(toVec3d(pos), toVec3d(pos.add(0, 0, 1)), this.color);
|
||||
this.edges[3] = new Line(toVec3d(pos.add(1, 0, 1)), toVec3d(pos.add(1, 0, 0)), this.color);
|
||||
this.edges[4] = new Line(toVec3d(pos.add(1, 0, 1)), toVec3d(pos.add(1, 1, 1)), this.color);
|
||||
this.edges[5] = new Line(toVec3d(pos.add(1, 0, 1)), toVec3d(pos.add(0, 0, 1)), this.color);
|
||||
this.edges[6] = new Line(toVec3d(pos.add(1, 1, 0)), toVec3d(pos.add(1, 0, 0)), this.color);
|
||||
this.edges[7] = new Line(toVec3d(pos.add(1, 1, 0)), toVec3d(pos.add(0, 1, 0)), this.color);
|
||||
this.edges[8] = new Line(toVec3d(pos.add(1, 1, 0)), toVec3d(pos.add(1, 1, 1)), this.color);
|
||||
this.edges[9] = new Line(toVec3d(pos.add(0, 1, 1)), toVec3d(pos.add(0, 0, 1)), this.color);
|
||||
this.edges[10] = new Line(toVec3d(pos.add(0, 1, 1)), toVec3d(pos.add(0, 1, 0)), this.color);
|
||||
this.edges[11] = new Line(toVec3d(pos.add(0, 1, 1)), toVec3d(pos.add(1, 1, 1)), this.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
if(this.pos == null || this.color == null || this.edges == null)return;
|
||||
|
||||
for(Line edge: this.edges) {
|
||||
if(edge == null)continue;
|
||||
edge.render();
|
||||
}
|
||||
super(pos, new Vec3i(1, 1, 1), color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package kaptainwutax.seedcracker.render;
|
||||
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
public class Cuboid extends Renderer {
|
||||
|
||||
public BlockPos start;
|
||||
public Vec3i size;
|
||||
public Vector4f color;
|
||||
|
||||
private Line[] edges = new Line[12];
|
||||
|
||||
public Cuboid() {
|
||||
this(BlockPos.ORIGIN, BlockPos.ORIGIN, new Vector4f(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
public Cuboid(BlockPos pos) {
|
||||
this(pos, new BlockPos(1, 1, 1), new Vector4f(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
public Cuboid(BlockPos start, Vec3i size, Vector4f color) {
|
||||
this.start = start;
|
||||
this.size = size;
|
||||
this.color = color;
|
||||
this.edges[0] = new Line(toVec3d(this.start), toVec3d(this.start.add(this.size.getX(), 0, 0)), this.color);
|
||||
this.edges[1] = new Line(toVec3d(this.start), toVec3d(this.start.add(0, this.size.getY(), 0)), this.color);
|
||||
this.edges[2] = new Line(toVec3d(this.start), toVec3d(this.start.add(0, 0, this.size.getZ())), this.color);
|
||||
this.edges[3] = new Line(toVec3d(this.start.add(this.size.getX(), 0, this.size.getZ())), toVec3d(this.start.add(this.size.getX(), 0, 0)), this.color);
|
||||
this.edges[4] = new Line(toVec3d(this.start.add(this.size.getX(), 0, this.size.getZ())), toVec3d(this.start.add(this.size.getX(), this.size.getY(), this.size.getZ())), this.color);
|
||||
this.edges[5] = new Line(toVec3d(this.start.add(this.size.getX(), 0, this.size.getZ())), toVec3d(this.start.add(0, 0, this.size.getZ())), this.color);
|
||||
this.edges[6] = new Line(toVec3d(this.start.add(this.size.getX(), this.size.getY(), 0)), toVec3d(this.start.add(this.size.getX(), 0, 0)), this.color);
|
||||
this.edges[7] = new Line(toVec3d(this.start.add(this.size.getX(), this.size.getY(), 0)), toVec3d(this.start.add(0, this.size.getY(), 0)), this.color);
|
||||
this.edges[8] = new Line(toVec3d(this.start.add(this.size.getX(), this.size.getY(), 0)), toVec3d(this.start.add(this.size.getX(), this.size.getY(), this.size.getZ())), this.color);
|
||||
this.edges[9] = new Line(toVec3d(this.start.add(0, this.size.getY(), this.size.getZ())), toVec3d(this.start.add(0, 0, this.size.getZ())), this.color);
|
||||
this.edges[10] = new Line(toVec3d(this.start.add(0, this.size.getY(), this.size.getZ())), toVec3d(this.start.add(0, this.size.getY(), 0)), this.color);
|
||||
this.edges[11] = new Line(toVec3d(this.start.add(0, this.size.getY(), this.size.getZ())), toVec3d(this.start.add(this.size.getX(), this.size.getY(), this.size.getZ())), this.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
if(this.start == null || this.size == null || this.color == null || this.edges == null)return;
|
||||
|
||||
for(Line edge: this.edges) {
|
||||
if(edge == null)continue;
|
||||
edge.render();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user