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.

Leaderboard

Popular Content

Showing content with the highest reputation on 07/04/17 in all areas

  1. And there's the error I expected to find when I saw the thread title. Cool! /me likes not being wrong. Yes. And the reason you probably never encountered it before was because you'd never done crops before. ItemSeed requires a reference to a block, which means it MUST be created after the block.
  2. You do not need to write the itemstack into NBT. You need to write TE's data into NBT and set that NBT to itemstack's tag with a BlockEntityTag key. Currently you are creating a new NBT, writing the ItemStack in there, writing your TE data in there and discarding the NBT. The ItemStack has no NBT associated with it as a result. Use ItemStack::setTagInfo to write an NBT into your ItemStack's compound.
  3. 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).
  4. If you want to override a vanilla loot table you can also make your own loot table (wich is a copy of the vanilla one + the items of your mod) and then in that event set your loot table as the table of the event. For example, i do this to override the vanilla mineshaft chest loot table. I create my own mineshaft chest loot table by doing this public static ResourceLocation CHESTS_ABANDONED_MINESHAFT; CHESTS_ABANDONED_MINESHAFT = LootTableList.register(new ResourceLocation(MW.MODID, "abandoned_mineshaft")); and i call this from the init method in main mod file. This will assume that in your assets folder you have a folder called "loot_tables" and inside that folder you have the loot table you're looking for (in this case "abandoned_mineshaft"). That will be the replaced loot table (so the game will load this instead of the vanilla one). For example look at this loot table { "pools": [ { "name": "abandoned_mineshaft_1", "rolls": 1, "entries": [ { "type": "item", "entryName": "golden_apple", "name": "minecraft:golden_apple", "weight": 20 }, { "type": "item", "entryName": "enchanted_golden_apple", "name": "minecraft:golden_apple", "weight": 1, "functions": [ { "function": "set_data", "data": 1 } ] }, { "type": "item", "name": "minecraft:name_tag", "weight": 30 }, { "type": "item", "name": "minecraft:book", "weight": 10, "functions": [ { "function": "enchant_randomly" } ] }, { "type": "item", "name": "minecraft:iron_pickaxe", "weight": 5 }, { "type": "item", "name": "mw:ruby", "weight": 20, "functions": [ { "function": "set_count", "count": { "min": 1, "max": 4 } } ] }, { "type": "item", "name": "mw:sapphire", "weight": 20, "functions": [ { "function": "set_count", "count": { "min": 1, "max": 4 } } ] }, { "type": "empty", "weight": 5 } ] }, { "name": "abandoned_mineshaft_2", "rolls": { "min": 2, "max": 4 }, "entries": [ { "type": "item", "name": "minecraft:iron_ingot", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 5 } } ], "weight": 10 }, { "type": "item", "name": "minecraft:gold_ingot", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 3 } } ], "weight": 5 }, { "type": "item", "name": "minecraft:redstone", "functions": [ { "function": "set_count", "count": { "min": 4, "max": 9 } } ], "weight": 5 }, { "type": "item", "name": "minecraft:dye", "functions": [ { "function": "set_data", "data": 4 }, { "function": "set_count", "count": { "min": 4, "max": 9 } } ], "weight": 5 }, { "type": "item", "name": "minecraft:diamond", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 2 } } ], "weight": 3 }, { "type": "item", "name": "minecraft:coal", "functions": [ { "function": "set_count", "count": { "min": 3, "max": 8 } } ], "weight": 10 }, { "type": "item", "name": "minecraft:bread", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 3 } } ], "weight": 15 }, { "type": "item", "name": "minecraft:melon_seeds", "functions": [ { "function": "set_count", "count": { "min": 2, "max": 4 } } ], "weight": 10 }, { "type": "item", "name": "minecraft:pumpkin_seeds", "functions": [ { "function": "set_count", "count": { "min": 2, "max": 4 } } ], "weight": 10 }, { "type": "item", "name": "minecraft:beetroot_seeds", "functions": [ { "function": "set_count", "count": { "min": 2, "max": 4 } } ], "weight": 10 } ] }, { "name": "abandoned_mineshaft_3", "rolls": 3, "entries": [ { "type": "item", "name": "minecraft:rail", "functions": [ { "function": "set_count", "count": { "min": 4, "max": 8 } } ], "weight": 20 }, { "type": "item", "name": "minecraft:golden_rail", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 4 } } ], "weight": 5 }, { "type": "item", "name": "minecraft:detector_rail", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 4 } } ], "weight": 5 }, { "type": "item", "name": "minecraft:activator_rail", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 4 } } ], "weight": 5 }, { "type": "item", "name": "minecraft:torch", "functions": [ { "function": "set_count", "count": { "min": 1, "max": 16 } } ], "weight": 15 } ] } ] } This is the vanilla abandoned_mineshaft loot table plus some rolls for my mod items, so in game in mineshafts i can find mod items too in chests. Finally, to load this table instead of the vanilla one you'll have to catch the LootTableLoadEvent and set the table to your own table. public void onLootTableLoad(LootTableLoadEvent event) { if(event.getName().equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) { event.setTable(event.getLootTableManager().getLootTableFromLocation(MWLootTables.CHESTS_ABANDONED_MINESHAFT)); } } In game, when you'll open a mineshaft chest it will load your loot table (the one showed up) instead of the vanilla one and so yuour mod items will have a chance to be in that cehst. Hope this is clear :)
  5. 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.
  6. Essentially: When a table is loaded and its the table I'm interested in modifying: - remove entries I don't want - add entries I do want Entries though, are complicated. Two thirds of that code is merely having to rebuild the desired conditional parameters involved with the loot table entries or boilerplate to aid in such. i.e. this is what the loot table for beef from a cow looks like (there's also a leather entry, so this is only half of the cow.json file inside assets.minecraft.loot_tables.entities): { "rolls": 1, "entries": [ { "type": "item", "name": "minecraft:beef", "weight": 1, "functions": [ { "function": "set_count", "count": { "min": 1, "max": 3 } }, { "function": "furnace_smelt", "conditions": [ { "condition": "entity_properties", "entity": "this", "properties": { "on_fire": true } } ] }, { "function": "looting_enchant", "count": { "min": 0, "max": 1 } } ] } ] } So when I override the quantities involved I've got to recreate all of that. If you look at this section here, you'll see how that's handled. 318 removes the existing entry, 319 begins the declaration for the new entry. 322-326 handle the "furnace_smelt" functionality. 327-333 handles a custom function (my mod makes animals die of old age, and in such a case, they shouldn't drop any items on death). I did not include a replacement for the looting enchantment; I should go back and add that (an oversight on my part). Fortunately, you're doing something a lot simpler. Downside, I don't know if my LootUtils has all of the features needed. I've only created the methods that do what I need to do. Looks like you would need a way to add an entry to an existing list of entries, assuming its possible.
  7. LootTableLoadEvent. Uses my LootUtils class.
  8. 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.
  9. It you check that it equals zero, then it will only be true when the random number is exactly zero; in other words, it will make it spawn the Ruby type 1/6 of the time instead of 5/6. EDIT Whoops, a bit of a delayed response; I should have refreshed the page before replying. Sorry.
  10. I have a feeling that what you actually want is to roll the random once and compare its value in each of the five statements.
  11. If you don't want the random part, just delete it (everything after the && and the && itself). As you seem to be struggling with pretty basic stuff (contitions) I would STRONGLY suggest that you go and learn a bit more java and then come back.
  12. Everything in the net.minecraft.server.dedicated package is server-side only, so if you want to access something from there you would need a server proxy.

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.