Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, when i try to rotate part of model of entity for 90°, it rotates for about 15°  i think.

i rotate it in model class.

model code (before rotation):

 

// Date: 9.6.2015 2:24:46 PM

// Template version 1.1

// Java generated by Techne

// Keep in mind that you still need to fill in some blanks

// - ZeuX

 

 

 

 

 

 

package ga.warixmods.akamegakillmod.client.model;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelRocketLauncherRM extends ModelBase

{

  //fields

    ModelRenderer head;

    ModelRenderer neck;

    ModelRenderer body;

 

  public ModelRocketLauncherRM()

  {

    textureWidth = 64;

    textureHeight = 32;

   

    head = new ModelRenderer(this, 0, 0);

    head.addBox(-3.5F, -5F, -3.5F, 7, 5, 7);

    head.setRotationPoint(-0.5F, 20F, -0.5F);

    head.setTextureSize(64, 32);

    head.mirror = true;

    setRotation(head, 0F, 0F, 0F);

    neck = new ModelRenderer(this, 28, 8);

    neck.addBox(0F, 0F, 0F, 1, 3, 1);

    neck.setRotationPoint(-1F, 20F, -1F);

    neck.setTextureSize(64, 32);

    neck.mirror = true;

    setRotation(neck, 0F, 0F, 0F);

    body = new ModelRenderer(this, 28, 0);

    body.addBox(0F, 0F, 0F, 7, 1, 7);

    body.setRotationPoint(-4F, 23F, -4F);

    body.setTextureSize(64, 32);

    body.mirror = true;

    setRotation(body, 0F, 0F, 0F);

  }

 

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.render(entity, f, f1, f2, f3, f4, f5);

    setRotationAngles(entity,f, f1, f2, f3, f4, f5);

    head.render(f5);

    neck.render(f5);

    body.render(f5);

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(Entity entity,float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5,entity);

  }

 

}

 

 

Model code with rotation:

 

// Date: 9.6.2015 2:24:46 PM

// Template version 1.1

// Java generated by Techne

// Keep in mind that you still need to fill in some blanks

// - ZeuX

 

 

 

 

 

 

package ga.warixmods.akamegakillmod.client.model;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelRocketLauncherRM extends ModelBase

{

  //fields

    ModelRenderer head;

    ModelRenderer neck;

    ModelRenderer body;

 

  public ModelRocketLauncherRM()

  {

    textureWidth = 64;

    textureHeight = 32;

   

    head = new ModelRenderer(this, 0, 0);

    head.addBox(-3.5F, -5F, -3.5F, 7, 5, 7);

    head.setRotationPoint(-0.5F, 20F, -0.5F);

    head.setTextureSize(64, 32);

    head.mirror = true;

    setRotation(head, 0F, 90F, 0F);

    neck = new ModelRenderer(this, 28, 8);

    neck.addBox(0F, 0F, 0F, 1, 3, 1);

    neck.setRotationPoint(-1F, 20F, -1F);

    neck.setTextureSize(64, 32);

    neck.mirror = true;

    setRotation(neck, 0F, 0F, 0F);

    body = new ModelRenderer(this, 28, 0);

    body.addBox(0F, 0F, 0F, 7, 1, 7);

    body.setRotationPoint(-4F, 23F, -4F);

    body.setTextureSize(64, 32);

    body.mirror = true;

    setRotation(body, 0F, 0F, 0F);

  }

 

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.render(entity, f, f1, f2, f3, f4, f5);

    setRotationAngles(entity,f, f1, f2, f3, f4, f5);

    head.render(f5);

    neck.render(f5);

    body.render(f5);

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(Entity entity,float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5,entity);

  }

 

}

 

 

Render code:

 

package ga.warixmods.akamegakillmod.client.renderer.entity;

 

import ga.warixmods.akamegakillmod.client.model.ModelRocketLauncherRM;

import ga.warixmods.akamegakillmod.entity.special.EntityRocketLauncher;

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelCow;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.client.renderer.GlStateManager;

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.util.ResourceLocation;

 

public class RenderRocketLauncher extends Render{

 

 

public RenderRocketLauncher(RenderManager rendermanagerIn) {

super(rendermanagerIn);

// TODO Auto-generated constructor stub

}

protected ModelBase modelRocketLauncher = new ModelRocketLauncherRM();

 

 

@Override

protected ResourceLocation getEntityTexture(Entity entity) {

// TODO Auto-generated method stub

return new ResourceLocation("agkm:textures/entity/rocket_launcher.png");

}

 

public void doRender(Entity boat, double p_180552_2_, double p_180552_4_, double p_180552_6_, float p_180552_8_, float p_180552_9_)

    {

        GlStateManager.pushMatrix();

        GlStateManager.translate((float)p_180552_2_, (float)p_180552_4_ + 0.25F, (float)p_180552_6_);

       

        this.bindEntityTexture(boat);

       

       

        this.modelRocketLauncher.render(boat, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

        GlStateManager.popMatrix();

        super.doRender(boat, p_180552_2_, p_180552_4_, p_180552_6_, p_180552_8_, p_180552_9_);

    }

}

 

 

Before rotation:

width=800 height=449http://orig03.deviantart.net/50f2/f/2015/249/0/4/2015_09_06_17_20_14_by_warix3-d98l8dn.png[/img]

After rotation:

width=800 height=449http://orig08.deviantart.net/19cf/f/2015/249/a/9/2015_09_06_17_18_59_by_warix3-d98l8el.png[/img]

:D

Rotations are in radians.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

Thanks, also if somebody doesn't know how to convert degrees to radians you do it like this:

int degrees = 90,radians;

degrees / (180/Math.PI) = radians;

:D
Math.toRadians(angdeg)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.