Jump to content

Youssef Amr Sayed Amir Misbah

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Youssef Amr Sayed Amir Misbah

  1. public class fluorite_dropper extends Item { public fluorite_dropper(Properties pProperties) { super(pProperties); } @Override public InteractionResult useOn(UseOnContext pContext) { if(pContext.getLevel().isClientSide()) { BlockPos positionClicked = pContext.getClickedPos(); Player player = pContext.getPlayer(); Level#setBlock pContext.getItemInHand().hurtAndBreak(1, pContext.getPlayer(), (Player) -> player.broadcastBreakEvent(player.getUsedItemHand())); return super.useOn(pContext); } return null; } } Exactly what i tried i never works this is everything i could collect of my attempts i just need the command that replaces blocks
  2. level : not a statement setBlock: cannot resolve symbol setblock i am running on vesrion 1.18.1 Extra Info
  3. but i can show you the bear outline @Override public InteractionResult useOn(UseOnContext pContext) { if(pContext.getLevel().isClientSide()) { BlockPos positionClicked = pContext.getClickedPos(); Player player = pContext.getPlayer(); here is supposed to be where i put the placement code after i grab all needed coords but i cant find the right command pContext.getItemInHand().hurtAndBreak(1, pContext.getPlayer(), (Player) -> player.broadcastBreakEvent(player.getUsedItemHand())); return super.useOn(pContext); } Player needed a capital P
  4. but i can show you the bear outline @Override public InteractionResult useOn(UseOnContext pContext) { if(pContext.getLevel().isClientSide()) { BlockPos positionClicked = pContext.getClickedPos(); Player player = pContext.getPlayer(); here is supposed to be where i put the placement code after i grab all needed coords but i cant find the right command pContext.getItemInHand().hurtAndBreak(1, pContext.getPlayer(), (player) -> player.broadcastBreakEvent(player.getUsedItemHand())); return super.useOn(pContext); }
  5. Hi, I'm new at forge development and I am making an item that when right clicking any block with it it replaces it with another custom block. I tried using the method useOn and searched but I couldn't figure it out. Please help, Thank you.
×
×
  • Create New...

Important Information

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