Everything posted by DasHutch
-
[1.18.1] Spawn Item at a BlockPos
Thank you, I've got this implemented now! really appreciate you taking the time to point me in the right direction.
-
[1.18.1] Spawn Item at a BlockPos
After clicking a block, I'd like to spawn an item at that location... I currently am using `public InteractionResult useOn(UseOnContext context)` and updating some values on a capability and can easily consume said item - however, when I shift (crouch) click I would like to spawn the item back at that location. (currently, requiring the item to exist in hand) // I can drop item or spawn at location an item - but this is relation to the player (as it's an entity) using one of the following player.drop(newItem, false); player.spawnAtLocation(newItem, 0.2F); However, `drop` creates an animated hand gesture (like player is throwing something on ground - makes sense, but not what I'm looking for) and `spawnAtLocation` is where the player is not where the block clicked is... I've been looking in Level and everywhere to find a similarly named method - I don't see one. What is the best approach to "spawn an item at a clicked block" any guidance of where I should start looking would be appreciated, happy to do the exploring and learning just needing a little nudge in the right direction
-
Is it possible to modify tags of a block in world (for example - when clicked)
Ah, ok so I’ll dig into capabilities. Thank you so much for the assistance! looking forward to learning more about these systems today and seeing where I end up. Have a great day!
-
Is it possible to modify tags of a block in world (for example - when clicked)
just that particular block position (and any additional block positions that are clicked with the same item)
-
Is it possible to modify tags of a block in world (for example - when clicked)
ah, ok so I’d need another approach. Overall goal would be to click any block with an item and do two things - consume item (which I can do) and mark that block as non spawnable. It seems like I’ll have to just use a set, or map and keep track of these separately… unless there’s someway to “wrap” every block at registration time with a new blockstate that includes an added property but that didn’t seem possible either not the right approach to me naïvely
-
Is it possible to modify tags of a block in world (for example - when clicked)
I'd like to modify a tag when a block is (not just a block within my mod - ie vanilla block, other mod blocks, etc) I'm still digging through the codebase but I'm new to Forge modding so was hoping for a pointer or two on what I should look into. Happy to do the research, just looking for a little guidance if possible. Specifically, I'm using an item on a block: code example below (also I assume I'll need to use level.setBlock once modified) @Override public InteractionResult useOn(UseOnContext context) { // This will get me the tags on the block... // context.getLevel().getBlockState(context.getClickedPos()).getTags(); }
IPS spam blocked by CleanTalk.