Jump to content

Recommended Posts

Posted

When I render one of the models i use for a held item the rotation is wrong while in 1st person. in 3rd person it's in the right place but in 1st person the model is sideways. Sorry if I'm not making sense, it's hard for me to explain. Also, just in case it's relevant, i'm using 1.5.2.

 

Screens

http://i.imgur.com/JMHEbp6.png

http://i.imgur.com/d2PVRNN.png

http://i.imgur.com/SyvgtVK.jpg

 

 

Here's the code form the render file.

package mods.StarTrek.textures.render;

import mods.StarTrek.models.ModelPhaser;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;

public class RenderPhaser extends Render implements IItemRenderer
{
protected ModelPhaser launcherModel;

public RenderPhaser()
{
	launcherModel = new ModelPhaser();
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
	switch(type)
	{
	case EQUIPPED: return true;
	default: return false;
	}
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
		ItemRendererHelper helper) 
{

	return false;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) 
{
	switch(type)
	{
	case EQUIPPED:
	{

		GL11.glPushMatrix();

		GL11.glRotatef(190F, 1.0F, 0.0F, 0.0F);
		GL11.glRotatef(167F, 0.0F, 1.0F, 0.0F);
		GL11.glRotatef(16F, 0.0F, 0.0F, 1.0F);

		GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/startrek/textures/models/phaserGun.png"));

		GL11.glTranslatef(-0.5F, -0.225F, 0.45F);

		float scale = 1.0F;

		GL11.glScalef(scale, scale, scale);

		launcherModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0635F);

		GL11.glPopMatrix();
	}
	default:
		break;
	}

}

@Override
public void doRender(Entity entity, double d0, double d1, double d2,
		float f, float f1) {
	// TODO Auto-generated method stub

}

}

 

Model File(Just incase)

package mods.StarTrek.models;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelPhaser extends ModelBase
{
  //fields
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
  
  public ModelPhaser()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      Shape1 = new ModelRenderer(this, 0, 11);
      Shape1.addBox(0F, 0F, 0F, 1, 1, 2);
      Shape1.setRotationPoint(0F, 0F, -1F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 0, 15);
      Shape2.addBox(0F, 0F, 0F, 3, 3, 1);
      Shape2.setRotationPoint(-1F, -1F, -1F);
      Shape2.setTextureSize(64, 32);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 0, 22);
      Shape3.addBox(0F, 0F, 0F, 3, 4, 5);
      Shape3.setRotationPoint(-1F, -2F, -6F);
      Shape3.setTextureSize(64, 32);
      Shape3.mirror = true;
      setRotation(Shape3, 0F, 0F, 0F);
      Shape4 = new ModelRenderer(this, 0, 0);
      Shape4.addBox(0F, 0F, 0F, 3, 2, ;
      Shape4.setRotationPoint(-1F, -2F, -12F);
      Shape4.setTextureSize(64, 32);
      Shape4.mirror = true;
      setRotation(Shape4, 0F, 0F, 0F);
      Shape5 = new ModelRenderer(this, 56, 0);
      Shape5.addBox(0F, 0F, 0F, 2, 8, 2);
      Shape5.setRotationPoint(-0.5F, -1F, -6F);
      Shape5.setTextureSize(64, 32);
      Shape5.mirror = true;
      setRotation(Shape5, -0.3839724F, 0F, 0F);
      Shape6 = new ModelRenderer(this, 27, 10);
      Shape6.addBox(0F, 0F, 0F, 2, 1, 4);
      Shape6.setRotationPoint(-0.5F, -2.5F, -6F);
      Shape6.setTextureSize(64, 32);
      Shape6.mirror = true;
      setRotation(Shape6, 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(f, f1, f2, f3, f4, f5, entity);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.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(float f, float f1, float f2, float f3, float f4, float f5, Entity ent)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, ent);
  }

}

Posted

This line:

 

GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/startrek/textures/models/phaserGun.png"));

 

doesn't work anymore in 1.6.2 do you perhaps know how to fix this?

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • joptsimple.UnrecognizedOptionException: X is not a recognized option JVM-Arguments begin with a - So use -Xmx6G instead of Xmx6G etc
    • https://pastebin.com/SnWukPj8   thats the crash log if anyone can help add me on discord: privatelk
    • Remove Neruina and justleveling from your server
    • I'm attempting to make a 1.20.1-47.4.0 forge server but when I change the user_jvm_args.txt it does nothing so i tried adding it to the run.bat which it picks up on the startup console but then gives me this [21:56:01] [main/ERROR] [minecraft/Main]: Failed to start the minecraft server joptsimple.UnrecognizedOptionException: X is not a recognized option     at joptsimple.OptionException.unrecognizedOption(OptionException.java:108) ~[jopt-simple-5.0.4.jar%2393!/:?] {}     at joptsimple.OptionParser.validateOptionCharacters(OptionParser.java:633) ~[jopt-simple-5.0.4.jar%2393!/:?] {}     at joptsimple.OptionParser.handleShortOptionCluster(OptionParser.java:528) ~[jopt-simple-5.0.4.jar%2393!/:?] {}     at joptsimple.OptionParser.handleShortOptionToken(OptionParser.java:523) ~[jopt-simple-5.0.4.jar%2393!/:?] {}     at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:59) ~[jopt-simple-5.0.4.jar%2393!/:?] {}     at joptsimple.OptionParser.parse(OptionParser.java:396) ~[jopt-simple-5.0.4.jar%2393!/:?] {}     at net.minecraft.server.Main.main(Main.java:98) ~[server-1.20.1-20230612.114412-srg.jar%23101!/:?] {re:classloading}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.4.0.jar%2369!/:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.serverService(CommonLaunchHandler.java:103) ~[fmlloader-1.20.1-47.4.0.jar%2369!/:?] {}     at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$makeService$0(CommonServerLaunchHandler.java:27) ~[fmlloader-1.20.1-47.4.0.jar%2369!/:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] {} I have uninstalled and reinstalled all my versions of java and tried deleting and restarting everything several times to no avail. I have no more ideas and would appreciate any assistance.
  • Topics

×
×
  • Create New...

Important Information

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