Skip to content

Instantly share code, notes, and snippets.

@ThexXTURBOXx
Created June 1, 2017 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThexXTURBOXx/6821938191f0f39f3300ff0cbc9ae60b to your computer and use it in GitHub Desktop.
Save ThexXTURBOXx/6821938191f0f39f3300ff0cbc9ae60b to your computer and use it in GitHub Desktop.
package de.Femtopedia.XYCraftRL.client;
import de.Femtopedia.XYCraftRL.TileEntityGlow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.client.model.animation.FastTESR;
public class GlowTESR extends FastTESR<TileEntityGlow> {
@Override
public void renderTileEntityFast(TileEntityGlow te, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer buf) {
for(int i = 0; i < te.layers.size(); i++) {
buf.setTranslation(x, y, z);
float cx = te.coordX.get(i);
float cy = te.coordY.get(i);
float maxx = te.maxX.get(i);
float maxy = te.maxY.get(i);
BlockPos pos = new BlockPos(x, y, z);
int j = te.getWorld().isBlockLoaded(pos) ? te.getWorld().getCombinedLight(pos, 0) : 0;
int l1 = j >> 16 & 65535;
int l2 = j & 65535;
bindTexture(te.layers.get(i));
Minecraft.getMinecraft().renderEngine.bindTexture(te.layers.get(i));
//NORTH
buf.pos(0, 1, 0).color(255, 255, 255, 255).tex(cx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(1, 1, 0).color(255, 255, 255, 255).tex(cx + maxx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(1, 0, 0).color(255, 255, 255, 255).tex(cx + maxx, cy).lightmap(l1, l2).endVertex();
buf.pos(0, 0, 0).color(255, 255, 255, 255).tex(cx, cy).lightmap(l1, l2).endVertex();
//SOUTH
buf.pos(1, 1, 1).color(255, 255, 255, 255).tex(cx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 1, 1).color(255, 255, 255, 255).tex(cx + maxx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 0, 1).color(255, 255, 255, 255).tex(cx + maxx, cy).lightmap(l1, l2).endVertex();
buf.pos(1, 0, 1).color(255, 255, 255, 255).tex(cx, cy).lightmap(l1, l2).endVertex();
//EAST
buf.pos(1, 1, 0).color(255, 255, 255, 255).tex(cx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(1, 1, 1).color(255, 255, 255, 255).tex(cx + maxx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(1, 0, 1).color(255, 255, 255, 255).tex(cx + maxx, cy).lightmap(l1, l2).endVertex();
buf.pos(1, 0, 0).color(255, 255, 255, 255).tex(cx, cy).lightmap(l1, l2).endVertex();
//WEST
buf.pos(0, 1, 1).color(255, 255, 255, 255).tex(cx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 1, 0).color(255, 255, 255, 255).tex(cx + maxx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 0, 0).color(255, 255, 255, 255).tex(cx + maxx, cy).lightmap(l1, l2).endVertex();
buf.pos(0, 0, 1).color(255, 255, 255, 255).tex(cx, cy).lightmap(l1, l2).endVertex();
//TOP
buf.pos(1, 1, 0).color(255, 255, 255, 255).tex(cx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 1, 0).color(255, 255, 255, 255).tex(cx + maxx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 1, 1).color(255, 255, 255, 255).tex(cx + maxx, cy).lightmap(l1, l2).endVertex();
buf.pos(1, 1, 1).color(255, 255, 255, 255).tex(cx, cy).lightmap(l1, l2).endVertex();
//DOWN
buf.pos(1, 0, 1).color(255, 255, 255, 255).tex(cx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 0, 1).color(255, 255, 255, 255).tex(cx + maxx, cy + maxy).lightmap(l1, l2).endVertex();
buf.pos(0, 0, 0).color(255, 255, 255, 255).tex(cx + maxx, cy).lightmap(l1, l2).endVertex();
buf.pos(1, 0, 0).color(255, 255, 255, 255).tex(cx, cy).lightmap(l1, l2).endVertex();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment