2016-01-08 22:20:31 -05:00
|
|
|
package WayofTime.bloodmagic.entity.projectile;
|
|
|
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.entity.projectile.EntityArrow;
|
2016-03-18 16:57:57 -04:00
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2016-01-08 22:20:31 -05:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.world.World;
|
2016-04-09 15:35:02 -04:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
2016-03-18 16:57:57 -04:00
|
|
|
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
|
|
|
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
2016-01-08 22:20:31 -05:00
|
|
|
|
2016-01-09 10:47:36 -05:00
|
|
|
public class EntitySentientArrow extends EntityArrow
|
2016-01-08 22:20:31 -05:00
|
|
|
{
|
|
|
|
public double reimbursedAmountOnHit = 0;
|
2016-04-09 15:35:02 -04:00
|
|
|
public EnumDemonWillType type = EnumDemonWillType.DEFAULT;
|
2016-01-08 22:20:31 -05:00
|
|
|
|
2016-01-09 10:47:36 -05:00
|
|
|
public EntitySentientArrow(World worldIn)
|
2016-01-08 22:20:31 -05:00
|
|
|
{
|
|
|
|
super(worldIn);
|
|
|
|
}
|
|
|
|
|
2016-01-09 10:47:36 -05:00
|
|
|
public EntitySentientArrow(World worldIn, double x, double y, double z)
|
2016-01-08 22:20:31 -05:00
|
|
|
{
|
|
|
|
super(worldIn, x, y, z);
|
|
|
|
}
|
|
|
|
|
2016-04-09 15:35:02 -04:00
|
|
|
public EntitySentientArrow(World worldIn, EntityLivingBase shooter, EnumDemonWillType type)
|
2016-01-08 22:20:31 -05:00
|
|
|
{
|
2016-04-09 15:35:02 -04:00
|
|
|
super(worldIn, shooter);
|
|
|
|
this.reimbursedAmountOnHit = 0;
|
|
|
|
this.type = type;
|
2016-01-08 22:20:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public void reimbursePlayer()
|
|
|
|
{
|
|
|
|
if (this.shootingEntity instanceof EntityPlayer)
|
|
|
|
{
|
2016-02-18 18:00:02 -05:00
|
|
|
PlayerDemonWillHandler.addDemonWill(EnumDemonWillType.DEFAULT, (EntityPlayer) this.shootingEntity, reimbursedAmountOnHit);
|
2016-01-08 22:20:31 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void writeEntityToNBT(NBTTagCompound tag)
|
|
|
|
{
|
|
|
|
super.writeEntityToNBT(tag);
|
|
|
|
|
|
|
|
tag.setDouble("reimbursement", reimbursedAmountOnHit);
|
2016-04-09 15:35:02 -04:00
|
|
|
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
|
2016-01-08 22:20:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void readEntityFromNBT(NBTTagCompound tag)
|
|
|
|
{
|
|
|
|
super.readEntityFromNBT(tag);
|
|
|
|
|
|
|
|
reimbursedAmountOnHit = tag.getDouble("reimbursement");
|
2016-04-09 15:35:02 -04:00
|
|
|
type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE));
|
2016-01-08 22:20:31 -05:00
|
|
|
}
|
2016-03-18 16:57:57 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected ItemStack getArrowStack()
|
|
|
|
{
|
|
|
|
return new ItemStack(Items.arrow);
|
|
|
|
}
|
2016-01-08 22:20:31 -05:00
|
|
|
}
|