I have the two items created but I don't know how to set 'otherItem' as the case (and vice versa).
EDIT: This is my code for the ItemQuinqueDoujima. I'm trying to create the 'Quinques' from Tokyo Ghoul.
package com.tokyoghoul.tgmod.items;
import com.tokyoghoul.tgmod.TokyoGhoulMod;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
public class ItemQuinqueDoujima extends Item {
private ItemStack ItemQuinqueCase;
public boolean hasOtherItem() {
return ItemQuinqueCase != null;
}
public void setOtherItem(ItemStack otherItem) {
this.ItemQuinqueCase = otherItem;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {
super.addInformation(stack, playerIn, tooltip, advanced);
if (hasOtherItem()) {
tooltip.add(StatCollector.translateToLocalFormatted("item.swapTestWithItem.desc", ItemQuinqueCase.getDisplayName()));
} else {
tooltip.add(StatCollector.translateToLocal("item.swapTestWithoutItem.desc"));
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
if (hasOtherItem() && playerIn.isSneaking()) {
return ItemQuinqueCase.copy();
}
return super.onItemRightClick(itemStackIn, worldIn, playerIn);
}
}