@SuppressWarnings("unchecked")
@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, @Nonnull EnumHand hand) {
ItemStack stack = playerIn.getHeldItem(hand);
if (stack.getTagCompound() == null)
stack.setTagCompound(new NBTTagCompound());
if (!stack.getTagCompound().hasKey("Owner")) {
stack.getTagCompound().setString("Owner", playerIn.getUniqueID().toString());
stack.getTagCompound().setString("OwnerName", playerIn.getDisplayNameString());
return new ActionResult(EnumActionResult.SUCCESS, stack);
} else if (canOpenGui) {
if (stack.getTagCompound().getString("Owner").equals(playerIn.getUniqueID().toString())) {
FMLNetworkHandler.openGui(playerIn, Overlord.instance, -1, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
if (consumable)
stack.shrink(1);
return new ActionResult(EnumActionResult.SUCCESS, stack);
} else {
return new ActionResult(EnumActionResult.FAIL, stack);
}
} else {
return new ActionResult(EnumActionResult.PASS, stack);
}
}
ItemOverlordsSeal.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:Overlord
作者:
评论列表
文章目录