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.

inifire201

Members
  • Joined

  • Last visited

  1. If you are still lost, maybe this method will be a bit more helpfull. Take all your blocks, put them in a list. When registering itemblocks, take that list and by using for put "setRegistryName()" on the end. This is how it should look like. I hope really this helps ;-) public class BlockHandler { public static List<Block> BLOCKS = new ArrayList<Block>(); public static Block test_block = new BlockTestBlock(Material.ROCK, "test_block", CreativeTabHandler.tabMW, 5f, 15f, 3, "pickaxe"); @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event){ BLOCKS.add(test_block); for(Block block : BLOCKS){ event.getRegistry().register(block); } } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event){ for(Block block: BLOCKS){ event.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName())); } } }
  2. Got it working here as well, thanks for helping out.
  3. ObjectHolders are ATM not my problem, in don't think that has anything to do with this. My problem is that when i try to register my ItemBlocks is that i get: "java.lang.NullPointerException: Can't use a null-name for the registry, object net.minecraft.item.ItemBlock@73ae7ce4." When i debug the item that is put in it has a registry name, but i still get that exeption.
  4. I am updating my mod to 1.12(registry), until i hit a wall when my game crashed with: java.lang.NullPointerException: Can't use a null-name for the registry, object net.minecraft.item.ItemBlock@73ae7ce4. While debugging i also found that the ArrayList was filled but with null blocks. I did the same thing for items and that's working fine. Thanks in advance. (full crash log) My code: @Mod.EventBusSubscriber(modid = Ref.MODID) public class BlockHandler { public static List<Block> BLOCKS = new ArrayList<Block>(); public static Block test_block = new BlockTestBlock(Material.ROCK, "test_block", CreativeTabHandler.tabMW, 5f, 15f, 3, "pickaxe"); public static Block shard_ore_orange = new BlockShardOre(Material.ROCK, "shard_ore_orange", CreativeTabHandler.tabMW, 4f, 10f, 2,"pickaxe", ItemHandler.orangeShard, "orange"); public static Block shard_ore_green = new BlockShardOre(Material.WOOD, "shard_ore_green", CreativeTabHandler.tabMW, 4f, 10f, 2, "axe", ItemHandler.greenShard, "green"); public static Block shard_ore_white = new BlockShardOre(Material.ROCK, "shard_ore_white", CreativeTabHandler.tabMW, 4f, 10f, 2, "pickaxe" ,ItemHandler.whiteShard, "white"); public static Block shard_ore_purple = new BlockShardOre(Material.ROCK, "shard_ore_purple", CreativeTabHandler.tabMW, 4f, 10f, 2, "pickaxe" , ItemHandler.purpleShard, "purple"); public static Block trinket_maker = new BlockTrinketMaker(Material.WOOD, "trinket_maker", CreativeTabHandler.tabMW, 4f, 10f, 3,"axe", true); //TODO Fix this, error: nullpointer exeption. added blocks are null. @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event){ BLOCKS.add(test_block); BLOCKS.add(shard_ore_green); BLOCKS.add(shard_ore_orange); BLOCKS.add(shard_ore_purple); BLOCKS.add(shard_ore_white); BLOCKS.add(trinket_maker); for(Block block : BLOCKS){ event.getRegistry().register(block); } } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event){ for(Block block : BLOCKS){ ItemBlock itemBlock = new ItemBlock(block); event.getRegistry().register(itemBlock); } } @SideOnly(Side.CLIENT) @SubscribeEvent public static void registerModels(ModelRegistryEvent event){ for(Block block: BLOCKS){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); } } } (edit) Solution: Registry name wasn't set, code: @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event){ BLOCKS.add(test_block); BLOCKS.add(shard_ore_green); BLOCKS.add(shard_ore_orange); BLOCKS.add(shard_ore_purple); BLOCKS.add(shard_ore_white); BLOCKS.add(trinket_maker); for(Block block : BLOCKS){ event.getRegistry().register(block); } } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event){ for(Block block: BLOCKS){ event.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName())); } }
  5. Got it working, thanks for helping out!
  6. I've been trying to register a recipe while using the ore dictionary, this is what i got: GameRegistry.addRecipe(new ItemStack(BlockHandler.trinket_maker, 1), "FSI", "LBL", "LEL", 'F', Items.FLINT, 'S', Items.STICK, 'I', Items.IRON_INGOT, 'L',"logWood", 'B', Blocks.IRON_BLOCK, 'E', Items.EMERALD); When i use this the recipe show up in JEI without the "logWood". I've tried it using "Blocks.LOG" and that works perfectly. How am i using this wrong? thanks in advance.
  7. inifire201 changed their profile photo
  8. Got it, worked now. Thanks for helping out!
  9. I got that part but how, the new EntityCow doesn't have anymore fields.
  10. I've been trying to spawn a cow on item dropped. The potion effect works, but where the heck did the cow go? @Override public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) { player.addPotionEffect(new PotionEffect(Potion.getPotionById(15), 100, 2)); player.world.spawnEntity(new EntityCow(player.world)); return super.onDroppedByPlayer(item, player); } It's probably some dumb mistake but i can't find it . Please help

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.