2015-11-02 20:39:44 +00:00
|
|
|
package WayofTime.bloodmagic.item.sigil;
|
2015-10-30 05:05:00 +00:00
|
|
|
|
2016-03-28 03:11:03 +00:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
2018-03-08 03:43:00 +00:00
|
|
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
2018-02-28 00:59:51 +00:00
|
|
|
import WayofTime.bloodmagic.core.data.Binding;
|
2018-02-16 02:49:01 +00:00
|
|
|
import WayofTime.bloodmagic.item.ItemSigil;
|
2017-08-16 04:30:48 +00:00
|
|
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
2018-03-08 03:43:00 +00:00
|
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
2017-08-16 03:21:54 +00:00
|
|
|
import net.minecraft.client.util.ITooltipFlag;
|
2015-10-30 05:05:00 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
2017-08-16 03:21:54 +00:00
|
|
|
import net.minecraft.world.World;
|
2015-10-30 05:05:00 +00:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
|
2018-03-08 03:43:00 +00:00
|
|
|
import javax.annotation.Nonnull;
|
2017-08-16 04:30:48 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
2016-03-17 20:00:44 +00:00
|
|
|
|
2017-08-16 04:30:48 +00:00
|
|
|
public class ItemSigilBase extends ItemSigil implements IVariantProvider {
|
2018-02-28 00:59:51 +00:00
|
|
|
|
2015-11-29 02:25:46 +00:00
|
|
|
protected final String tooltipBase;
|
2015-10-30 05:05:00 +00:00
|
|
|
private final String name;
|
|
|
|
|
2017-08-16 04:30:48 +00:00
|
|
|
public ItemSigilBase(String name, int lpUsed) {
|
2016-03-23 01:10:05 +00:00
|
|
|
super(lpUsed);
|
2015-10-30 05:05:00 +00:00
|
|
|
|
2017-08-15 03:53:42 +00:00
|
|
|
setUnlocalizedName(BloodMagic.MODID + ".sigil." + name);
|
|
|
|
setCreativeTab(BloodMagic.TAB_BM);
|
2015-10-30 05:05:00 +00:00
|
|
|
|
|
|
|
this.name = name;
|
2017-01-02 09:18:29 +00:00
|
|
|
this.tooltipBase = "tooltip.bloodmagic.sigil." + name + ".";
|
2015-10-30 05:05:00 +00:00
|
|
|
}
|
|
|
|
|
2017-08-16 04:30:48 +00:00
|
|
|
public ItemSigilBase(String name) {
|
2015-10-30 05:05:00 +00:00
|
|
|
this(name, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
2017-08-16 04:30:48 +00:00
|
|
|
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
|
2016-03-21 05:55:03 +00:00
|
|
|
if (TextHelper.canTranslate(tooltipBase + "desc"))
|
2016-03-28 03:11:03 +00:00
|
|
|
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect(tooltipBase + "desc"))));
|
|
|
|
|
2016-09-07 01:55:32 +00:00
|
|
|
if (!stack.hasTagCompound())
|
|
|
|
return;
|
2016-03-28 03:11:03 +00:00
|
|
|
|
2018-02-28 00:59:51 +00:00
|
|
|
Binding binding = getBinding(stack);
|
|
|
|
if (binding != null)
|
|
|
|
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.currentOwner", binding.getOwnerName()));
|
2015-10-30 05:05:00 +00:00
|
|
|
|
2017-08-16 03:21:54 +00:00
|
|
|
super.addInformation(stack, world, tooltip, flag);
|
2015-10-30 05:05:00 +00:00
|
|
|
}
|
|
|
|
|
2016-03-16 08:10:33 +00:00
|
|
|
@Override
|
2018-03-08 03:43:00 +00:00
|
|
|
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
|
|
|
|
variants.put(0, "type=normal");
|
2016-03-16 08:10:33 +00:00
|
|
|
}
|
2017-08-16 03:21:54 +00:00
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
2015-10-30 05:05:00 +00:00
|
|
|
}
|