Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

TheA13X

Members
  • Content Count

    30
  • Joined

  • Last visited

Posts posted by TheA13X

  1. 12 hours ago, XFactHD said:

    [...] registry events are fired before the FMLPreInitializationEvent.

    No. No they are not.

     

    I Debugged Forge's building process line by line, so I know that the all registry events are fired after the FMLPreInitializationEvent.

    Also if the Registry Events were fired before the lists are populated, there would be no exception in the first place.

  2. Hi there!

     

    I'm currently updating one of my mods to 1.12 (and 1.12.2). While doing that I ran into this exception:

    Quote

    ---- Minecraft Crash Report ----
    // But it works on my machine. Oh wait, no it doesn't :(

    Time: 11/29/17 1:30 PM
    Description: Initializing game

    java.lang.NullPointerException: Initializing game
        at net.minecraft.client.util.SearchTree.lambda$index$0(SearchTree.java:91)
        at java.util.Collections$SingletonSet.forEach(Collections.java:4767)
        at net.minecraft.client.util.SearchTree.index(SearchTree.java:89)
        at net.minecraft.client.util.SearchTree.add(SearchTree.java:78)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at net.minecraft.client.Minecraft.populateSearchTreeManager(Minecraft.java:634)
        at net.minecraft.client.Minecraft.init(Minecraft.java:570)
        at net.minecraft.client.Minecraft.run(Minecraft.java:416)
        at net.minecraft.client.main.Main.main(Main.java:118)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
        at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
        at GradleStart.main(GradleStart.java:26)

     

    Here's what I found out so far:

     

    The exception is caused, because the Lambda Functions, given to the Search Tree as an argument, returned null:

    //Citing Minecraft.java
    /*618*/SearchTree<ItemStack> searchtree = new SearchTree<ItemStack>(
    /*   */(p_193988_0_) ->
    /*619*/{
    /*620*/  return (List)p_193988_0_.getTooltip((EntityPlayer)null, ITooltipFlag.TooltipFlags.NORMAL).stream().map(TextFormatting::getTextWithoutFormattingCodes).map(String::trim).filter((p_193984_0_) -> {
    /*621*/    return !p_193984_0_.isEmpty();
    /*622*/  }).collect(Collectors.toList());
    /*623*/}, 
    /*    */(p_193985_0_) ->
    /*624*/{
    /*625*/  return Collections.singleton(Item.REGISTRY.getNameForObject(p_193985_0_.getItem()));
    /*626*/});

    -> Item.REGISTRY.getNameForObject(ItemStack.getItem) returned null.

    The question that remains is, why?

    It must have something to do with the registration process. Therefore I have to tell you

    How the Registration works:

    1.Loading

    When the FMLPreInitializationEvent is fired, all blocks/"pure" Items get constructed and loaded into static lists located in my ModBlocks/ModItems class

     

    2. Registering

    On the Register<Item>-Event the following code is executed:

    //Citing Registrator.java
    /*17*/@SubscribeEvent
    /*18*/public static void registerItems(RegistryEvent.Register<Item> event){
    /*19*/  event.getRegistry().register(ModItems.parcelInstance()); //Register the only "pure" Item in this Mod. Does not throw the NullPointerException in the Search Tree
    /*20*/  ModBlocks.registerAllItems(event.getRegistry());//Register all the Block Items in this Mod
    }

    RegisterAllItems:

    public static void registerAllItems(IForgeRegistry<Item> reg)
    {
      	registerAllLogItems(reg);
      	registerAllLeavesItems(reg);
      	registerAllSaplingItems(reg);
      	registerAllWoodItems(reg);
      	registerAllStairsItems(reg);
      	registerAllDoorItems(reg);
      	registerAllSingleSlabItems(reg);
    }

    Example for a Registering function:

    //Citing ModBlocks.java
    /*208*/private static void registerAllLogItems(IForgeRegistry<Item> reg) //It crashed on the Log Block Item btw.
    /*209*/{
    /*210*/  int logCount = 0;
    /*211*/  for (final LogBlock block : logBlocks)//for every Log Block...
    /*212*/  {
    /*213*/    String name = String.format("log%d", logCount);//...define registry name...
    /*214*/    ImmutableList<String> subblockNames = block.getSubBlockNames();//...get all the Subblock names... 
    /*215*/    if(block instanceof  ModLogBlock){//... if type 1...
    /*216*/      reg.register(new ModLogItem(block,(ModLogBlock)block,subblockNames.toArray(new String[subblockNames.size()])).setRegistryName(name));//...register Item using the Type 1 item constructor after setting the registry name  
    /*217*/    }
    /*218*/    else if(block instanceof  ModLog2Block){//... if type 2...
    /*219*/      reg.register(new ModLogItem(block,(ModLog2Block)block,subblockNames.toArray(new String[subblockNames.size()])).setRegistryName(name));//...register Item using the Type 2 item constructor after setting the registry name  
    /*220*/    }
    /*221*/    else if(block instanceof  ModLog3Block){//... if type 3...
    /*222*/      reg.register(new ModLogItem(block,(ModLog3Block)block,subblockNames.toArray(new String[subblockNames.size()])).setRegistryName(name));//...register Item using the Type 3 item constructor after setting the registry name  
    /*223*/    }
    /*224*/    else{//... if type 4...
    /*225*/      reg.register(new ModLogItem(block,(ModLog4Block)block,subblockNames.toArray(new String[subblockNames.size()])).setRegistryName(name));//...register Item using the Type 4 item constructor after setting the registry name  
    /*226*/    }
    /*227*/    logCount++;
    /*228*/  }
    /*229*/}

    The Block registration works in the same way, only with on the Register<Block>-Event, instead of the item one.

    I guess it's also important

    How the Block Classes look like

    Essentially I have a mod (Koresample) containing all the "basic" block/item classes and my specialized Mod (Dendrology) containing Classes with logic for the specific tree types.

    Pasting all of them would be way to much so I'll just link my GitHub.

    Koresample

    Dendrology:

     

    I know it's a bit much, but this problem seems quite unusual...

    Thanks for trying and help me out. I got nothin'

     

  3. So there's an abstract function called getWoodtype which returns a BlockPlanks.EnumType and I wanted to return the enum type of my Mod's   Planks, but that's completely unnecessary. I extended the class and it works now (apart from a visual glich due to the transparency, but that's another story)

     

    Thanks

  4. 1 hour ago, diesieben07 said:

    Clearer or not, it's broken. You cannot have references to client-only classes (ModelLoader) in common code (your block class).

    Yes  I can. Sure it's a matter of trust since it could break if someone calls the function outside of a client-only class, but I'm the only author, so it won't happen.

     

    1 hour ago, diesieben07 said:

    And no, there is no randomTick method in either of the block classes you posted.

    It's in the part of the class I left out and replaced it with

     

    20 hours ago, TheA13X said:

    //Stuff cloned from BlockLeaves...

     

     

    2 hours ago, Jay Avery said:

    Why don't you just extend BlockLeaves if you want so much of the same functionality?

    I  don't even know anymore. Let me check this

  5. 13 hours ago, diesieben07 said:
    • Next, if you don't want your leaves to decay, why do you have two properties called CHECK_DECAY and DECAYABLE? Speaking of them, where are they even coming from? They certainly aren't defined in the code that you posted.

    You misunderstood me. They do NOT Decay, but I want them to. Also I just noticed I forgot to paste the properties in there. It's fixed now.

     

    13 hours ago, diesieben07 said:
    • First of all please remove all that unlocalized name dancing. You don't need it. You should not be getting the unlocalized name for anything. Even when displaying a block's name getLocalizedName should be used.
    • Also in this category: What is this getResourcePrefix thing? You don't need it.
    • Another thing I noticed, you are using Collections.unmodifiableList on an ImmutableList, this is pointless.
    • registerBlockModels should not be in your Block class. You must register models in your client proxy.

    I just updated 1.7.10 code from another author.

    I thought about recoding it completely to make it more uncomplicated, but this can wait.

    Also registerBlockModelsis called from the client proxy. It's just positioned in the block class to allow different behaviour for every single block.

    It's just clearer that way.

     

    13 hours ago, diesieben07 said:
    • Why are you calling setTickRandomly(true)? You are not overriding randomTick, so it's just wasting resources.

    Like the comments say I cloned MCs BlockLeaves Class and cut out the old functions, since they are the same, as the ones from the original.

    The randomTick function is there.

  6. Wow that was fast. Thanks man ^^

     

    Well, first we have the Superclass:

     

    public abstract class LeavesBlock extends Block implements net.minecraftforge.common.IShearable
    {
    	public static final int CAPACITY = 4;
        private static final int METADATA_MASK = CAPACITY - 1;
        int[] surroundings;
    
        private final ImmutableList<DefinesLeaves> subBlocks;
    
        protected LeavesBlock(Collection<? extends DefinesLeaves> subBlocks)
        {
            super(Material.LEAVES);
            checkArgument(!subBlocks.isEmpty());
            checkArgument(subBlocks.size() <= CAPACITY);
            this.subBlocks = ImmutableList.copyOf(subBlocks);
            this.setTickRandomly(true);
            this.setHardness(0.2F);
            this.setLightOpacity(1);
            this.setSoundType(SoundType.PLANT);
            setUnlocalizedName("leaves");
        }
    
        private static int mask(int metadata) {return metadata & METADATA_MASK;}
    
        protected static String getUnwrappedUnlocalizedName(String unlocalizedName)
        {
            return unlocalizedName.substring(unlocalizedName.indexOf('.') + 1);
        }
    
        protected final List<DefinesLeaves> subBlocks() { return Collections.unmodifiableList(subBlocks); }
    
        @Override
        public final Item getItemDropped(IBlockState state, Random unused, int unused2)
        {
            return Item.getItemFromBlock(subBlocks.get(mask(this.getMetaFromState(state))).saplingDefinition().saplingBlock());
        }
    
        @Override
        public int damageDropped(IBlockState state)
        {
            return subBlocks.get(mask(this.getMetaFromState(state))).saplingDefinition().saplingSubBlockVariant().ordinal();
        }
    
        public final String[] getSpeciesNames() //func_150125_e
            {
            final List<String> names = Lists.newArrayList();
            for (final DefinesLeaves subBlock : subBlocks)
                names.add(subBlock.speciesName());
            return names.toArray(new String[names.size()]);
        }
    
        public final String getUnlocalizedName()
        {
            return String.format("tile.%s%s", resourcePrefix(), getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
        }
    
        public final int getDamageValue(World world, BlockPos pos) { return this.getMetaFromState(world.getBlockState(pos)) & 3; }
    
        public final void getSubBlocks(Item item, CreativeTabs unused, List subBlocks)
        {
            for (int i = 0; i < this.subBlocks.size(); i++)
                subBlocks.add(new ItemStack(item, 1, i));
        }
    
        public void registerBlockModels()
        {
            for (DefinesLeaves define : subBlocks())
            {
                ModelResourceLocation typeLocation = new ModelResourceLocation(getRegistryName(),"check_decay=true,decayable=true,variant="+define.leavesSubBlockVariant().name().toLowerCase());
                Item blockItem = Item.getItemFromBlock(define.leavesBlock());
                ModelLoader.setCustomModelResourceLocation(blockItem,define.leavesSubBlockVariant().ordinal(),typeLocation);
            }
        }
    
        protected abstract String resourcePrefix();
    
    	//Stuff cloned from BlockLeaves...
    		public abstract Enum getWoodType(int meta);
    	//Stuff cloned from BlockLeaves...
    }

     

    And then several Mod Classes which only difference is the Enum used for getWoodType()

    Here is one of them

     

    public final class ModLeavesBlock extends LeavesBlock
    {
        public static final PropertyEnum VARIANT = PropertyEnum.create("variant", ModLogBlock.EnumType.class);
       
        public ModLeavesBlock(Iterable<? extends DefinesLeaves> subBlocks)
        {
            super(ImmutableList.copyOf(subBlocks));
            setCreativeTab(TheMod.INSTANCE.creativeTab());
            this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, ModLogBlock.EnumType.ACEMUS).withProperty(CHECK_DECAY, Boolean.TRUE).withProperty(DECAYABLE, Boolean.TRUE));
        }
    
        @Override
        public int quantityDropped(Random random)
        {
            final int rarity = Settings.INSTANCE.saplingDropRarity();
            return rarity == 0 || random.nextInt(rarity) != 0 ? 0 : 1;
        }
    
        @Override
        protected BlockStateContainer createBlockState(){
            BlockStateContainer bs = new BlockStateContainer(this, new IProperty[]{VARIANT,CHECK_DECAY,DECAYABLE});
    
            return bs;
        }
    
        @Override
        public ModLogBlock.EnumType getWoodType(int meta) {
           return ModLogBlock.EnumType.fromId(meta);
        }
    
        @Override
        protected String resourcePrefix() { return TheMod.getResourcePrefix(); }
    
        @Override
        public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
            ArrayList<ItemStack> list=new ArrayList<ItemStack>();
            list.add(new ItemStack(Item.getItemFromBlock(this),1,getMetaFromState(world.getBlockState(pos))));
            return list;
        }
    
        @Override
        public IBlockState getStateFromMeta(int meta) {
            IBlockState state = getDefaultState();
            switch(meta/4){
                case 0:
                    state = state.withProperty(CHECK_DECAY,true).withProperty(DECAYABLE,true);
                break;
                case 1:
                    state = state.withProperty(CHECK_DECAY,true).withProperty(DECAYABLE,false);
                break;
                case 2:
                    state = state.withProperty(CHECK_DECAY,false).withProperty(DECAYABLE,true);
                break;
                case 3:
                    state = state.withProperty(CHECK_DECAY,false).withProperty(DECAYABLE,false);
                break;
            }
            state = state.withProperty(VARIANT,ModLogBlock.EnumType.fromId(meta%4));
            return state;
        }
    
        @Override
        public int getMetaFromState(IBlockState state) {
            ModLogBlock.EnumType type = (ModLogBlock.EnumType) state.getValue(ModLogBlock.VARIANT);
            boolean check = (Boolean) state.getValue(CHECK_DECAY);
            boolean dcable = (Boolean) state.getValue(CHECK_DECAY);
            int par = check?dcable?0:1:dcable?2:3;
            return par*4+type.ordinal();
        }
    
        protected boolean needMask(){
            return false;
        }
    
        @Override
        public int damageDropped(IBlockState state) {
            return getMetaFromState(state.withProperty(CHECK_DECAY,true).withProperty(DECAYABLE,true));
        }
    
        @Override
        protected int getSaplingDropChance(IBlockState state)
        {
            return Settings.INSTANCE.saplingDropRarity();
        }
    }

     

  7. Hello world.

     

    I'm making a Tree Mod and it turns out, that my leaves won't decay.

    1.  When a tree get generated, all leaves are set with the standard block state (aka with decayable and check_decay set to true).
    2. After the generation most leaves have check_dekay set to false. Since this is also the case with vanilla leaves I guess that's normal though.
    3. When chopping down a tree (minecraft style) the leaves won't decay and after restarting the game the leaves have both decayable and check_decay set to false

     

    Things that may be important to notice, is that my Leaves are multitextured. The Blockstate also contains a variant variable.

     

    I also don't really know what code I should post here.

    Any Suggestions?

     

  8. Hello world.

    Another error I don't understand, but  may be easy to solve if knowing how forge works.

     

    When starting the mod on forge 2228 in IDE everything is fine, but if its loaded in the client I get

    There was a severe problem during mod loading that has caused the game to fail
    
    net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Ancient Trees (dendrology)
    Caused by: java.lang.NoSuchFieldError: CHESTS_VILLAGE_BLACKSMITH

     

    CHESTS_VILLAGE_BLACKSMITH is a static field from the LootTableList, which definitely does exist.

     

    Code where the error is thrown:

            final Map<ResourceLocation, Integer> map = Maps.newHashMap();
            map.put(CHESTS_VILLAGE_BLACKSMITH, 0);
            map.put(CHESTS_SPAWN_BONUS_CHEST, 0);
            map.put(CHESTS_DESERT_PYRAMID, 1);
            map.put(CHESTS_SIMPLE_DUNGEON, 1);
            map.put(CHESTS_JUNGLE_TEMPLE, 1);
            map.put(CHESTS_JUNGLE_TEMPLE_DISPENSER, 0);
            map.put(CHESTS_ABANDONED_MINESHAFT, 1);
            map.put(CHESTS_STRONGHOLD_CORRIDOR, 1);
            map.put(CHESTS_STRONGHOLD_CROSSING, 1);
            map.put(CHESTS_STRONGHOLD_LIBRARY, 1);
            map.put(CHESTS_END_CITY_TREASURE, 5);
            map.put(CHESTS_NETHER_BRIDGE, 5);
            map.put(CHESTS_IGLOO_CHEST, 1);
            return map;

     

    It seems that none of these Fields exist in client. If I remove CHESTS_VILLAGE_BLACKSMITH, I get the same error on CHESTS_SPAWN_BONUS_CHEST ...

    o.O

  9. Oops. I'm sorry for making you so much work. At least the outdated build.gradle and the obsolete ProvidesPotionEffect implementation could be avoided if I had a Git client I can handle.

    Thank you for the tips though. My code is pretty chaotic regarding the location of proxied functions, but I works. I never had a crash because of some non-server code.

     

    4 hours ago, Choonster said:

    SaplingParcel isn't going to work on the dedicated server because you've implemented the item spawning in your client proxy, which is only loaded on the physical client.

    Well that's interesting. I'll keep it in mind. See, I implemented the Item spawning on both the common and the client proxy. The common one just returns the Item, the client side adds a translation first. Maybe it isn't ought to be used this way, but it seemed to work.

  10. 3 minutes ago, Choonster said:

     

    I highly recommend using a proper Git client (e.g. the CLI, IDEA or GitKraken) instead of manually uploading files on the GitHub website. This will make it much easier to commit exactly the right changes and prevent you from creating commits with no changes.

    I know. That's what I normally do, I just had to do it this way, because the client told me that "everything is up to date"

  11. 9 hours ago, Choonster said:

     

    The 1.9 and master branches of dendrology-legacy-mod are still targeting 1.8.9.

     

    Oh yeah. Didn't notice, sorry.

    I fixed it now (for 1.9)

     

    9 hours ago, Choonster said:

    dendrology-legacy-mod depends on the KoreSample project, but you don't have a settings.gradle file to include the project

    Not in the git repository. I have a multi-project-workspace in IntelliJ, so the settings file is in the superdirectory.

    I'll add the KoreSample repository as a submodule after I figured out how, but you'll have to create the settings.gradle yourself.

     

    9 hours ago, Choonster said:

     

    Why did you create your own repositories from scratch instead of forking the original ones?

    I just didn't know it's possible back then.

  12. 1 hour ago, Choonster said:

    dendrology:blockstates/leaves3.json is a ResourceLocation, it corresponds to assets/dendrology/blockstates/leaves3.json on disk.

    Are you sure? It's a FileNotFoundException which usually contains the path used for an I/O operation which is usually the real path.

    Anyways. The assets folder is in src/main/resources like it should. It's also included in to the root folder of the mod's jar file. I've run the mod only over the IDE though and while the assets folder does exists in build/resources/main the IDE's output folder is build/classes/main. But it should work anyway right? I mean the assets is copied to the build folder.  

    Also I have a custom LanguageMapper who reads the lang files on pre-init and if the assets were missing, minecraft would crash here.

    if(test.getLocation().toString().startsWith("jar:"))
      fallback = Optional.of(new LangMap(TheMod.class.getResourceAsStream("/assets/dendrology/lang/en_US.lang")));
    else{
      String pathToCode = "../build/resources/main";
      File test2 = new File(pathToCode);
      fallback = Optional.of(new LangMap(new FileInputStream(pathToCode+"/assets/dendrology/lang/en_US.lang")));
    }

     

  13. All right. I finally managed to look in the console output and I found THIS

    [16:10:53] [Client thread/ERROR] [FML]: Exception loading model for variant dendrology:leaves3#check_decay=true,decayable=false,variant=cedrum for blockstate "dendrology:leaves3[check_decay=true,decayable=false,variant=cedrum]"
    net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model dendrology:leaves3#check_decay=true,decayable=false,variant=cedrum with loader VariantLoader.INSTANCE, skipping
    	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:134) ~[ModelLoaderRegistry.class:?]
    	at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:222) ~[ModelLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:145) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:210) ~[ModelLoader.class:?]
    	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:127) ~[ModelLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
    	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
    	at net.minecraft.client.Minecraft.startGame(Minecraft.java:538) [Minecraft.class:?]
    	at net.minecraft.client.Minecraft.run(Minecraft.java:384) [Minecraft.class:?]
    	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_111]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
    	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_111]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
    	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    	at GradleStart.main(GradleStart.java:26) [start/:?]
    Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
    	at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]
    	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1164) ~[ModelLoader$VariantLoader.class:?]
    	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:130) ~[ModelLoaderRegistry.class:?]
    	... 21 more
    [16:10:53] [Client thread/ERROR] [FML]: Exception loading blockstate for the variant dendrology:leaves3#check_decay=true,decayable=false,variant=cedrum: 
    java.lang.Exception: Could not load model definition for variant dendrology:leaves3
    	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:255) ~[ModelLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:121) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:210) ~[ModelLoader.class:?]
    	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:127) ~[ModelLoader.class:?]
    	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
    	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
    	at net.minecraft.client.Minecraft.startGame(Minecraft.java:538) [Minecraft.class:?]
    	at net.minecraft.client.Minecraft.run(Minecraft.java:384) [Minecraft.class:?]
    	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_111]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
    	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_111]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
    	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    	at GradleStart.main(GradleStart.java:26) [start/:?]
    Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of model dendrology:blockstates/leaves3.json
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:205) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:185) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:251) ~[ModelLoader.class:?]
    	... 20 more
    Caused by: java.io.FileNotFoundException: dendrology:blockstates/leaves3.json
    	at net.minecraft.client.resources.SimpleReloadableResourceManager.getAllResources(SimpleReloadableResourceManager.java:83) ~[SimpleReloadableResourceManager.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:198) ~[ModelBakery.class:?]
    	at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:185) ~[ModelBakery.class:?]
    	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:251) ~[ModelLoader.class:?]
    	... 20 more

    Notice the line "Caused by: java.io.FileNotFoundException: dendrology:blockstates/leaves3.json"

    This is true, since the path is "dendrology/blockstates/leaves3.json" 

    ...huh?

  14. Thank you for the help.

    I changed my code to:

    That's what I did:

     

    • registering block and blockitem (on preinit)
    private static void registerLeavesBlock(Block block, String name)
    {
    	block.setRegistryName(name);//value: UnlocalizedName<number>
    	GameRegistry.register(block);
    	GameRegistry.register(new ModLeavesItem(block).setRegistryName(block.getRegistryName()));
    	Blocks.FIRE.setFireInfo(block, DEFAULT_LEAVES_FIRE_ENCOURAGEMENT, DEFAULT_LEAVES_FLAMMABILITY);
    }
    • register block variants (using the Client Proxy and executed on init)
    public void registerBlockModels()
    {
    	for (DefinesLeaves define : subBlocks())
    	{
    		ModelResourceLocation typeLocation = new ModelResourceLocation(getRegistryName(),"check_decay=true,decayable=true,variant="+define.leavesSubBlockVariant().name().toLowerCase());
          	        //added all properties to the variant string. This is, how the key in the blockstate file looks like
    		//ModelResourceLocation typeItemLocation = new ModelResourceLocation(getRegistryName().toString().substring(0,getRegistryName().toString().length()-1)+"_"+define.leavesSubBlockVariant().name().toLowerCase(),"inventory");
    		Item blockItem = Item.getItemFromBlock(define.leavesBlock());
    		ModelLoader.setCustomModelResourceLocation(blockItem,define.leavesSubBlockVariant().ordinal(),typeLocation);
    	}
    }

     

    Unfortunately it still doesn't work as you can see in the attached images

     

    Regarding translation:

    • The Constructor
    //-------------------Superclass--------------------//
    protected LeavesBlock(Collection<? extends DefinesLeaves> subBlocks)
        {
            super(Material.LEAVES);
            checkArgument(!subBlocks.isEmpty());
            checkArgument(subBlocks.size() <= CAPACITY);
            this.subBlocks = ImmutableList.copyOf(subBlocks);
            this.setTickRandomly(true);
            this.setHardness(0.2F);
            this.setLightOpacity(1);
            this.setSoundType(SoundType.PLANT);
            setUnlocalizedName("leaves");
        }
    //------------------Subclass----------------------//
    public ModLeavesBlock(Iterable<? extends DefinesLeaves> subBlocks)
        {
            super(ImmutableList.copyOf(subBlocks));
            setCreativeTab(TheMod.INSTANCE.creativeTab());
            this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, ModLogBlock.EnumType.ACEMUS).withProperty(CHECK_DECAY, Boolean.TRUE).withProperty(DECAYABLE, Boolean.TRUE));
        }
    • The custom getUnlocalizedName() function:
    //-------------Block Class--------------------//
    public final String getUnlocalizedName()
        {
            return String.format("tile.%s%s", domainPrefix(), getUnwrappedUnlocalizedName(super.getUnlocalizedName()));//domainPrefix() = "dendrology:", super.getUnlocalizedName() = "tile.leaves"
            //getUnwrappedUnlocalizedName(...) gets only the last part of the Unlocalized name path 
        }
    //-------------Item Class-------------------//
    @Override
    public String getUnlocalizedName(ItemStack stack)
        {
            return super.getUnlocalizedName() + "." + ((LeavesBlock)block).getWoodType(stack.getMetadata()).name().toLowerCase();
        }

    The langfile is located in /assets/lang and looks like this:

    ##############################
    # Dendrology
    #
    # English - UNITED STATES (US) (en_US) localization
    # Author: Scott Killen
    #
    
    #Blocks
    
    ### Logs
    tile.dendrology:log.acemus.name=Acemus Wood
    tile.dendrology:log.cedrum.name=Cedrum Wood
    tile.dendrology:log.cerasu.name=Cerasu Wood
    tile.dendrology:log.delnas.name=Delnas Wood
    tile.dendrology:log.ewcaly.name=Ewcaly Wood
    tile.dendrology:log.hekur.name=Hekur Wood
    tile.dendrology:log.kiparis.name=Kiparis Wood
    tile.dendrology:log.kulist.name=Kulist Wood
    tile.dendrology:log.lata.name=Lata Wood
    tile.dendrology:log.nucis.name=Nucis Wood
    tile.dendrology:log.porffor.name=Porffor Wood
    tile.dendrology:log.salyx.name=Salyx Wood
    tile.dendrology:log.tuopa.name=Tuopa Wood
    
    ### Leaves
    tile.dendrology:leaves.acemus.name=Acemus Leaves
    tile.dendrology:leaves.cedrum.name=Cedrum Leaves
    tile.dendrology:leaves.cerasu.name=Cerasu Leaves
    tile.dendrology:leaves.delnas.name=Delnas Leaves
    tile.dendrology:leaves.ewcaly.name=Ewcaly Leaves
    tile.dendrology:leaves.hekur.name=Hekur Leaves
    tile.dendrology:leaves.kiparis.name=Kiparis Leaves
    tile.dendrology:leaves.kulist.name=Kulist Leaves
    tile.dendrology:leaves.lata.name=Lata Leaves
    tile.dendrology:leaves.nucis.name=Nucis Leaves
    tile.dendrology:leaves.porffor.name=Porffor Leaves
    tile.dendrology:leaves.salyx.name=Salyx Leaves
    tile.dendrology:leaves.tuopa.name=Tuopa Leaves
    
    #...
    
    # Creatibe Tabs
    itemGroup.dendrology=Ancient Trees
    #...
    
    # Config file comments
    #...
    
    # Items
    item.dendrology:parcel.name=Ancient Parcel
    dendrology:parcel.tooltip=What have the Ancients hidden within?
    
    # Parcel contents
    #...

     

    2017-02-12_11.19.23.png

    2017-02-12_11.21.22.png

    2017-02-12_11.29.46.png

  15. Look, I'm sorry. Guess I'll open an issue for EVERY major MC Version...

     

    I have a 1.8(.9) Mod and want to update it to 1.9(.4).

    Choonster's TestMod3 is a pretty good reference , but it doesn't work for me.

    Tell me what I've done wrong once again, please.

    That's what I did:

     

    • registering block and blockitem (on preinit)
    private static void registerLeavesBlock(Block block, String name)
        {
            block.setRegistryName(name); //<-sets Registry name HERE to make it more dynamic
            //GameRegistry.register(block,block.getRegistryName()); //<- is not needed I guess? I get something like a double registration error when using it
            GameRegistry.register(new ModLeavesItem(block),block.getRegistryName());//Uses a custom item class for some custumized behaviours. Yes it does extend ItemBlock
            Blocks.FIRE.setFireInfo(block, DEFAULT_LEAVES_FIRE_ENCOURAGEMENT, DEFAULT_LEAVES_FLAMMABILITY);
        }
    • register block variants (using the Client Proxy and executed on init)
    public void registerBlockModels()
        {
            for (DefinesLeaves define : subBlocks())//contains the block instance and some additional information
            {
                ModelResourceLocation typeLocation = new ModelResourceLocation(getRegistryName(),"variant="+define.leavesSubBlockVariant().name().toLowerCase());
                ModLeavesItem blockItem = new ModLeavesItem(define.leavesBlock());
                ModelLoader.setCustomModelResourceLocation(blockItem,define.leavesSubBlockVariant().ordinal(),typeLocation);
                //ModelResourceLocation typeItemLocation = new ModelResourceLocation(getRegistryName().toString().substring(0,getRegistryName().toString().length()-1)+"_"+define.leavesSubBlockVariant().name().toLowerCase(),"inventory"); //
                //ModelBakery.registerItemVariants(blockItem,typeItemLocation); 
                //isn't needed as well, I guess, as setCustomModelResourceLocation already registeres the model into the bakery. I tried to use it anyway though, since my item model is saved in a file with the pattern "<block>_<variant>.json" while the blockstate is not.
            }
        }

     

    • My assets layout:
    |-assets
     |-modid
      |-blockstates
       |-leaves0
       |-leaves1
       |-...
      |-models
       |-block
        |-leaves_type1
        |-leaves_type2
        |-leaves_type3
        |-...
       |-item
        |-leaves_type1
        |-leaves_type2
        |-leaves_type3
        |-item
        |-...
    • By the way, the localizing is broken too. I have a custom LangMap to fix that, but it shouldn't be broken in the first place. I assume it has to do with the same problem.

     

    Thanks and stuff.

  16. Just wanted to point out, that it is possible to set up a multi project workspace, just like in Eclipse. But you only need it, If one of your mods depends on another, or other reasons, why you want to load multiple mods at the same time. This saves you the building and copying your mods to the real minecraft folder.

     

    It works just like this one plus some fiddling around with the gradle files.

    I could make a tutorial for that. At least if you don't want to, seven.

  17. Yes it does. I'm talking about research, man. If I selled the mod, I would just need to know how to work with the newest version, since there are more people using it, but as a gamedev I want to learn how the different versions of forge/minecraft work. Not by looking at the deobfuscated code, the practical way.

     

    Alright, since this version is not supported anymore, I will ask the question in an unofficial forum, no problem.

    Thank you nevertheless.

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.