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)
|
@SideOnly(Side.CLIENT)
|
||||||
public class RenderEntitySentientArrow extends Render<EntitySentientArrow>
|
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)
|
public RenderEntitySentientArrow(RenderManager renderManagerIn)
|
||||||
{
|
{
|
||||||
|
@ -95,6 +99,19 @@ public class RenderEntitySentientArrow extends Render<EntitySentientArrow>
|
||||||
*/
|
*/
|
||||||
protected ResourceLocation getEntityTexture(EntitySentientArrow entity)
|
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.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||||
|
|
||||||
public class EntitySentientArrow extends EntityArrow
|
public class EntitySentientArrow extends EntityArrow
|
||||||
{
|
{
|
||||||
public double reimbursedAmountOnHit = 0;
|
public double reimbursedAmountOnHit = 0;
|
||||||
|
public EnumDemonWillType type = EnumDemonWillType.DEFAULT;
|
||||||
|
|
||||||
public EntitySentientArrow(World worldIn)
|
public EntitySentientArrow(World worldIn)
|
||||||
{
|
{
|
||||||
|
@ -24,10 +26,11 @@ public class EntitySentientArrow extends EntityArrow
|
||||||
super(worldIn, x, y, z);
|
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);
|
super(worldIn, shooter);
|
||||||
this.reimbursedAmountOnHit = reimbursement;
|
this.reimbursedAmountOnHit = 0;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reimbursePlayer()
|
public void reimbursePlayer()
|
||||||
|
@ -44,6 +47,7 @@ public class EntitySentientArrow extends EntityArrow
|
||||||
super.writeEntityToNBT(tag);
|
super.writeEntityToNBT(tag);
|
||||||
|
|
||||||
tag.setDouble("reimbursement", reimbursedAmountOnHit);
|
tag.setDouble("reimbursement", reimbursedAmountOnHit);
|
||||||
|
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,6 +56,7 @@ public class EntitySentientArrow extends EntityArrow
|
||||||
super.readEntityFromNBT(tag);
|
super.readEntityFromNBT(tag);
|
||||||
|
|
||||||
reimbursedAmountOnHit = tag.getDouble("reimbursement");
|
reimbursedAmountOnHit = tag.getDouble("reimbursement");
|
||||||
|
type = EnumDemonWillType.valueOf(tag.getString(Constants.NBT.WILL_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,6 +26,7 @@ import WayofTime.bloodmagic.api.iface.IMultiWillTool;
|
||||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||||
|
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
|
||||||
import WayofTime.bloodmagic.registry.ModItems;
|
import WayofTime.bloodmagic.registry.ModItems;
|
||||||
|
|
||||||
public class ItemSentientBow extends ItemBow implements IMultiWillTool//, IMeshProvider
|
public class ItemSentientBow extends ItemBow implements IMultiWillTool//, IMeshProvider
|
||||||
|
@ -182,9 +183,12 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool//, IMeshP
|
||||||
|
|
||||||
if (!worldIn.isRemote)
|
if (!worldIn.isRemote)
|
||||||
{
|
{
|
||||||
|
EnumDemonWillType type = this.getCurrentType(stack);
|
||||||
|
|
||||||
//Need to do some stuffs
|
//Need to do some stuffs
|
||||||
ItemArrow itemarrow = ((ItemArrow) (itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.arrow));
|
ItemArrow itemarrow = ((ItemArrow) (itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.arrow));
|
||||||
EntityArrow entityarrow = itemarrow.createArrow(worldIn, itemstack, entityplayer);
|
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);
|
entityarrow.func_184547_a(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F, arrowVelocity * 3.0F, 1.0F);
|
||||||
|
|
||||||
if (arrowVelocity == 1.0F)
|
if (arrowVelocity == 1.0F)
|
||||||
|
|
Loading…
Reference in a new issue