Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sometimesHardcoreSometimes;
- import net.minecraft.block.Block;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.renderer.OpenGlHelper;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
- import net.minecraft.entity.Entity;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.world.World;
- import org.lwjgl.opengl.GL11;
- public class RenderSapphireCrop extends TileEntitySpecialRenderer
- {
- private final ModelSapphireCrop model;
- int bAmt;
- public RenderSapphireCrop()
- {
- this.model = new ModelSapphireCrop();
- }
- private void adjustedRotatePivotViaMeta(World world, int x, int y, int z)
- {
- int meta = world.getBlockMetadata(x, y, z);
- GL11.glPushMatrix();
- GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
- GL11.glPopMatrix();
- }
- @Override
- public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
- bAmt = BlockSapphireCrop.getBerryAmount();
- ResourceLocation textures;
- //Handles the texture
- switch(bAmt)
- {
- case 0:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_0.png"));
- break;
- case 1:
- case 2:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_1.png"));
- break;
- case 3:
- case 4:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_2.png"));
- break;
- case 5:
- case 6:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_3.png"));
- break;
- case 7:
- case 8:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_4.png"));
- break;
- case 9:
- case 10:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_5.png"));
- break;
- case 11:
- case 12:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_6.png"));
- break;
- case 13:
- case 14:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_7.png"));
- break;
- default:
- textures = (new ResourceLocation(Base.modid + ":textures/tileentity/sapphireCrop/sapphireCrop_0.png"));
- break;
- }
- Minecraft.getMinecraft().renderEngine.bindTexture(textures);
- int meta = tileEntity.getBlockMetadata();
- GL11.glPushMatrix();
- if(meta % 4 == 0) GL11.glRotatef(-180F, 1.0F, 0.0F, 1.0F);
- if(meta % 4 == 1) GL11.glRotatef(-180F, -1.0F, 0.0F, 1.0F);
- if(meta % 4 == 2) GL11.glRotatef(-180F, 0.0F, 0.0F, 1.0F);
- if(meta % 4 == 3) GL11.glRotatef(-180F, 90F, 0.0F, 1.0F);
- this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
- private void adjustLightFixture(World world, int i, int j, int k, Block block)
- {
- Tessellator tess = Tessellator.instance;
- float brightness = block.getBlockBrightness(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
- int modulousModifier = skyLight % 65536;
- int divModifier = skyLight / 65536;
- tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)modulousModifier, divModifier);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment