Jump to content

MichaelVitrio

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by MichaelVitrio

  1. I am now creating my ItemBlockBricks instance in my Block constructor, with Block#getSubBlocks overridden like this:

    @Override
        public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
            items.add(new ItemStack(this, 1, 0));
            items.add(new ItemStack(this, 1, 2));
            items.add(new ItemStack(this, 1, 3));
        }

     

    I also registered these items using

    ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));

     

    with meta passed 0, 2, and 3 respectively. This kind of works, now I've got 3 separate slots in JEI/creative tab with the blocks, except that they all have the same texture (with different unlocalized names). Here's my blockstate file:

    { 
            "variants": { 
                    "variant=default": { "model": "verbum:bricks_basalt" }, 
                    "variant=cracked": { "model": "verbum:bricks_basalt_cracked" }, 
                    "variant=carved": { "model": "verbum:bricks_basalt_carved" } 
            } 
    }

     

  2. 16 hours ago, diesieben07 said:

    override Block#getSubBlocks to return all possible options. 

    Thanks for the reply. The Block#getSubBlocks is void, so I assume the following is what's expected:

    @Override
        public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
    
            Item itemBricks = new ItemBlockBricks(this);
    
            items.add(new ItemStack(itemBricks, 1, 0));
            items.add(new ItemStack(itemBricks, 1, 2));
            items.add(new ItemStack(itemBricks, 1, 3));
    
        }

     

    And of course, here's my ItemBlockBricks class

    public class ItemBlockBricks extends ItemMultiTexture {
    
        private static String[] names = new String[]{"bricks_basalt", "", "bricks_basalt_carved", "bricks_basalt_cracked"};
    
        public ItemBlockBricks(Block block) {
    
            super(block, block, names);
          	setRegistryName("bricks_basalt");
    
        }
    
        @Nonnull
        @Override
        public String getUnlocalizedName(ItemStack stack) {
    
            int meta = stack.getMetadata();
            return meta < 4 ? names[meta] : "";
    
        }
    
    
    }

     

    I then register their models using

            ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));

     

    where id is passed "inventory", item is passed the custom ItemBlockBricks instance. However, this gives a NullPointerException whose stack trace does not contain my own classes. I've done quite a lot of code-reading trying to get an idea how this is done in other mods, read the Forge documentation, and watched youtube tutorials with no luck. I feel like I'm missing something here.

  3. Hi all,

     

          I am working on hiding mod items from JEI. I tried the following in my plugin class annotated @JEIPlugin implementing IModPlugin:

    @Override
        public void register(IModRegistry registry) {
    
            IIngredientBlacklist blacklist = registry.getJeiHelpers().getIngredientBlacklist();
            blacklist.addIngredientToBlacklist(ItemInit.INGOT_MAGIC_STEEL);
        }

         And this exception arises upon loading:

    [14:14:41] [main/ERROR] [jei]: Failed to register mod plugin: class com.fieryslug.verbum.integration.VerbumJEIPlugin
    java.lang.IllegalArgumentException: Unknown ingredient class: class com.fieryslug.verbum.object.item.ItemBase
    	at mezz.jei.ingredients.IngredientRegistry.getIngredientType(IngredientRegistry.java:298) ~[IngredientRegistry.class:?]
    	at mezz.jei.ingredients.IngredientRegistry.getIngredientType(IngredientRegistry.java:280) ~[IngredientRegistry.class:?]
    	at mezz.jei.ingredients.IngredientRegistry.getIngredientHelper(IngredientRegistry.java:128) ~[IngredientRegistry.class:?]
    	at mezz.jei.ingredients.IngredientBlacklist.addIngredientToBlacklist(IngredientBlacklist.java:21) ~[IngredientBlacklist.class:?]
    	at com.fieryslug.verbum.integration.VerbumJEIPlugin.register(VerbumJEIPlugin.java:36) ~[VerbumJEIPlugin.class:?]
    	at mezz.jei.startup.JeiStarter.registerPlugins(JeiStarter.java:181) [JeiStarter.class:?]
    	at mezz.jei.startup.JeiStarter.start(JeiStarter.java:64) [JeiStarter.class:?]
    	at mezz.jei.startup.ProxyCommonClient.loadComplete(ProxyCommonClient.java:120) [ProxyCommonClient.class:?]
    	at mezz.jei.JustEnoughItems.loadComplete(JustEnoughItems.java:54) [JustEnoughItems.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
    	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:626) [FMLModContainer.class:?]
    	at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) ~[?:?]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
    	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) [guava-21.0.jar:?]
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) [guava-21.0.jar:?]
    	at com.google.common.eventbus.EventBus.post(EventBus.java:217) [guava-21.0.jar:?]
    	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218) [LoadController.class:?]
    	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196) [LoadController.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
    	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) [guava-21.0.jar:?]
    	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) [guava-21.0.jar:?]
    	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) [guava-21.0.jar:?]
    	at com.google.common.eventbus.EventBus.post(EventBus.java:217) [guava-21.0.jar:?]
    	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [LoadController.class:?]
    	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:752) [Loader.class:?]
    	at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336) [FMLClientHandler.class:?]
    	at net.minecraft.client.Minecraft.init(Minecraft.java:581) [Minecraft.class:?]
    	at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?]
    	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
    	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_191]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
    	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    	at GradleStart.main(GradleStart.java:25) [start/:?]

         I have a feeling I'm not doing things the proper way. Any idea how this is done in general?

         MC version: 1.12.2

         Forge version: 14.23.5.2768

         JEI version: 4.13.1.222

     

  4. These might be relatively basic questions but since I can't find any clue in vanilla code and I did try to look up on internet with no luck, I'm here seeking help from the community.

     

    1. What does the return value of Container#transferStackInSlot mean and what might possibly cause the game to crash upon calling this method?

     

    2. Is Slot#isItemValid supposed to check the size of the current ItemStack in the slot or it should just return true whenever the ItemStack is allowed to be in the slot?

     

    3. In class ItemStackHandler (I assume it's sort of a default implementation of IItemHandler, is that correct though), there're two empty methods onLoad() and onContentsChanged(), which don't override any super class methods but are called within other methods. Are they supposed to perform any functionality or they're just some place holders?

     

    Thanks a lot for your help

  5.     I am relatively new to minecraft modding and I have a few questions:

     

        To add additional drops from a block (i.e. Having them to drop "regular" drops as well as other items occasionally), instead of overriding the methods of Block class, what is the "proper" way of doing this?

    And similarly, I assume there's also a much preferred way to add custom drops to mobs other than using event listeners.

     

        I would really appreciate your help and suggestions. Thanks a lot!

     

  6.   I'm recently working on my custom tile entity container, and I'm a bit confused with the markDirty() method in TileEntity class. is there anyone who can tell me what it does?

     

      I've read the description, it says:

          "for tile entities, ensures the chunk containing the tile entity is saved to the disk later - the game wont think it            hasn't changed and skip it"

     

    So when and where do I need to use this method? What happens if I don't?

     

    Thanks :) and i apologize for my poor English

×
×
  • Create New...

Important Information

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