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.

TowerMX

Members
  • Joined

  • Last visited

Everything posted by TowerMX

  1. That was it. It now works fine, thanks a lot!
  2. In my mod I create a new block class, which when right-clicked it should give the player an item. Well, I managed to get it working properly, but then I added more lines of code to it and it stopped working. I've tried removing everything but the required lines (as I think it was when it worked) and it is not working. I hope you can fin what I'm doing wrong in the code I attach (note that some method overrides are missing, I'm not attaching the whole code, just the needed). package com.name.modid.objects.blocks; //Imports here public class ModBlock extends Block { //Some missing methods here, don't mind. They exist in my code. @ObjectHolder("modid:moditem") public static final Item item_var = null; ItemStack item_stack = new ItemStack(item_var); @Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { player.inventory.addItemStackToInventory(item_stack); return ActionResultType.SUCCESS; } }
  3. Thank you! I was messing up and couldn't understand exactly how to use it. I've managed to use the Player#getHeldItem as you said and it works fine, I can now use its id and nbt.
  4. I'm trying to make a block give you an item only when you click it with a certain item (id and nbt). I've seen this solved in previous versions but I just can't figure out how to do this in 1.15.2. Also, I'm manipulating the onBlockActivated action in this block class, is it right? Thanks for any 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.