Posted March 6, 20214 yr how to check what block gets right clicked by your item, and then replace it to another block, but with the same blockstate as the first block? I know I have to use the "onItemUse" method but don't know what to put after the 'if' this is what I got so far.... public ActionResultType onItemUse(ItemUseContext context) { World world = context.getWorld(); BlockPos blockpos = context.getPos(); BlockState blockstate = world.getBlockState(blockpos); BlockState block = blockstate.getBlockState(); if (block != null) {
March 6, 20214 yr Author 1 minute ago, diesieben07 said: What do you mean by this? The blockstate includes the block, so if you want the same blockstate that also means its the same block. I meant same rotation.. 2 minutes ago, diesieben07 said: This check is pointless. what do I have to check and how to replace it with another block
March 6, 20214 yr Author 36 minutes ago, diesieben07 said: Not all rotatable blocks use the same block state properties. my custom ones do...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.