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.

MineDen

Members
  • Joined

  1. Oh, I forgot that my TE doesn't extend TileEntityFurnace, and I also forgot to change checking in block code!
  2. Also I want to open furnace GUI but it doesn't open. Here is my code: Block: public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityFurnace) { playerIn.displayGUIChest((TileEntityFurnace) tileentity); playerIn.addStat(TestMod.CHEMICAL_LABORATORY_INTERACT); } return true; } } TileEntity: @Nonnull public String getGuiID() { return "minecraft:furnace"; } @Nonnull public Container createContainer(@Nonnull InventoryPlayer playerInventory, @Nonnull EntityPlayer playerIn) { return new ContainerFurnace(playerInventory, this); }
  3. Okay, I'll try this. UPD: there is no overloads, only string. Is this should be like "testmod:my_tileentity"?
  4. Today I copied and edited furnace tileentity and then started testing. But now I have "TileEntity is missing a mapping! This is a bug!" exception. In 1.9 I can fix it by registering TE with GameRegistry.registerTileEntity(...) but in 1.12 I should use RegistryEvents and here is described types of events, and there is no TileEntity! So how I can register my TE?
  5. Math.round(Math.random() * <count> - 1) is the JavaScript arrays way, and it's my favourite way, so shut up i will use this way.
  6. Is this code right? It works. public static CreativeTabs decoration = new CreativeTabs("mtest_decoration") { @Override public ItemStack getTabIconItem() { int index = (int) Math.round(Math.random() * (MBlocks.BLOCKS.size() - 1)); Block block = MBlocks.BLOCKS.get(index); NonNullList<ItemStack> subBlocks = NonNullList.create(); block.getSubBlocks(CreativeTabs.SEARCH, subBlocks); System.out.println(subBlocks); int meta = (int) Math.round(Math.random() * (subBlocks.size() - 1)); ItemStack is = new ItemStack(block, 1, meta); return is; } };
  7. OK, I'll try that.
  8. This method returns void, what I can do?
  9. Sorry, but I can't understand this chain getSubItems>NonNullList>List>ItemStack, CreativeTabs... It is better to make own game on LWJGL 3 with bulit-in modloader always return random block with metadata 0.
  10. Okay, I'll try this now.
  11. This method requires NonNullList of ItemStacks. But why? I trying to call this method from an instance of Item.
  12. But what if i have other block with only one variant?
  13. Hello, I need to get maximum meta value of block. I created a creative tab and returning random block as icon, but I have colored blocks. And I want to return random meta. But I don't know how to get maximum meta value of block. Now my creative tab code looks like this: public static CreativeTabs decoration = new CreativeTabs("mtest_decoration") { @Override public ItemStack getTabIconItem() { int index = (int) Math.round(Math.random() * (MBlocks.BLOCKS.size() - 1)); Block block = MBlocks.BLOCKS.get(index); int meta = 0; ItemStack is = new ItemStack(block, 1, meta); return is; } };
  14. Thanks, Draco18s, diesieben07, Kokkie, loordgek! All works properly!
  15. I understand it.

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.