Skip to content

Instantly share code, notes, and snippets.

@magnifikus
Created April 4, 2013 21:07
Show Gist options
  • Save magnifikus/5314359 to your computer and use it in GitHub Desktop.
Save magnifikus/5314359 to your computer and use it in GitHub Desktop.
@Override
public boolean render(int x, int y, int z, RenderBlocks renderer) {
Vec3Pool vp = renderer.blockAccess.getWorldVec3Pool();
for (int s = 0; s < 6; s++) {
if (parts[s] == null)
continue;
TileSeptonPart ts = (TileSeptonPart) parts[s];
SeptonModel m = ts.getModel();
long mf = ts.getModelFlags();
List<Vec3> vecs = new LinkedList<Vec3>();
List<Double> d1 = new LinkedList<Double>();
List<Double> d2 = new LinkedList<Double>();
for (Quinternion q : m.getDescription()) {
if ((q.getFlags() & mf) != 0) {
Vec3 v = Vec3E.clone(q.getVec(), vp);
vecs.add(v);
d1.add(q.getDx());
d2.add(q.getDy());
}
}
transformForSide(s, vecs);
Tessellator tess = Tessellator.instance;
Icon icon = renderer.getBlockIconFromSide(Block.cobblestone, 0);
tess.setBrightness(Block.lever.getMixedBrightnessForBlock(
renderer.blockAccess, x, y, z));
float f3 = 1.0F;
if (Block.lightValue[Block.lever.blockID] > 0) {
f3 = 1.0F;
}
tess.setColorOpaque_F(f3, f3, f3);
Iterator<Double> idx = d1.iterator();
Iterator<Double> idy = d2.iterator();
for (Vec3 vec : vecs) {
double d1v = icon.getInterpolatedU(idx.next());
double d2v = icon.getInterpolatedV(idy.next());
tess.addVertexWithUV(vec.xCoord + x + 0.5D, vec.yCoord + y
+ 0.5D, vec.zCoord + z + 0.5D, d1v, d2v);
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment