#itemStack data
1 messages · Page 1 of 1 (latest)
use testfor command
function isWaterBottle(player) {
const testfor = player.runCommand('testfor @s[hasitem={item=potion,location=slot.weapon.mainhand,data=0}]').successCount;
if (testfor > 0) return true;
else return false;
}```
just call the function.
world.afterEvents.playerInteractWithEntity.subscribe(({ target, player, beforeItemStack, itemStack }) => {
if (target.typeId === 'minecraft:creeper' && isWaterBottle(player)) {}
});```