• 0

    posted a message on [SOLVED] Damaging a vanilla item on craft

    To change the items that remain after crafting a recipe, you need a custom IRecipe implementation that overrides IRecipe#getRemainingItems.


    Use ItemStack#attemptDamageItem to damage the item. This returns true if the item was destroyed, you should call ForgeEventFactory.onPlayerDestroyItem and set the remaining item in that slot to null when this happens. Use ForgeHooks.getCraftingPlayer to get the EntityPlayer for ForgeEventFactory.onPlayerDestroyItem.


    I have an example of this here.

    Posted in: Modification Development
  • 0

    posted a message on How do I change the attack cooldown of a weapon?

    Override Item#getAttributeModifiers do do the same thing as ItemSword#getItemAttributeModifiers but use a lower value for the attack speed modifier.

    Posted in: Modification Development
  • 0

    posted a message on Creating explosions that do not destory/break blocks?

    The last boolean argument of World#createExplosion/World#newExplosion is used to set the Explosion#isSmoking field. If this is false, the explosion doesn't destroy blocks.

    Posted in: Modification Development
  • 1

    posted a message on [SOLVED] ItemBlock models in 1.9

    On closer inspection, it is indeed using the item model; it simply has the wrong display transformations*.


    In 1.9, basic item models should extend item/generated (which extends builtin/generated and defines the standard display transformations) rather than extending builtin/generated and defining their own display transformations.


    * Technically, it has no display transformations since thirdperson and firstperson were replaced with thirdperson_righthand/thirdperson_lefthand and firstperson_righthand/firstperson_lefthand.

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] ItemBlock models in 1.9

    Do you have a public repository of your code available somewhere?


    If so, please post that along with the FML log (using Gist).

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] ItemBlock models in 1.9

    Does your item model extend your block model or are they completely separate?


    Minecraft falls back to the model specified by the blockstates file when it can't load the item model. As usual, there should be an error in the log telling you why it failed to load the item model.

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] ItemBlock models in 1.9
    Quote from WolfieWaffle»

    UPDATE: It looks like when I comment out those lines, the error still appears. Maybe I'm registering it wrong somewhere else?


    That's the only possibility. The code in post #5 couldn't cause that error.
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] ItemBlock models in 1.9
    Quote from WolfieWaffle»


    OK, that makes a bit more sense. Each overload basically does the same thing with a different format. I read the summary, and it says that "assets/[domain]/models/item/[path].json" is how the location is supposed to be. So I thought that the code:

    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation("hardcoretorches:torch_burnt", "inventory"));




    should work. Yet it still doesn't. Does "domain" mean something besides the mod id, because I thought that domain what something like "minecraft:" or "examplemod:"?




    In almost every case, the domain is either your mod ID in lowercase or minecraft, yes.


    That code should work if you have a model at assets/hardcoretorches/models/item/torch_burnt.json and you called it preInit.


    If it's not working, there should an error in the log telling you what went wrong.

    Posted in: Modification Development
  • 0

    posted a message on GC overhead limit exceeded Build didn't decompile correctly.

    This tutorial explains how to set up a ForgeGradle workspace, including how to fix this error.

    Posted in: Modification Development
  • 1

    posted a message on [SOLVED] ItemBlock models in 1.9

    A ModelResourceLocation has three components: a domain, a path and a variant. ModelResourceLocation#toString produces a string in the format "[domain]:[path]#[variant]".


    There are three public ModelResourceLocation constructors:

    • ModelResourceLocation(String) - Takes a single string containing the domain, path and variant in the format described above
    • ModelResourceLocation(ResourceLocation, String) - Takes ResourceLocation containing the domain and path and a string containing the variant
    • ModelResourceLocation(String, String) - Takes a string containing the domain and path (in the format "[domain]:[path]", the same format produced by ResourceLocation#toString) and a string containing the variant

    I explain how ModelResourceLocations are mapped to models in this document (there's a brief summary at the end).

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] ItemBlock models in 1.9

    There were no changes to model registration for ItemBlocks between 1.8.9 and 1.9, you're just using the ModelResourceLocation constructor incorrectly.


    The two-argument constructors of ModelResourceLocation accept the domain and path as the first argument (as either a ResourceLocation or a String in the format "[domain]:[path]") and the variant as the second argument. You're passing your mod ID by itself as the first argument, so it's defaulting to the minecraft domain.


    If you look closely at your log, the error should actually say "minecraft:hardcoretorches#torch_burnt" (i.e. a ModelResourceLocation with domain minecraft, path hardcoretorches and variant torch_burnt) rather than "minecraft:hardcoretorches:torch_burnt" (which would be a ResourceLocation with domain minecraft and path hardcoretorches:torch_burnt).

    Posted in: Modification Development
  • 0

    posted a message on Setting block property without setting its state
    Quote from TGC1»

    I am seriously facepalming right now since I already overwritten that but I forgot to add IS_TOP.

    However I've fixed everything but the IS_TOP always return False when plant it without any growing at all even if the default state is true....

    Is IS_TOP stored in the metadata by Block#getMetaFromState and Block#getStateFromMeta?
    Posted in: Modification Development
  • 0

    posted a message on Setting block property without setting its state

    You must override Block#createBlockState to create and return a new BlockStateContainer of your Block (this) and its properties (AGE and IS_TOP).


    There are very few situations where you need to explicitly box/unbox primitive values (e.g. by calling Integer.valueOf/Integer#intValue) or cast null (e.g. (CreativeTabs)null). You only see this in Minecraft's code because the compiler does this automatically and the decompiler doesn't remove it.

    Posted in: Modification Development
  • 1

    posted a message on Missing texture in JSON model.
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: The following texture errors were found.
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: ==================================================
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: DOMAIN giftboxmod
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: --------------------------------------------------
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: domain giftboxmod is missing 0 textures
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: domain giftboxmod has 2 locations:
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: mod examplemod resources at D:\Modding19\bin
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: mod giftboxmod resources at D:\Modding19\bin
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: -------------------------
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: The following other errors were reported for domain giftboxmod:
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: -------------------------
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: Problem: broken aspect ratio and not an animation
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: textures/blocks/giftboxBlock.png
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: textures/blocks/giftboxString_green.png
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: ==================================================
    [23:10:44] [Client thread/ERROR] [TEXTURE ERRORS/]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=




    Textures used in baked models must be square. The exception is animated textures, whose height must be a multiple of their width (i.e. multiple square textures stacked vertically).


    Your textures aren't square.



    [23:10:42] [Client thread/ERROR] [FML/]: Exception loading model for variant giftboxmod:giftboxBlockItem#inventory for item "giftboxmod:giftboxBlockItem", normal location exception:
    net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model giftboxmod:item/giftboxBlockItem with loader VanillaLoader.INSTANCE, skipping
    ...
    Caused by: java.io.FileNotFoundException: giftboxmod:models/item/giftboxBlockItem.json

    ...
    [23:10:42] [Client thread/ERROR] [FML/]: Exception loading model for variant giftboxmod:giftboxBlockItem#inventory for item "giftboxmod:giftboxBlockItem", blockstate location exception:
    ...
    Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException




    The giftboxmod:giftboxBlockItem model doesn't exist.

    Posted in: Modification Development
  • 0

    posted a message on Missing texture in JSON model.

    Upload the FML log (logs/fml-client-latest.log) to Gist and link it here.

    Posted in: Modification Development
  • To post a comment, please .