本人实在小白一只,想法是通过重写Item类下的inventoryTick方法来实现。但无奈对于java的学习还不够深入,查了几天也没查出什么东西来,还望各位大佬喷轻一点qwq。对了,使用的是yarn表 @Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.inventoryTick(stack, world, entity, slot, selected);
ItemStack item = stack.getItem().getDefaultStack();
PlayerEntity someone = entity.getCommandSource().getPlayer();
if(item.NAME_KEY=="void_axe")
{
}
}复制代码
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
super.inventoryTick(stack, world, entity, slot, selected);
ItemStack item = stack.getItem().getDefaultStack();
PlayerEntity someone = entity.getCommandSource().getPlayer();
if(item.NAME_KEY=="void_axe")
{
}
}复制代码