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 guys,

I come up with an idea that i can render additional models within the IPerspectiveModelAware handlePerspective method.

 

It does work, i can render both models, rotate them independetly and such.

Just that when i bind the texture to the additional model, it also binds the texture to the JSON model.

@Override
public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
	switch(cameraTransformType){
	case FIRST_PERSON:
		this.customModel();
		RenderItem.applyVanillaTransform(BaseModel.getItemCameraTransforms().firstPerson);
                        //Rebind texture with BaseModel.getTexture somehow??
		return Pair.of(BaseModel,  null);
}

public void customModel(){
	Minecraft mc = Minecraft.getMinecraft();

	GlStateManager.pushMatrix();
	GlStateManager.rotate(20F, 0F, 1F, 0F);
	GlStateManager.rotate(-80F, 0F, 0F, 1F);
	GlStateManager.translate(-0.15F, -0.82F, 0F);
	GlStateManager.scale(0.9F, 1.3F, 0.9F);

//TEXTURE BIND TO CUSTOM MODEL
mc.getTextureManager().bindTexture(mc.getMinecraft().thePlayer.getLocationSkin());
	//RENDER CUSTOM MODEL(hidden)
	GlStateManager.popMatrix();
}

 

So how can i bind the texture only to the custom model, or how can i rebind the texture to the json model?

Since my model has multiple textures i cannot use bindTexture because only the last texture applies.

  • Author

I have to use GL, because the system is horribly s*it.

 

If i use a merged model, where i merge it to the base model, i cannot do independent transform, and i cannot use the player.getLocotionSkin on it.

 

If i use RenderHandEvent, all the additional models arent jammed to the player view, and its just too much of a hassle to get all those private fields. And no, itemRenderer.renderItem(), not works coz i want to render something else.

 

This method below works and i dont want to bind the texture to the IBakedModel.

The other model isnt an IBakedModel, its the players arm.

I made the first kinda working first person arm for 1.8, and this little thing is in the way

 

So if you can help, how can i bind a texture to a certain model only?

Like:

bindTexture;

renderModel;

stopBindTexture;

Do NOT make GL calls inside the model code... If you are using an IBakedModel it must use a texture that is on the big texture sheet.

 

GL calls and bind texture are two different things. I have used GL in model code, never hurt it one bit. Forge makes GL calls when handlePerspective() is called getting the Pair matrix that should be added to the GL state before rendering.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

Yeah, i just only need help to rebind the texture to the model, with the TextureAtlasSprite getTexture() method.

  • Author

Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);

 

I put this after the custom model renderer and it rebinded the model texture.

Problem sloved.

This sounds like a horrible idea, but oh well. You are a modder, modders always do stupid shit apparently.

 

If it fixes the problem and doesn't effect performance, aesthetics (in a bad way), and / or doesn't disrupt the rendering process in any way (GL calls can be made in model code), why is that stupid xD? It works. Effectively. This is modders working with the new rendering system.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

How would you do this without IItemRenderer? I doubt this will change...handlePerspective is called to get the matrix that should be added to the GL state for the model returned in the pair.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

You may be on to something. What about independent translation / rotation for the arm? 3 pixel or 4 pixel arm support?

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Yes, the arm is an aesthetic of realism added when holding an item. The arm needs independent transforms to be positioned properly.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Which means the current system doesn't support it. Maybe in the future it will.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

diesieben look, i can tell you how you cant achieve this without my method.

 

ISmartItemModel:

1.BaseModel and Arm model is merged together and renders correctly.

2.You cannot set independent transform.

3.You cannot use player.getLocotionSkin() to bind the player arm skin to the json model. You cannot pull the .png out nowhere.

 

The Arm is actually part of the BaseModel:

1.You still cannot bind the player skin to the arm dynamically.

 

RednerHandEvent:

1.You render the arm moder with a method inside RenderPlayer.

2.You can bind the texture to it.

3.You can set independent transform to it.

4.You CANNOT jam it to the item model. There is too much private method you need to reflect or copy.

So its not efficent.

 

My method(IPersPectiveModelAware):

1.You can render the arm with the RenderPlayer method, only in first person.

2.You can bind the player skin to it.

3.You can do independent transform.

4.I didnt notice any FPS drop.

 

So in conclusion, this is the only way to do first person arm rendering now.

I tried everything and this is the simplest way.

Not only you can render the player first person arm, you can do many more what ISmartItemModel cant or it can but its way over complicated.

 

 

 

  • Author

Okay, mayebe in 1.9 it will break.

But it works in 1.8, so why the hell not.

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.