Jump to content

Recommended Posts

Posted (edited)

Hello! I'm having an issue with custom tripwire variant models not loading.

Here is my fml-log:

  Reveal hidden contents

My custom tripwire class:

  Reveal hidden contents

My Init and Registry Class:

  Reveal hidden contents

My Blockstate file:

  Reveal hidden contents

My project file tree:

  Reveal hidden contents

Thanks in advance!

Edited by DiscardedMarrow
Topic Solved
Posted (edited)

veganism:hemp_tripwire#attached=false,disarmed=true,east=false,north=true,powered=false,south=false,west=true for blockstate "veganism:hemp_tripwire[attached=false,disarmed=true,east=false,north=true,powered=false,south=false,west=true]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model veganism:hemp_tripwire#attached=false,disarmed=true,east=false,north=true,powered=false,south=false,west=true with loader VariantLoader.INSTANCE, skipping

 

Your block has a "disarmed" property but your blockstate file lacks it.

 

Also, you might be interested in using the Forge Blockstate format

http://mcforge.readthedocs.io/en/latest/blockstates/forgeBlockstates/

Which doesn't require you to fully specify every possible combination of states.

For example I have a block with three properties:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/resources/assets/harderfarming/blockstates/tanner.json#L17

The facing indicates the rotation, the other two properties specify a submodel (although they could specify anything other than rotation). Forge then automatically combines these.

Edited by Draco18s

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.

Posted

I see the issue, but this just makes me raise the question: how does vanilla deal with this, since the blockstate I'm using is basically a rip of the vanilla tripwire blockstate and my custom tripwire class extends the vanilla tripwire.. I think I need to know that before I do as you recommend and use the forge blockstates. Do you have any thoughts?

 

 

Posted

The tripwire probably has a non-default IStateMapper.

 

For example, this block:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/flowers/block/BlockOreFlower1.java#L114

Has 3 properties.

But you'll notice that one of them is distinctly missing from my blockstate file:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/resources/assets/oreflowers/blockstates/oreflowers1.json

That's because this class handles it:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/flowers/states/StateMapperFlowers.java

 

In my case, the property splits across two blockstate files, but other options are available as well (such as outright ignoring it). You'll have to dig around for the one Vanilla uses for the tripwire.

 

You then call ModelLoader.setCustomStateMapper(block, mapper); to register it.

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.

Posted

This sounds like a pretty good solution! I looked around for the IStateMapper for tripwire for a while but I couldn't find it, gonna search again tomorrow. In the meantime, I though "hm maybe finding the file where vanilla executes all it's modelresource registries will give me some insight", but of course I couldn't find that either. Anyway, I'm going to try creating a custom IStateMapper for it tomorrow and we'll see how far it gets me. I'll reply then with results, thanks for the help so far!

Posted

Problem solved!

Found MinecraftByExample by TheGreyGhost, went to this class and found a comment at line 38 which said:

// NB If your block has multiple variants and you want vanilla to load a model for each variant, you don't need a
//   custom state mapper.
// You can see examples of vanilla custom state mappers in BlockModelShapes.registerAllBlocks()

 

Checked out the BlockModelShapes file at net/minecraft/client/renderer and found all the vanilla custom statemappers.

Used this code to register my own custom statemappers:

public static void createStatemappers() {
		ModelLoader.setCustomStateMapper(hemp_tripwire, (new StateMap.Builder().ignore(BlockHempTripWire.DISARMED, BlockHempTripWire.POWERED)).build());
		ModelLoader.setCustomStateMapper(hemp_crop, (new StateMap.Builder().ignore(BlockHemp.AGE)).build());
	}

 

Called everything through serverproxy.

 

Thanks for the help, sorry it took me a while to get a result! Really appreciate the code samples you submitted!

Posted
  On 8/27/2017 at 5:52 PM, DiscardedMarrow said:

Called everything through serverproxy.

Expand  

IStateMapper is @SideOnly(Side.CLIENT)

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

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