Jump to content

Custom Held Item Model Rotation Problem


Gurman8r

Recommended Posts

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);
  }

}

Link to comment
Share on other sites

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

    • For example, is it possible to make it so that when you press the bone meal on the block, it changes to something else   Game Version 1.12.2
    • Yep, any other modpack worked… so maybe I should give up about this? 
    • Add crash-reports with sites like https://paste.ee/ and paste the link to it here   Make a test without Relics  
    • So launcher detect the next error: [02jun.2024 11:58:49.396] [main/ERROR] [mixin/]: Mixin config lolenderite.mixins.json does not specify "minVersion" property. Stoping the game to run normally, what should I do?   [02jun.2024 11:58:41.058] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, maaaarcoss, --version, 1.20.1-forge-47.2.30, --gameDir, C:\Users\marco\AppData\Roaming\.minecraft, --assetsDir, C:\Users\marco\AppData\Roaming\.minecraft\assets, --assetIndex, 5, --uuid, a9e19e1b4966318486d84346db748b2d, --accessToken, ????????, --clientId, 0, --xuid, 0, --userType, msa, --versionType, release, --launchTarget, forgeclient, --fml.forgeVersion, 47.2.30, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [02jun.2024 11:58:41.058] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.8 by Microsoft; OS Windows 11 arch amd64 version 10.0 [02jun.2024 11:58:43.251] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [02jun.2024 11:58:43.473] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 [02jun.2024 11:58:43.969] [main/INFO] [EARLYDISPLAY/]: Requested GL version 4.6 got version 4.6 [02jun.2024 11:58:44.163] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.onLoad [02jun.2024 11:58:44.165] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFine ZIP file URL: union:/C:/Users/marco/AppData/Roaming/.minecraft/mods/OptiFine_1.20.1_HD_U_I6.jar%23268!/ [02jun.2024 11:58:44.171] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFine ZIP file: C:\Users\marco\AppData\Roaming\.minecraft\mods\OptiFine_1.20.1_HD_U_I6.jar [02jun.2024 11:58:44.174] [main/INFO] [optifine.OptiFineTransformer/]: Target.PRE_CLASS is available [02jun.2024 11:58:44.246] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/marco/AppData/Roaming/.minecraft/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%23100!/ Service=ModLauncher Env=CLIENT [02jun.2024 11:58:44.255] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.initialize [02jun.2024 11:58:44.281] [pool-4-thread-1/INFO] [EARLYDISPLAY/]: GL info: Intel(R) Iris(R) Xe Graphics GL version 4.6.0 - Build 31.0.101.5522, Intel [02jun.2024 11:58:45.120] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\marco\AppData\Roaming\.minecraft\libraries\net\minecraftforge\fmlcore\1.20.1-47.2.30\fmlcore-1.20.1-47.2.30.jar is missing mods.toml file [02jun.2024 11:58:45.238] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\marco\AppData\Roaming\.minecraft\libraries\net\minecraftforge\javafmllanguage\1.20.1-47.2.30\javafmllanguage-1.20.1-47.2.30.jar is missing mods.toml file [02jun.2024 11:58:45.314] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\marco\AppData\Roaming\.minecraft\libraries\net\minecraftforge\lowcodelanguage\1.20.1-47.2.30\lowcodelanguage-1.20.1-47.2.30.jar is missing mods.toml file [02jun.2024 11:58:45.387] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\marco\AppData\Roaming\.minecraft\libraries\net\minecraftforge\mclanguage\1.20.1-47.2.30\mclanguage-1.20.1-47.2.30.jar is missing mods.toml file [02jun.2024 11:58:45.869] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File:  and Mod File: . Using Mod File:  [02jun.2024 11:58:45.871] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: apexcore. Using Mod File: C:\Users\marco\AppData\Roaming\.minecraft\mods\apexcore-1.20.1-10.0.0.jar [02jun.2024 11:58:45.871] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: expandability. Using Mod File: C:\Users\marco\AppData\Roaming\.minecraft\mods\expandability-9.0.0.jar [02jun.2024 11:58:45.872] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 17 dependencies adding them to mods collection [02jun.2024 11:58:46.452] [main/INFO] [optifine.OptiFineTransformationService/]: OptiFineTransformationService.transformers [02jun.2024 11:58:46.457] [main/INFO] [optifine.OptiFineTransformer/]: Targets: 412 [02jun.2024 11:58:47.036] [main/INFO] [optifine.OptiFineTransformationService/]: additionalClassesLocator: [optifine., net.optifine.] [02jun.2024 11:58:49.345] [main/INFO] [mixin/]: Compatibility level set to JAVA_17 [02jun.2024 11:58:49.396] [main/ERROR] [mixin/]: Mixin config lolenderite.mixins.json does not specify "minVersion" property [02jun.2024 11:58:49.728] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeclient' with arguments [--version, 1.20.1-forge-47.2.30, --gameDir, C:\Users\marco\AppData\Roaming\.minecraft, --assetsDir, C:\Users\marco\AppData\Roaming\.minecraft\assets, --uuid, a9e19e1b4966318486d84346db748b2d, --username, maaaarcoss, --assetIndex, 5, --accessToken, ????????, --clientId, 0, --xuid, 0, --userType, msa, --versionType, release] [02jun.2024 11:58:49.783] [main/WARN] [mixin/]: Reference map 'handcrafted-forge-1.20.1-forge-refmap.json' for handcrafted.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:49.797] [main/WARN] [mixin/]: Reference map 'letsdo-brewery-forge-forge-refmap.json' for brewery.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:49.813] [main/WARN] [mixin/]: Reference map 'smallships-forge-refmap.json' for smallships.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:49.824] [main/WARN] [mixin/]: Reference map 'octolib.refmap.json' for octolib.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:49.831] [main/WARN] [mixin/]: Reference map 'graveyard-FORGE-forge-refmap.json' for graveyard-forge.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:49.943] [main/WARN] [mixin/]: Reference map 'coroutil.refmap.json' for coroutil.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:49.948] [main/WARN] [mixin/]: Reference map 'apexcore.refmap.json' for apexcore.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:49.953] [main/WARN] [mixin/]: Reference map 'chiselsandbits.refmap.json' for chisels-and-bits.mixins.json could not be read. If this is a development environment you can ignore this message [02jun.2024 11:58:50.487] [main/WARN] [mixin/]: Error loading class: dev/latvian/mods/kubejs/recipe/RecipesEventJS (java.lang.ClassNotFoundException: dev.latvian.mods.kubejs.recipe.RecipesEventJS) [02jun.2024 11:58:50.487] [main/WARN] [mixin/]: @Mixin target dev.latvian.mods.kubejs.recipe.RecipesEventJS was not found mixins.hammerlib.json:bs.kubejs.RecipeEventJSMixin [02jun.2024 11:58:51.074] [main/WARN] [mixin/]: Error loading class: sereneseasons/handler/season/RandomUpdateHandler (java.lang.ClassNotFoundException: sereneseasons.handler.season.RandomUpdateHandler) [02jun.2024 11:58:51.074] [main/WARN] [mixin/]: @Mixin target sereneseasons.handler.season.RandomUpdateHandler was not found snowrealmagic.mixins.json:sereneseasons.RandomUpdateHandlerMixin [02jun.2024 11:58:51.084] [main/WARN] [mixin/]: Error loading class: me/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer (java.lang.ClassNotFoundException: me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer) [02jun.2024 11:58:51.084] [main/WARN] [mixin/]: @Mixin target me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer was not found snowrealmagic.mixins.json:sodium.BlockRendererAccess [02jun.2024 11:58:51.086] [main/WARN] [mixin/]: Error loading class: me/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer (java.lang.ClassNotFoundException: me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer) [02jun.2024 11:58:51.086] [main/WARN] [mixin/]: @Mixin target me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer was not found snowrealmagic.mixins.json:sodium.BlockRendererMixin [02jun.2024 11:58:51.292] [main/WARN] [mixin/]: Error loading class: me/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/FluidRenderer (java.lang.ClassNotFoundException: me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer) [02jun.2024 11:58:51.441] [main/WARN] [mixin/]: Error loading class: net/raphimc/immediatelyfast/feature/map_atlas_generation/MapAtlasTexture (java.lang.ClassNotFoundException: net.raphimc.immediatelyfast.feature.map_atlas_generation.MapAtlasTexture) [02jun.2024 11:58:51.481] [main/WARN] [mixin/]: Error loading class: jeresources/api/util/LootConditionHelper (java.lang.ClassNotFoundException: jeresources.api.util.LootConditionHelper) [02jun.2024 11:58:51.481] [main/WARN] [mixin/]: @Mixin target jeresources.api.util.LootConditionHelper was not found mixins.improvableskills.json:jer.LootConditionHelperMixin [02jun.2024 11:58:51.902] [main/WARN] [mixin/]: Error loading class: twilightforest/TFMagicMapData$TFMapDecoration (java.lang.ClassNotFoundException: twilightforest.TFMagicMapData$TFMapDecoration) [02jun.2024 11:58:52.327] [main/WARN] [mixin/]: Error loading class: me/cominixo/betterf3/modules/TargetModule (java.lang.ClassNotFoundException: me.cominixo.betterf3.modules.TargetModule) [02jun.2024 11:58:52.328] [main/WARN] [mixin/]: @Mixin target me.cominixo.betterf3.modules.TargetModule was not found securitycraft.mixins.json:f3.BetterF3TargetModuleMixin [02jun.2024 11:58:53.160] [main/INFO] [MixinExtras|Service/]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.5). [02jun.2024 11:58:53.287] [main/WARN] [mixin/]: Injection warning: LVT in net/minecraft/client/gui/GuiGraphics::m_280497_(Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;)V has incompatible changes at opcode 346 in callback relics.mixins.json:GuiGraphicsMixin->@Inject::onTooltipRender(Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;Lnet/minecraftforge/client/event/RenderTooltipEvent$Pre;IIIILorg/joml/Vector2ic;)V.  Expected: [Lnet/minecraftforge/client/event/RenderTooltipEvent$Pre;, I, I, I, I, Lorg/joml/Vector2ic;]     Found: [Ljava/lang/Object;, I, I, I, I, Lorg/joml/Vector2ic;] Available: [Ljava/lang/Object;, I, I, I, I, Lorg/joml/Vector2ic;, I, I, I, Lnet/minecraft/client/gui/Font;, I, I, Lnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent;]
    • I have tried what you have said and it has worked, thank you for your help!
  • Topics

×
×
  • Create New...

Important Information

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