Jump to content

Recommended Posts

Posted

So i have this code for my crop base

package com.robmart.MoreMinecraft.block;

import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class Crops extends BlockCrops{

    @SideOnly(Side.CLIENT)
    public EnumWorldBlockLayer getBlockLayer()
    {
        return EnumWorldBlockLayer.CUTOUT;
    }

    public boolean isFullCube()
    {
        return false;
    }

    public boolean isOpaqueCube()
    {
        return false;
    }

    @Override
    protected boolean canPlaceBlockOn(Block ground)
    {
        return ground == Blocks.farmland;
    }

    public Crops()
    {
        this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)));
        this.setTickRandomly(true);
        float f = 0.5F;
        this.setCreativeTab((CreativeTabs)null);
        this.setHardness(0.0F);
        this.setStepSound(soundTypeGrass);
        this.disableStats();
    }

    public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
    {
        return EnumPlantType.Plains;
    }
}

 

And this code for the crop itself

package com.robmart.MoreMinecraft.block;

import com.robmart.MoreMinecraft.init.InitItem;
import com.robmart.MoreMinecraft.reference.Reference;
import net.minecraft.init.Items;
import net.minecraft.item.Item;

public class BlockStrawberriesCrop extends Crops{
    private static String name = "StrawberriesCrop";

    public BlockStrawberriesCrop(){
        this.setUnlocalizedName(Reference.MOD_ID.toLowerCase() + ":" + name);
    }
    
    @Override
    protected Item getSeed()
    {
        //return InitItem.StrawberrySeed;
        return Items.wheat_seeds;
    }

    @Override
    protected Item getCrop()
    {
        return InitItem.Strawberry;
    }

    public  static  String getName(){
        return name;

    }
}

 

And this code for my blockstates

{
    "variants": {
        "age=0": { "model": "moreminecraft:strawberries_stage_0" },
        "age=1": { "model": "moreminecraft:strawberries_stage_1" },
        "age=2": { "model": "moreminecraft:strawberries_stage_2" },
        "age=3": { "model": "moreminecraft:strawberries_stage_3" },
        "age=4": { "model": "moreminecraft:strawberries_stage_4" },
        "age=5": { "model": "moreminecraft:strawberries_stage_5" },
        "age=6": { "model": "moreminecraft:strawberries_stage_6" },
        "age=7": { "model": "moreminecraft:strawberries_stage_7" }
    }
}

 

And I´m getting this error

[19:14:09] [Client thread/WARN]: Unable to load definition moreminecraft:StrawberryCrop#age=1
java.lang.RuntimeException: Encountered an exception when loading model definition of model moreminecraft:blockstates/StrawberryCrop.json
at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:177) ~[ModelBakery.class:?]
at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:118) [ModelBakery.class:?]
at net.minecraft.client.resources.model.ModelBakery.func_177577_b(ModelBakery.java:98) [ModelBakery.class:?]
at net.minecraft.client.resources.model.ModelBakery.setupModelRegistry(ModelBakery.java:88) [ModelBakery.class:?]
at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:766) [Minecraft.class:?]
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:306) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:520) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:355) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) [idea_rt.jar:?]
Caused by: java.io.FileNotFoundException: moreminecraft:blockstates/StrawberryCrop.json
at net.minecraft.client.resources.FallbackResourceManager.getAllResources(FallbackResourceManager.java:99) ~[FallbackResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.getAllResources(SimpleReloadableResourceManager.java:81) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:152) ~[ModelBakery.class:?]
... 24 more

 

And other errors like that one for age 1-7. What do i do?

Posted

Hi

 

You probably haven't registered your variants properly or there is a subtle mismatch between the name of your files

 

You might find this link useful

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

(see the Block Rendering topics)

 

also this example project which has a working example of variants (example 3)

https://github.com/TheGreyGhost/MinecraftByExample

 

(Edit: brainfade suggestion removed - sorry)

 

You could try searching the vanilla code for the text message "Unable to load definition ", putting a breakpoint there, and inspecting the name and the registry to see what has been registered compared with what the code expects to find.

 

-TGG

 

Posted

Hi

 

You probably haven't registered your variants properly or there is a subtle mismatch between the name of your files

 

You might find this link useful

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

(see the Block Rendering topics)

 

also this example project which has a working example of variants (example 3)

https://github.com/TheGreyGhost/MinecraftByExample

 

(Edit: brainfade suggestion removed - sorry)

 

You could try searching the vanilla code for the text message "Unable to load definition ", putting a breakpoint there, and inspecting the name and the registry to see what has been registered compared with what the code expects to find.

 

-TGG

 

So i did this

        ModelBakery.addVariantName(
                GameRegistry.findItem
                        ("MoreMinecraft",
                        "strawberries_stage"),
                "moreminecraft:strawberries_stage_0");

and i get a nullpointer at the first line... Help?

Posted

Is ModelBakery a defined variable?

