Created
June 1, 2017 16:15
-
-
Save ThexXTURBOXx/6821938191f0f39f3300ff0cbc9ae60b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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