Java tutorial
// Copyright 2012-2014 Matthew Karcz // // This file is part of The Rediscovered Mod. // // The Rediscovered Mod 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 // (at your option) any later version. // // The Rediscovered Mod 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 The Rediscovered Mod. If not, see <http://www.gnu.org/licenses/>. // Date: 11/3/2013 12:13:44 PM // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package RediscoveredMod; import org.lwjgl.opengl.GL11; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelStairs extends ModelBase { //fields ModelRenderer seat; ModelRenderer back; public ModelStairs() { textureWidth = 64; textureHeight = 32; seat = new ModelRenderer(this, 0, 14); seat.addBox(0F, 0F, 0F, 16, 8, 16); seat.setRotationPoint(-8F, 16F, -8F); seat.setTextureSize(64, 32); seat.mirror = true; setRotation(seat, 0F, 0F, 0F); back = new ModelRenderer(this, 8, 0); back.addBox(0F, 0F, 0F, 16, 8, 8); back.setRotationPoint(-8F, 8F, 0F); back.setTextureSize(64, 32); back.mirror = true; setRotation(back, 0F, 0F, 0F); } public void render(float scale, double x, double y, double z, float ang, float angY, boolean renderLantern, boolean lanternOn, boolean renderHeadTorch) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); GL11.glPushMatrix(); GL11.glRotatef(ang, 1f, 0f, 0f); GL11.glRotatef(angY, 0f, 1f, 0f); seat.render(scale); back.render(scale); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void renderAll() { seat.render(0.0625F); back.render(0.0625F); } }