(Not declared, defined)

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

show your class(es) where you create your items & blocks and register them?

 

-TGG

 

package com.robmart.MoreMinecraft.init;

import com.robmart.MoreMinecraft.handler.ConfigurationHandler;
import com.robmart.MoreMinecraft.items.*;
import com.robmart.MoreMinecraft.reference.Reference;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraftforge.fml.common.registry.GameRegistry;

@GameRegistry.ObjectHolder(Reference.MOD_ID)
public class InitItem {

    public static final Item Ruby = new ItemRuby();
    public static final Item Flour = new ItemFlour();
    public static final Item Salt = new ItemSalt();
    public static final ItemFood Strawberry = new ItemStrawberry(1, 2F);
    //public static final ItemSeed StrawberrySeed = new ItemStrawberrySeed();
    public static final ItemFood Blueberry = new ItemBlueberry(1, 2F);
    //public static final ItemSeed BlueberrySeed = new ItemBlueberrySeed();
    public static final Item Vanilla = new ItemVanilla();
    //public static final ItemSeed VanillaSeed = new ItemVanillaSeed();
    public static final Item VanillaPowder = new ItemVanillaPowder();
    public static final ItemFood IceCreamCone = new ItemIceCreamCone(2, 4F);
    public static final ItemFood TastyCreamVanilla = new ItemTastyCreamVanilla(2, 4F, "Vanilla Edition");
    public static final ItemFood IceCreamVanilla = new ItemIceCreamVanilla(8, 12F, "Vanilla Edition");

    public static void Init()
    {
        GameRegistry.registerItem(Ruby, "Ruby");

        if(ConfigurationHandler.farmer) {
            GameRegistry.registerItem(Flour, "Flour");
            GameRegistry.registerItem(Salt, "Salt");
            GameRegistry.registerItem(Strawberry, "Strawberry");
            //GameRegistry.registerItem(StrawberrySeed, "StrawberrySeed");
            GameRegistry.registerItem(Blueberry, "Blueberry");
            //GameRegistry.registerItem(BlueberrySeed, "BlueberrySeed");
            GameRegistry.registerItem(Vanilla, "Vanilla");
            //GameRegistry.registerItem(VanillaSeed, "VanillaSeed");
            GameRegistry.registerItem(IceCreamCone, "IceCreamCone");
            GameRegistry.registerItem(VanillaPowder, "VanillaPowder");
            GameRegistry.registerItem(TastyCreamVanilla, "TastyCreamVanilla");
            GameRegistry.registerItem(IceCreamVanilla, "IceCreamVanilla");
        }
    }
}

that is items

 

package com.robmart.MoreMinecraft.init;

import com.robmart.MoreMinecraft.block.*;
import com.robmart.MoreMinecraft.handler.ConfigurationHandler;
import com.robmart.MoreMinecraft.reference.Reference;
import net.minecraft.block.Block;
import net.minecraftforge.fml.common.registry.GameRegistry;

@GameRegistry.ObjectHolder(Reference.MOD_ID)
public class InitBlock
{
    public static final Block RubyOre = new BlockRubyOre();
    public static final Block RubyBlock = new BlockRubyBlock();
    public static final Block SaltOre = new BlockSaltOre();
    public static final Crops StrawberryCrop = new BlockStrawberriesCrop();
    //public static final BlockCrops BlueberryCrop = new BlockBlueberryCrop();
    //public static final BlockCrops VanillaCrop = new BlockVanillaCrop();

    public static void Init()
    {
        GameRegistry.registerBlock(RubyOre, "RubyOre");
        GameRegistry.registerBlock(RubyBlock, "RubyBlock");

        if(ConfigurationHandler.farmer) {
            GameRegistry.registerBlock(SaltOre, "SaltOre");
            GameRegistry.registerBlock(StrawberryCrop, "StrawberryCrop");
            //GameRegistry.registerBlock(BlueberryCrop, "BlueberryCrop");
            //GameRegistry.registerBlock(VanillaCrop, "VanillaCrop");
        }
    }
}

this is blocks

Posted

Uh huh.

 

And neither one of those code snippets is a class named "ModelBakery" nor a class that contains a field called ModelBakery.  Or even a reference to the other two.

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

Uh huh.

 

And neither one of those code snippets is a class named "ModelBakery" nor a class that contains a field called ModelBakery.  Or even a reference to the other two.

Modelbakery is a minecraft class -_-

Posted

Hi

 

Are you using Intellij 14 perhaps?

If so, see here about sourceSets

http://www.minecraftforge.net/forum/index.php/topic,21354.0.html

 

 

Otherwise, your file StrawberryCrop.json either doesn't exist or is in the wrong folder.

The folder structure should look like this

src/main/resources/assets/moreminecraft/blockstates

 

I also suggest you use lower case for all your filenames, it will probably save you pain later on.

 

-TGG

 

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

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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