Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Choonster

Moderators
  • Joined

  • Last visited

Posts posted by Choonster

  1. ·

    Edited by Choonster

    Minecraft calls BlockModelShapes#registerBuiltInBlocks for the shulker box Blocks, which means that BlockStateMapper#getBlockstateLocations and BlockStateMapper#getVariants return an empty Set/Map respectively when called with one of the Blocks.

     

    You can achieve the same result by implementing IStateMapper#putStateModelLocations to return an empty Map (using Collections.emptyMap) and registering an instance in ModelRegistryEvent using ModelLoader.setCustomStateMapper.

  2. You're checking if the Block is both replaceable and is equal to Blocks.GRASS, which will never be true because Blocks.GRASS isn't replaceable.

     

    You can use the && (and) operator to combine multiple boolean expressions (like the conditions of the four if statements) into one.

     

    Don't call World#getBiomeForCoordsBody directly, call World#getBiomeForCoords instead. This allows the WorldProvider to return the appropriate Biome (this may or may not call World#getBiomeForCoordsBody).

     

    Don't compare to Blocks.AIR directly, use Block#isAir to support modded air-like blocks.

  3. ·

    Edited by Choonster

    1 hour ago, Delupara said:

    I edited main post registry utilities to include Mod ID
    Same issue now the text on the block reads MODID:MODID:fooblock#inventory.

     

    You needed to change the blockstates file and the model, not the registration class.

     

    RegUt.registerBlocks and RegUt.regItems are broken since they only register the Blocks/Items on the physical client, but this needs to happen on both physical sides. Model registration must be done in a separate client-only class to avoid crashing the dedicated server.

     

    You should be using registry events instead of registering things in preInit. GameRegistry.register is no longer accessible in 1.12, so this will make it easier to update.

     

    The log you linked isn't the FML log.

  4. ·

    Edited by Choonster

    1 hour ago, ConfusedMerlin said:
    • I removed the item model to be honest. And now I do see the error-messages from the console log... (no item). Hm... just until now I thought all blocks will create their item via the blockitem-class. Well... at least, I think " normal location exception" means that I should put a normal block-variant back inside again. 

     

    Items load their models from either an item model file (the normal location) or a variant of a blockstates file (the blockstate location). You need to provide at least one model for every item.

     

    1 hour ago, ConfusedMerlin said:
    • I need to ask what do you mean by talking about "display transformations".... might it the the shift of size and rotation that control how the item does look inside the inventory, the hand, or floating around being dropped? Thats something I came across already, but did't put much attention at it.

     

    That's correct. Display transformations are rotation, translation and scale operations applied to the model when it's rendered as an item in various contexts (e.g. left/right hand, GUI, item entity, etc.).

  5. ·

    Edited by Choonster

    You need to include your mod ID as the domain of the model and texture paths, i.e. "<modid>:<model_name>" and "<modid>:<texture_path>".

     

    Textures need to in PNG format, not JPEG.

     

    Is the block called fooblock or memeblock? Your files are apparently called fooblock, but the blockstates file uses the memeblock.json model and the model uses the memeblock.png texture.

     

    In future, the FML log (logs/fml-client-latest.log in the game directory) will tell you why models/textures failed to load. If you don't know how to interpret the errors, post the full log using Gist or Pastebin when asking for help.

  6. Override Block#getDrops to do the following:

    • Write the TileEntity to NBT.
    • Create the ItemStack that will be dropped.
    • Set the "BlockEntityTag" key of the ItemStack's compound tag to the compound tag containing the TileEntity data.
    • Add the ItemStack to the drops list.

    The TileEntity is normally removed from the world before Block#getDrops is called, so you need to delay its removal by overriding BlockFlowerPot#removedByPlayer and BlockFlowerPot#harvestBlock. See Forge's patch to BlockFlowerPot for an example of this.

     

    When an ItemBlock (or ItemBlockSpecial) is placed by a player and the ItemStack has a compound tag at the "BlockEntityTag" key, it will automatically call TileEntity#readFromNBT with the compound tag (unless TileEntity#onlyOpsCanSetNbt returns true and the player isn't an op).

  7. 9 minutes ago, kirinnee97 said:

    I accessed the registries both using the RegistryEvent and ForgeRegistries and access the recipe registry (ForgeRegistries.RECIPES) and tried removing, but it throws a 

    java.lang.UnsupportedOperationException: remove

     

    Which version of Forge are you using? Post your code and the full stacktrace of the exception.

  8. The recipe registry (unlike other registries) is modifiable, so you can actually remove a recipe using IForgeRegistryModifiable#remove.

     

    Any advancement that rewards the recipe will throw a syntax exception (spamming the log) if you do this, though.

  9. 13 minutes ago, KalebCraft // TheCubeCub said:

    Not really... I'm kinda new to modding, I've done some basic 1.7.10 modding ages ago, but yeah. Pretty new.

     

    You need to have a solid understanding of Java before making a mod. As it says in this section's description, we're not here to help with basic Java problems.

     

    Java has a tutorial on parameters here.

  10. ·

    Edited by Choonster

    The logging of missing models was broken in Forge 1.12-14.21.0.2363 (commit dc043ac) and fixed in Forge 1.12-14.21.1.2390 (commit ede05a2).

     

    After updating Forge, it was easy to identify the issues with the turret blockstates file:

    • You were using strings instead of integers for the x and y rotations.
    • The first variant was misspelled (facung=up rather than facing=up).
    • The first variant has an invalid block/ prefix in its model location.

     

    Some other issues I noticed:

    • There's no item model for the turret in the repository.
    • IanusIncHq uses Java's Logger instead of log4j's (which is what Minecraft uses).
    • CustomBlock has a missing semicolon.
    • The turret and small super condensator models extend minecraft:block/cube_all but override its elements and don't specify the all texture. They should extend minecraft:block/block instead, since it provides the standard display transformations without providing any elements.
    • The other non-cube models don't extend any model and don't specify any display transformations, they should extend minecraft:block/block.

     

    I've fixed these issues and pushed the changes to GitHub. You can view and/or merge the changes here.

  11. Which Minecraft version are you using?

     

    I'm guessing you're using a version where Block#isOpaqueCube has an IBlockState parameter, which your isOpaqueCube method doesn't.

     

    Always annotate override methods with @Override so you get a compilation error when they don't actually override a super method. You should also use your IDE to auto-generate override methods with the correct signature and annotation.

     

    In future, please post code using a code block (the <> icon) or on Gist/Pastebin.

  12. You're overriding expanded:dark_oak_bed_item (i.e. registering a new value with the same name), but the old value doesn't have an OverrideOwner associated with it. If I understand Forge's registry code correctly, this would happen when the new value has the same owner (mod ID) as the old one (because the new OverrideOwner and value replace the old OverrideOwner and value in the ForgeRegistry#owners BiMap).

     

    Are you registering this Item in multiple places? As Draco said, we need to see more of your code.

  13. ·

    Edited by Choonster

    Post your code, specifically where you register an override of a vanilla registry entry.

     

    Also post the FML log so we can see exactly what the message is warning about.

     

     

    7 minutes ago, Draco18s said:

    The method signature likely changed. Check the super class for the new signature.

     

     

    This is related to the new override system provided by Forge's registries, which replaces the old substitution alias system.

     

    It's not related to overriding a method.

  14. ·

    Edited by Choonster

    ItemStacks can be null in 1.10.2 and earlier, so your ItemStackHandler#insertItem override should be annotated with @Nullable, not @Nonnull. This also applies to the ItemStack parameter.

     

    It's only in 1.11 and later that ItemStacks can't be null.

     

    This particular crash is triggered by IDEA's automatic runtime null-checking. For methods that you control, fix the annotations or the code so that @Nonnull methods don't return null values. For methods that you don't control, you can disable the null-checking as described here.

  15. 6 minutes ago, TheRPGAdventurer said:

    it shows these 3 (world, pos, face) what do I put in them?

     

    What do you mean? Do you know how to override a method?

     

    If the flammability/spread speed is always the same, you can simply return a constant value and ignore the arguments.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.