Jump to content

Recommended Posts

Posted

I want to use the TileEntityItemStackRenderer for my weapons to use java models etc so I decided to go through the Forge docs. I'm confused a bit by it because I tried to follow it but I can't understand few things:

 

1) Is my implementation correct? (Atleast a bit?)

2) Do I need to implement the baked model on the item as I do or different way?

3) From my understanding I don't need anything else than setTileEntityItemStackRenderer, isBuiltinRenderer and getOverrides methods?

 

There is what I have tried for now:

  Reveal hidden contents

 

Also I decided to use the vanilla shield model for it now since I don't have the model yet. The TEISR class is copied from vanilla.

The code doesn't crash or anything like that, it doesn't do anything at all. Maybe that's because the ItemOverrideList is null. 

Posted
  On 11/3/2018 at 7:29 PM, Toma™ said:

public class PistolP92 extends GunBase implements IBakedModel

Expand  

Why is your Item an instance of IBakedModel? That makes no sense. First of all IBakedModel is client-only while items are common, this will crash the server. Second of all items are not models.

 

  On 11/3/2018 at 7:29 PM, Toma™ said:

public ItemOverrideList getOverrides() { return null; }

Expand  

You can't return null here, you need to return ItemOverrideList.NONE.

 

  On 11/3/2018 at 7:29 PM, Toma™ said:

@Override public TextureAtlasSprite getParticleTexture() { return null; }

Expand  

You can't return null here, you need to return a particle texture of some kind. At least a TextureMap#getMissingSprite.

 

  On 11/3/2018 at 7:29 PM, Toma™ said:

@Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { return null; }

Expand  

You can't return null here, return a Collections.EMPTY_LIST.

 

  On 11/3/2018 at 7:29 PM, Toma™ said:

@Override public void setTileEntityItemStackRenderer(TileEntityItemStackRenderer teisr) { teisr = new WeaponTeisr(); }

Expand  

Well, good job. For whatever reason you've overridden the setter for a TEISR. It used to set the TEISR of the item to the one passed as it's parameter. Now it sets the local teisr variable to a new WeaponTeisr. Which gets discarded immediately because that's not how java works. And even if it somehow worked this way you are not even calling this method from anywhere.

 

And you have also provided no code responsible for registering the item's model. You need to do that too.

Posted

Okay so I have reworked it a bit the teisr is now at the item, however nothing is rendering except my normal item model.

I'm pretty sure that is because the ItemOverrideList is empty. I created my own model class which extends the Shield model and implements the baked model. I'm new to all this stuff so I might be making some terrible mistake somewhere... 

 

So there's the updated code:

The item class:

  Reveal hidden contents

 

The model class:

  Reveal hidden contents

 

And also you wanted the registry code (I don't know if I need to rewrite it, but most likely I will have to since a lot of the code is old and I was following some registry tutorials for this)

  Reveal hidden contents

 

Posted
  On 11/3/2018 at 9:01 PM, Toma™ said:

public class ModelP92 extends ModelShield implements IBakedModel

Expand  

This makes no sense. ModelShield is a BipedModel which has nothing to do with baked models. You don't even need to extend ModelShield here at all.

 

  On 11/3/2018 at 9:01 PM, Toma™ said:

I'm pretty sure that is because the ItemOverrideList is empty.

Expand  

First of all the ItemOverrideList has nothing to do with a TEISR. Second of all most models have empty ItemOverrideLists and work just fine.

 

  On 11/3/2018 at 9:01 PM, Toma™ said:

this.setTileEntityItemStackRenderer(new WeaponTeisr());

Expand  

You can't do this in the item's constructor because this method is client-side only. It will crash the server.

 

  On 11/3/2018 at 9:01 PM, Toma™ said:

also you wanted the registry code

Expand  

No I didn't. 

  On 11/3/2018 at 8:17 PM, V0idWa1k3r said:

you have also provided no code responsible for registering the item's model. You need to do that too.

Expand  

I told you that you need to register your IBakedModel as the item's new model using either a custom ICustomModelLoader implementation or a ModelBakeEvent. But now when I see your registry...

 

  On 11/3/2018 at 9:01 PM, Toma™ said:

event.getRegistry().registerAll(PMCItems.ITEMS.toArray(new Item[0]));

Expand  

Don't ever use static initializers. Instantinate your things directly in the registry event.

 

  On 11/3/2018 at 9:01 PM, Toma™ said:

if(item instanceof IModItem) { ((IModItem)item).registerModels(); }

Expand  

IHasModel is stupid and yes, this is a renamed IHasModel. All items need models, no exception and nothing about model registration requires access to private/protected data of the item. Register your models in the ModelRegistryEvent directly.

Posted

Okay, thanks for your time, I see I have lot of pretty stupid code here. 

One last question regarding setting the teisr. When or where am I supposed to set it? 

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



×
×
  • Create New...

Important Information

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