SHARE
TWEET

Кусок кода стража из мода Иванова(ADivision)

a guest Sep 22nd, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ru.batthert.client.render.entity;
  2.  
  3. import net.minecraft.client.model.ModelBase;
  4. import net.minecraft.entity.Entity;
  5. import net.minecraft.entity.EntityLiving;
  6. import net.minecraft.util.MathHelper;
  7. import net.minecraft.util.ResourceLocation;
  8. import net.minecraftforge.client.model.AdvancedModelLoader;
  9. import net.minecraftforge.client.model.IModelCustom;
  10. import org.lwjgl.opengl.GL11;
  11.  
  12. public class ModelHelperGuardian extends ModelBase {
  13.  
  14.    public static final IModelCustom body = AdvancedModelLoader.loadModel(new ResourceLocation("batmod:models/mobs/Guardian/body.obj"));
  15.    public static final IModelCustom leftarm = AdvancedModelLoader.loadModel(new ResourceLocation("batmod:models/mobs/Guardian/leftarm.obj"));
  16.    public static final IModelCustom leftleg = AdvancedModelLoader.loadModel(new ResourceLocation("batmod:models/mobs/Guardian/leftleg.obj"));
  17.    public static final IModelCustom rightarm = AdvancedModelLoader.loadModel(new ResourceLocation("batmod:models/mobs/Guardian/rightarm.obj"));
  18.    public static final IModelCustom rightleg = AdvancedModelLoader.loadModel(new ResourceLocation("batmod:models/mobs/Guardian/rightleg.obj"));
  19.    private int body_index;
  20.    private int leftarm_index;
  21.    private int leftleg_index;
  22.    private int rightarm_index;
  23.    private int rightleg_index;
  24.  
  25.  
  26.    public ModelHelperGuardian() {
  27.       this.body_index = this.createCallList(this.body_index, body);
  28.       this.leftarm_index = this.createCallList(this.leftarm_index, leftarm);
  29.       this.leftleg_index = this.createCallList(this.leftleg_index, leftleg);
  30.       this.rightarm_index = this.createCallList(this.rightarm_index, rightarm);
  31.       this.rightleg_index = this.createCallList(this.rightleg_index, rightleg);
  32.    }
  33.  
  34.    public void render(Entity entity, float par1, float par2, float par4, float par5, float par6, float par7) {
  35.       float handCurRot2 = MathHelper.cos(par1 * 0.6662F + 3.1415927F) * 1.4F * par2;
  36.       EntityLiving entity1 = (EntityLiving)entity;
  37.       GL11.glPushMatrix();
  38.       GL11.glTranslatef(0.0F, 0.7F, 0.0F);
  39.       GL11.glScaled(0.5D, 0.5D, 0.5D);
  40.       GL11.glPushMatrix();
  41.       GL11.glTranslatef(0.0F, 1.5F, 0.75F);
  42.       GL11.glRotatef(195.0F, 1.0F, 0.0F, 0.0F);
  43.       GL11.glCallList(this.body_index);
  44.       GL11.glPushMatrix();
  45.       GL11.glTranslatef(-0.05F, 1.771F, 0.863F);
  46.       GL11.glRotatef(0.0F, 1.0F, 0.0F, 0.0F);
  47.       GL11.glRotatef(handCurRot2 * 10.0F, 0.0F, 1.0F, 0.0F);
  48.       GL11.glRotatef(handCurRot2 * 20.0F, 1.0F, 0.0F, 0.0F);
  49.       GL11.glCallList(this.leftarm_index);
  50.       GL11.glPopMatrix();
  51.       GL11.glPushMatrix();
  52.       GL11.glTranslatef(0.05F, 1.771F, 0.863F);
  53.       GL11.glRotatef(0.0F, 1.0F, 0.0F, 0.0F);
  54.       GL11.glRotatef(handCurRot2 * 10.0F, 0.0F, 1.0F, 0.0F);
  55.       GL11.glRotatef(handCurRot2 * 20.0F, 1.0F, 0.0F, 0.0F);
  56.       GL11.glCallList(this.rightarm_index);
  57.       GL11.glPopMatrix();
  58.       GL11.glPushMatrix();
  59.       GL11.glTranslatef(0.02F, 1.35F, 0.2F);
  60.       GL11.glRotatef(-handCurRot2 * 30.0F, 1.0F, 0.0F, 0.0F);
  61.       GL11.glCallList(this.rightleg_index);
  62.       GL11.glPopMatrix();
  63.       GL11.glPushMatrix();
  64.       GL11.glTranslatef(-0.02F, 1.35F, 0.2F);
  65.       GL11.glRotatef(-handCurRot2 * 30.0F, 1.0F, 0.0F, 0.0F);
  66.       GL11.glCallList(this.leftleg_index);
  67.       GL11.glPopMatrix();
  68.       GL11.glPopMatrix();
  69.       GL11.glPopMatrix();
  70.    }
  71.  
  72.    public int createCallList(int name, IModelCustom model) {
  73.       name = GL11.glGenLists(1);
  74.       GL11.glNewList(name, 4864);
  75.       model.renderAll();
  76.       GL11.glEndList();
  77.       return name;
  78.    }
  79.  
  80. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top