Java tutorial
package io.cyb3rwarri0r8.commumod.entity.render; /* * CommuMod - A Minecraft Modification * Copyright (C) ${YEAR} Cyb3rWarri0r8 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ import io.cyb3rwarri0r8.commumod.entity.EntitySuperbiumGolem; import io.cyb3rwarri0r8.commumod.lib.Reference; import io.cyb3rwarri0r8.commumod.entity.model.ModelSuperbiumGolem; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; public class RenderSuperbiumGolem extends RenderLiving { private static final ResourceLocation superbiumGolemTextures = new ResourceLocation( Reference.MODID + ":" + "textures/entity/superbiumGolem.png"); /* Superbium Golem's Model. */ private final ModelSuperbiumGolem superbiumGolemModel; public RenderSuperbiumGolem(RenderManager renderManager) { super(renderManager, new ModelSuperbiumGolem(), 0.5F); this.superbiumGolemModel = (ModelSuperbiumGolem) this.mainModel; } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(EntitySuperbiumGolem p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntitySuperbiumGolem p_110775_1_) { return superbiumGolemTextures; } protected void rotateCorpse(EntitySuperbiumGolem p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { super.rotateCorpse(p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); if ((double) p_77043_1_.limbSwingAmount >= 0.01D) { float f3 = 13.0F; float f4 = p_77043_1_.limbSwing - p_77043_1_.limbSwingAmount * (1.0F - p_77043_4_) + 6.0F; float f5 = (Math.abs(f4 % f3 - f3 * 0.5F) - f3 * 0.25F) / (f3 * 0.25F); GL11.glRotatef(6.5F * f5, 0.0F, 0.0F, 1.0F); } } protected void renderEquippedItems(EntitySuperbiumGolem p_77029_1_, float p_77029_2_) { // super.renderEquippedItems(p_77029_1_, p_77029_2_); if (p_77029_1_.getHoldRoseTick() != 0) { GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glRotatef( 5.0F + 180.0F * this.superbiumGolemModel.superbiumGolemRightArm.rotateAngleX / (float) Math.PI, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(-0.6875F, 1.25F, -0.9375F); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); float f1 = 0.8F; GL11.glScalef(f1, -f1, f1); int i = p_77029_1_.getBrightnessForRender(p_77029_2_); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.bindTexture(TextureMap.locationBlocksTexture); // this.(Blocks.red_flower, 0, 1.0F); GL11.glPopMatrix(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } } protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_) { this.renderEquippedItems((EntitySuperbiumGolem) p_77029_1_, p_77029_2_); } protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { this.rotateCorpse((EntitySuperbiumGolem) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntitySuperbiumGolem) p_110775_1_); } }