#Use items
16 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @dusk jetty! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
You can subscribe to the PlayerInteractEvent to check if the player is using an item.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
The player must use the item.
Use the item in what way? Right clicking it?
Then that would be a PlayerInteractEvent like I previously mentioned
I'm just using TickEvent.PlayerTickEvent, I need the check to happen all the time
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event){
if (event.player.getMainHandItem().getItem() == Items.WATER_BUCKET) {
if (!event.player.isOnGround()) {
if (event.player.getXRot() == 90.0) {
//Here need to use water bucket
}
}
}
}
@shy citrus ?
ohhhh I see.
You want the player to place water under them for as long as they're holding the water bucket
do you want it to consume the water from the bucket or do you want it to just spawn a water block?
The mod is client-side so i need him to use a bucket of water
But now I have a suspicion that event.player covers not just one player (who we play as) but all of them, should I check if it's the main or another player?