Jump to content

[1.10.2/1.9.4] Adding a sapling (texture only)


spazzmods

Recommended Posts

So, I have been collaborating on a mod for about a week now, and we are still working on simple resources. However, trying to add a textured sapling has been MURDERING our brains.

 

A.) The sapling block is implemented and initialized.

B.)it has no texture

C.) we have no idea how to get the 'vanilla' sapling look. (where the textures cross eachother like all other plants)

 

Blockstate .json:

{
    "variants": {
        "normal": { "model": "glorious:shinySapling" }
    }
}

 

 

Models Block .json:

{
    "parent": "block/cross",
    "textures": {
        "cross": "glorious:blocks/shinySapling"
    }
}

BlockShinySapling.java

http://pastebin.com/Qag6dWZz

 

Link to comment
Share on other sites

Using

block/cross

as the model's parent should display the texture in a cross like vanilla saplings.

 

Post your FML log (logs/fml-client-latest.log), it should say exactly what went wrong with the model/texture loading.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

[06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=0,type=dark_oak for blockstate "glorious:BlockShinySapling[stage=0,type=dark_oak]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=0,type=dark_oak with loader VariantLoader.INSTANCE, skipping

...

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

 

...

 

[06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=1,type=spruce for blockstate "glorious:BlockShinySapling[stage=1,type=spruce]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=1,type=spruce with loader VariantLoader.INSTANCE, skipping

...

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

 

...

 

[06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=1,type=acacia for blockstate "glorious:BlockShinySapling[stage=1,type=acacia]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=1,type=acacia with loader VariantLoader.INSTANCE, skipping

...

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

 

...

 

[06:11:10] [Client thread/ERROR] [FML/]: Exception loading model for variant glorious:BlockShinySapling#stage=0,type=birch for blockstate "glorious:BlockShinySapling[stage=0,type=birch]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model glorious:BlockShinySapling#stage=0,type=birch with loader VariantLoader.INSTANCE, skipping

...

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

 

...

 

[06:11:10] [Client thread/ERROR] [FML/]: Suppressed additional 7 model loading errors for domain glorious

 

Your block has two properties (

stage

and

type

), neither of which you've specified in your blockstates file. If these properties don't affect the model, you can register an

IStateMapper

with

ModelLoader.setCustomStateMapper

. The easiest way to create an

IStateMapper

is to use

StateMap.Builder

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

So I'd have to create the IStateMapper in the class file for the sapling it's self?

to be completely honest I don't understand any of that. Or where it should/could go.

 

Register the

IStateMapper

in the same class where you register your item models during preInit. I'd recommend doing this in a dedicated client-only class.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

  • Create an instance of
    StateMap.Builder


  • Call
    StateMap.Builder#ignore

    to ignore the properties that don't affect your model

  • Call
    StateMap.Builder#build

    to create the

    IStateMapper


  • Call
    ModelLoader.setCustomStateMapper

    to register the

    IStateMapper

    for your

    Block

 

Side note: You should be using

ModelLoader.setCustomModelResourceLocation

/

setCustomMeshDefinition

in preInit rather than

ItemModelMesher#register

in init to register your item models.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

So, as a beginner modder, I'm a little lost based on your explanation. Where would I call the StateMap.Builder?

 

Also, what's the difference between using ModelLoader.setCustomModelResourceLocation/setCustomMeshDefinition and using Minecraft.getMinecraft().getRenderItem().getItemModelMesher() ?

 

If you can't answer this specifically then is there somewhere I can get detailed documentation on these things without just peering at the forge source? Preferably somewhere with an example as to how these are used. It makes no difference to me if it's a video or written document as long as it's up to date with Minecraft 1.10.2. A lot of documentation seems to be out of date and a lot of things I have tried have failed due to changes in forge since the time of the written documentation being written.

 

Thanks for the help!

Link to comment
Share on other sites

If you haven't already, create a dedicated client-only class to register your block and item models.

 

In a method of this class called from your client proxy in preInit, create and register the

IStateMapper

.

 

ModelLoader.setCustomModelResourceLocation

will call

ModelBakery.registerItemVariants

for you (the corresponding

ItemModelMesher#register

overload doesn't), telling Minecraft to load the model. There's not really any difference between

ModelLoader.setCustomMeshDefinition

and the corresponding

ItemModelMesher#register

overload, but I'd still recommend using the Forge method rather than the vanilla one.

 

There's no documentation on this that I know of.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Okay, so I put the ModelLoader.setCustomStateMapper inside our ClientProxy. The issue I have is that we don't have more than one type of tree, and so I haven't created a "EnumType" for our wood.

 

...withName(BlockShinySapling.Type).withSuffix(_sapling).build();

 

This part is what I'm struggling with understanding what to do with. I can go in and create an enum for the wood type, but it seems like there would be a simpler way of doing this for only one wood type.

 

Also, should I also be using the ModelLoader for all of our other blocks that are just the decorative ones with no special rendering? I have yet to figure out how to do that just by reading BlockModelShapes.class and ModelLoader.class. This is honestly probably going to be something with a very simplistic answer and it's just going over my head.

Link to comment
Share on other sites

I didn't say anything about the

withName

or

withSuffix

methods, they're not needed in this case.

 

Only use

ModelLoader.setCustomStateMapper

when you need a custom

IStateMapper

for a

Block

.

 

Use

ModelLoader.setCustomModelResourceLocation

/

setCustomMeshDefinition

to register the model(s) for every

Item

(including

ItemBlock

s).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Sorry, I should have specified a bit more. Where do I get an IStateMapper from? I tried looking around but I can't seem to find where I create one.

public static Builder build;
build.build()

Above returns a StateMapper and I'm not sure how to get a StateMapper into an IStateMapper.

Link to comment
Share on other sites

Don't store the

StateMap.Builder

in a field, it's only a temporary object. You must actually create an instance of

StateMap.Builder

.

 

StateMap

implements

IStateMapper

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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

    • I have done this now but have got the error:   'food(net.minecraft.world.food.FoodProperties)' in 'net.minecraft.world.item.Item.Properties' cannot be applied to                '(net.minecraftforge.registries.RegistryObject<net.minecraft.world.item.Item>)' public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register( "lemon_juice", () -> new Item( new HoneyBottleItem.Properties().stacksTo(1).food( (new FoodProperties.Builder()) .nutrition(3) .saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.01f ) .build() ) )); The code above is from the ModFoods class, the one below from the ModItems class. public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModFoods.LEMON_JUICE)));   I shall keep going between them to try and figure out the cause. I am sorry if this is too much for you to help with, though I thank you greatly for your patience and all the effort you have put in to help me.
    • I have been following these exact tutorials for quite a while, I must agree that they are amazing and easy to follow. I have registered the item in the ModFoods class, I tried to do it in ModItems (Where all the items should be registered) but got errors, I think I may need to revert this and figure it out from there. Once again, thank you for your help! 👍 Just looking back, I have noticed in your code you added ITEMS.register, which I am guessing means that they are being registered in ModFoods, I shall go through the process of trial and error to figure this out.
    • ♈+2349027025197ஜ Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join a brotherhood for protection and wealth here’s is your opportunity, but you should know there’s no ritual without repercussions but with the right guidance and support from this great temple your destiny is certain to be changed for the better and equally protected depending if you’re destined for greatness Call now for enquiry +2349027025197☎+2349027025197₩™ I want to join ILLUMINATI occult without human sacrificeGREATORLDRADO BROTHERHOOD OCCULT , Is The Club of the Riches and Famous; is the world oldest and largest fraternity made up of 3 Millions Members. We are one Family under one father who is the Supreme Being. In Greatorldrado BROTHERHOOD we believe that we were born in paradise and no member should struggle in this world. Hence all our new members are given Money Rewards once they join in order to upgrade their lifestyle.; interested viewers should contact us; on. +2349027025197 ۝ஐℰ+2349027025197 ₩Greatorldrado BROTHERHOOD OCCULT IS A SACRED FRATERNITY WITH A GRAND LODGE TEMPLE SITUATED IN G.R.A PHASE 1 PORT HARCOURT NIGERIA, OUR NUMBER ONE OBLIGATION IS TO MAKE EVERY INITIATE MEMBER HERE RICH AND FAMOUS IN OTHER RISE THE POWERS OF GUARDIANS OF AGE+. +2349027025197   SEARCHING ON HOW TO JOIN THE Greatorldrado BROTHERHOOD MONEY RITUAL OCCULT IS NOT THE PROBLEM BUT MAKE SURE YOU'VE THOUGHT ABOUT IT VERY WELL BEFORE REACHING US HERE BECAUSE NOT EVERYONE HAS THE HEART TO DO WHAT IT TAKES TO BECOME ONE OF US HERE, BUT IF YOU THINK YOU'RE SERIOUS MINDED AND READY TO RUN THE SPIRITUAL RACE OF LIFE IN OTHER TO ACQUIRE ALL YOU NEED HERE ON EARTH CONTACT SPIRITUAL GRANDMASTER NOW FOR INQUIRY +2349027025197   +2349027025197 Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join
    • Hi, I'm trying to use datagen to create json files in my own mod. This is my ModRecipeProvider class. public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder { public ModRecipeProvider(PackOutput pOutput) { super(pOutput); } @Override protected void buildRecipes(Consumer<FinishedRecipe> pWriter) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', ModItems.COMPRESSED_DIAMOND.get()) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get(),9) .requires(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .unlockedBy(getHasName(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()), has(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get())) .save(pWriter); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', Blocks.DIAMOND_BLOCK) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); } } When I try to run the runData client, it shows an error:  Caused by: java.lang.IllegalStateException: Duplicate recipe compressed:compressed_diamond I know that it's caused by the fact that there are two recipes for the ModItems.COMPRESSED_DIAMOND. But I need both of these recipes, because I need a way to craft ModItems.COMPRESSED_DIAMOND_BLOCK and restore 9 diamond blocks from ModItems.COMPRESSED_DIAMOND. Is there a way to solve this?
  • Topics

×
×
  • Create New...

Important Information

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