2015-12-30 17:24:40 -05:00
|
|
|
package WayofTime.bloodmagic.item;
|
|
|
|
|
2017-08-14 20:53:42 -07:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
2018-03-07 19:43:00 -08:00
|
|
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
2018-02-27 16:59:51 -08:00
|
|
|
import WayofTime.bloodmagic.core.data.Binding;
|
2018-08-07 18:27:12 -04:00
|
|
|
import WayofTime.bloodmagic.core.data.SoulTicket;
|
2018-02-15 18:49:01 -08:00
|
|
|
import WayofTime.bloodmagic.util.helper.NetworkHelper;
|
|
|
|
import WayofTime.bloodmagic.util.helper.PlayerHelper;
|
2018-03-07 19:43:00 -08:00
|
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
2015-12-31 20:10:57 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2016-03-18 16:50:33 -04:00
|
|
|
import net.minecraft.init.MobEffects;
|
2015-12-30 17:24:40 -05:00
|
|
|
import net.minecraft.item.ItemStack;
|
2015-12-31 20:47:01 -05:00
|
|
|
import net.minecraft.potion.PotionEffect;
|
2016-02-25 08:54:18 -05:00
|
|
|
|
2018-03-07 19:43:00 -08:00
|
|
|
import javax.annotation.Nonnull;
|
2018-02-27 16:59:51 -08:00
|
|
|
import javax.annotation.Nullable;
|
2016-03-18 16:50:33 -04:00
|
|
|
|
2018-08-07 18:27:12 -04:00
|
|
|
// TODO: Make some hook somewhere that attaches the pos to the ticket otherwise the tickets are basically useless lmao
|
2017-08-15 21:30:48 -07:00
|
|
|
public class ItemLavaCrystal extends ItemBindableBase implements IVariantProvider {
|
2018-02-27 16:59:51 -08:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public ItemLavaCrystal() {
|
2015-12-30 17:24:40 -05:00
|
|
|
super();
|
2017-08-14 20:53:42 -07:00
|
|
|
setUnlocalizedName(BloodMagic.MODID + ".lavaCrystal");
|
2015-12-30 17:24:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-02-27 16:59:51 -08:00
|
|
|
public ItemStack getContainerItem(ItemStack stack) {
|
|
|
|
Binding binding = getBinding(stack);
|
|
|
|
if (binding != null)
|
2018-08-07 18:27:12 -04:00
|
|
|
NetworkHelper.getSoulNetwork(binding.getOwnerId()).syphon(SoulTicket.item(stack, 25));
|
2018-02-17 10:38:33 -08:00
|
|
|
|
|
|
|
ItemStack returnStack = new ItemStack(this);
|
2018-02-27 16:59:51 -08:00
|
|
|
returnStack.setTagCompound(stack.getTagCompound());
|
2018-02-17 10:38:33 -08:00
|
|
|
return returnStack;
|
2015-12-30 17:24:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-02-27 16:59:51 -08:00
|
|
|
public boolean hasContainerItem(ItemStack stack) {
|
2015-12-30 17:24:40 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-14 20:53:42 -07:00
|
|
|
public int getItemBurnTime(ItemStack stack) {
|
2018-02-27 16:59:51 -08:00
|
|
|
Binding binding = getBinding(stack);
|
|
|
|
if (binding == null)
|
2017-08-14 20:53:42 -07:00
|
|
|
return -1;
|
2015-12-30 17:24:40 -05:00
|
|
|
|
2018-08-07 18:27:12 -04:00
|
|
|
if (NetworkHelper.syphonFromContainer(stack, SoulTicket.item(stack, 25)))
|
2017-08-14 20:53:42 -07:00
|
|
|
return 200;
|
|
|
|
else {
|
2018-02-27 16:59:51 -08:00
|
|
|
EntityPlayer player = PlayerHelper.getPlayerFromUUID(binding.getOwnerId());
|
2017-08-14 20:53:42 -07:00
|
|
|
if (player != null)
|
|
|
|
player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 99));
|
2015-12-30 17:24:40 -05:00
|
|
|
}
|
|
|
|
|
2017-08-14 20:53:42 -07:00
|
|
|
return -1;
|
2015-12-30 17:24:40 -05:00
|
|
|
}
|
2016-03-16 01:10:33 -07:00
|
|
|
|
2018-02-27 16:59:51 -08:00
|
|
|
@Nullable
|
2018-02-17 10:38:33 -08:00
|
|
|
@Override
|
2018-02-27 16:59:51 -08:00
|
|
|
public Binding getBinding(ItemStack stack) {
|
|
|
|
return Binding.fromStack(stack);
|
2018-02-17 10:38:33 -08:00
|
|
|
}
|
|
|
|
|
2016-03-16 01:10:33 -07:00
|
|
|
@Override
|
2018-03-07 19:43:00 -08:00
|
|
|
public void gatherVariants(@Nonnull Int2ObjectMap<String> variants) {
|
|
|
|
variants.put(0, "type=normal");
|
2016-03-16 01:10:33 -07:00
|
|
|
}
|
2015-12-30 17:24:40 -05:00
|
|
|
}
|