jopi
Попрошайка
- 1,421
- 30
- 260
Это код на установку владельца но как он работает и как его довести до ума что-бы он работал у меня в коде меча?
Java:
String owner = null;
public ItemStack onRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
if (!world.isRemote)
{
if(!stack.stackTagCompound.hasKey(owner))
stack.stackTagCompound.setString(owner, player.getDisplayName());
}
return stack;
}
public void addInformation(ItemStack stack, EntityPlayer playerIn, List lines, boolean advanced)
{
if(stack.hasTagCompound() && stack.stackTagCompound.hasKey(owner))
{
lines.add(EnumChatFormatting.GREEN + "Владелец: " + stack.stackTagCompound.getString(owner));
getClass(); lines.add("§cУрон от меча: " + 500);
}
}