Можешь сюда код кинуть? (если тебе не составит труда).
public String owner = "owner";
public ItemStack onItemRightClick(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 + "Owner: " + stack.stackTagCompound.getString(owner));
}
}
Благодарю.Вроде это
Java:public String owner = "owner"; public ItemStack onItemRightClick(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 + "Owner: " + stack.stackTagCompound.getString(owner)); } }
Все работает,но как сделать чтобы это активировалось не при ПКМ,а просто в инвентаре.Вроде это
Java:public String owner = "owner"; public ItemStack onItemRightClick(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 + "Owner: " + stack.stackTagCompound.getString(owner)); } }
сейчас проверю.onCreate вроде
Или что-то вроде этого
public void addInformation(ItemStack stack, EntityPlayer playerIn, List lines, boolean advanced)
{
lines.add("Описание");
}
Благодарю за обычное описание.Java:public void addInformation(ItemStack stack, EntityPlayer playerIn, List lines, boolean advanced) { lines.add("Описание"); }
Может onInventory?onCreate вроде срабатывает при крафте, или при получении предмета через креативную вкладку.
Как не странно,onInventory не работает.Попробуй.
/**
* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
* update it's contents.
*/