Fixed it so the sentient bow actually shoots sentient arrows.
This commit is contained in:
parent
22a0343740
commit
9768909eb8
|
@ -18,7 +18,11 @@ import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderEntitySentientArrow extends Render<EntitySentientArrow>
|
||||
{
|
||||
private static final ResourceLocation arrowTextures = new ResourceLocation("bloodmagic:textures/entities/soulArrow.png");
|
||||
private static final ResourceLocation defaultTexture = new ResourceLocation("bloodmagic:textures/entities/soulArrow.png");
|
||||
private static final ResourceLocation corrosiveTexture = new ResourceLocation("bloodmagic:textures/entities/soulArrow_corrosive.png");
|
||||
private static final ResourceLocation vengefulTexture = new ResourceLocation("bloodmagic:textures/entities/soulArrow_vengeful.png");
|
||||
private static final ResourceLocation destructiveTexture = new ResourceLocation("bloodmagic:textures/entities/soulArrow_destructive.png");
|
||||
private static final ResourceLocation steadfastTexture = new ResourceLocation("bloodmagic:textures/entities/soulArrow_steadfast.png");
|
||||
|
||||
public RenderEntitySentientArrow(RenderManager renderManagerIn)
|
||||
{
|
||||
|
@ -95,6 +99,19 @@ public class RenderEntitySentientArrow extends Render<EntitySentientArrow>
|
|||
*/
|
||||
protected ResourceLocation getEntityTexture(EntitySentientArrow entity)
|
||||
{
|
||||
return arrowTextures;
|
||||
switch (entity.type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
return corrosiveTexture;
|
||||
case DESTRUCTIVE:
|
||||
return destructiveTexture;
|
||||
case STEADFAST:
|
||||
return steadfastTexture;
|
||||
case VENGEFUL:
|
||||
return vengefulTexture;
|
||||
case DEFAULT:
|
||||
default:
|
||||
return defaultTexture;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,12 +7,14 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
|
||||
public class EntitySentientArrow extends EntityArrow
|
||||
{
|
||||
public double reimbursedAmountOnHit = 0;
|
||||
public EnumDemonWillType type = EnumDemonWillType.DEFAULT;
|
||||
|
||||
public EntitySentientArrow(World worldIn)
|
||||
{
|
||||
|
@ -24,10 +26,11 @@ public class EntitySentientArrow extends EntityArrow
|
|||
super(worldIn, x, y, z);
|
||||
}
|
||||
|
||||
public EntitySentientArrow(World worldIn, EntityLivingBase shooter, double reimbursement)
|
||||
public EntitySentientArrow(World worldIn, EntityLivingBase shooter, EnumDemonWillType type)
|
||||
{
|
||||
this(worldIn, shooter.posX, shooter.posY, shooter.posZ);
|
||||
this.reimbursedAmountOnHit = reimbursement;
|
||||
super(worldIn, shooter);
|
||||
this.reimbursedAmountOnHit = 0;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void reimbursePlayer()
|
||||
|
@ -44,6 +47,7 @@ public class EntitySentientArrow extends EntityArrow
|
|||
super.writeEntityToNBT(tag);
|
||||
|
||||
tag.setDouble("reimbursement", reimbursedAmountOnHit);
|
||||
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,6 +56,7 @@ public class EntitySentientArrow extends EntityArrow
|
|||
super.readEntityFromNBT(tag);
|
||||
|
||||
reimbursedAmountOnHit = tag.getDouble("reimbursement");
|
||||
type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,6 +26,7 @@ import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
|||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
|
||||
public class ItemSentientBow extends ItemBow implements IMultiWillTool//, IMeshProvider
|
||||
|
@ -182,9 +183,12 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool//, IMeshP
|
|||
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
|
||||
//Need to do some stuffs
|
||||
ItemArrow itemarrow = ((ItemArrow) (itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.arrow));
|
||||
EntityArrow entityarrow = itemarrow.createArrow(worldIn, itemstack, entityplayer);
|
||||
entityarrow = new EntitySentientArrow(worldIn, entityLiving, type);
|
||||
entityarrow.func_184547_a(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F, arrowVelocity * 3.0F, 1.0F);
|
||||
|
||||
if (arrowVelocity == 1.0F)
|
||||
|
|
Loading…
Reference in a new issue