Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package buildermod.client;
- import net.minecraft.block.Block;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.renderer.RenderBlocks;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.texture.TextureManager;
- import net.minecraft.client.renderer.texture.TextureMap;
- import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.ResourceLocation;
- import org.lwjgl.opengl.GL11;
- import buildermod.common.SubWorld;
- import buildermod.common.TileEntityPalette;
- public class TileEntityPaletteRenderer extends TileEntitySpecialRenderer {
- private static final ResourceLocation RSC_PALETTE = new ResourceLocation("buildermod:textures/entities/palette.png");
- ModelPalette palette = new ModelPalette();
- public static SubWorld sw = new SubWorld();
- public void renderTileEntityAt(TileEntityPalette entity, double x, double y, double z, float f) {
- // int dir = entity.getWorldObj().getBlockMetadata(entity.xCoord, entity.yCoord, entity.zCoord) & 3;
- bindTexture(RSC_PALETTE);
- float rotation = entity.getWorldObj().getWorldTime() % 360;
- GL11.glPushMatrix();
- GL11.glTranslated(x, y, z);
- GL11.glTranslated(.5, .5, .5);
- GL11.glRotated(rotation, 0, 1, 0);
- GL11.glTranslated(-.5, -.5, -.5);
- GL11.glPushMatrix();
- GL11.glTranslated(0, 1, 1);
- GL11.glScaled(1, -1, -1);
- GL11.glColor3f(1, 1, 1);
- // GL11.glRotated(90 * (dir + 2), 0, 1, 0);
- palette.renderAll();
- GL11.glPopMatrix();
- GL11.glPushMatrix();
- GL11.glTranslated(1.0/16, 3.0/16, 1.0/16);
- GL11.glScaled(14.0/64, 14.0/64, 14.0/64);
- RenderBlocks rb = RenderHelper.rb;
- rb.blockAccess = sw;
- TextureManager tm = Minecraft.getMinecraft().getTextureManager();
- tm.bindTexture(TextureMap.locationBlocksTexture);
- Tessellator.instance.startDrawingQuads();
- for (int xx = 0; xx < 4; xx++) {
- for (int yy = 0; yy < 4; yy++) {
- for (int zz = 0; zz < 4; zz++) {
- Block block = sw.getBlock(xx, yy, zz);
- rb.renderBlockByRenderType(block, xx, yy, zz);
- }
- }
- }
- Tessellator.instance.draw();
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
- @Override
- public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float f) {
- renderTileEntityAt((TileEntityPalette)entity, x, y, z, f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement