Everything else except sigils

This commit is contained in:
Nicholas Ignoffo 2017-01-01 22:26:42 -08:00
parent 128b3d29b0
commit 51e10eaad2
46 changed files with 289 additions and 354 deletions

View file

@ -60,7 +60,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
} else
{
ItemStack itemstack = entityIn.getActiveItemStack();
return itemstack != null && itemstack.getItem() == ModItems.SENTIENT_BOW ? (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F;
return !itemstack.isEmpty() && itemstack.getItem() == ModItems.SENTIENT_BOW ? (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F;
}
}
});
@ -85,7 +85,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() ? true : super.getIsRepairable(toRepair, repair);
return ModItems.ITEM_DEMON_CRYSTAL == repair.getItem() || super.getIsRepairable(toRepair, repair);
}
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player)
@ -275,10 +275,11 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
ItemStack stack = player.getHeldItem(hand);
this.recalculatePowers(stack, world, player);
return super.onItemRightClick(stack, world, player, hand);
return super.onItemRightClick(world, player, hand);
}
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity)
@ -294,7 +295,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
double d0 = target.posX - user.posX;
double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityArrow.posY;
double d2 = target.posZ - user.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entityArrow.setThrowableHeading(d0, d1 + d3 * 0.05, d2, newArrowVelocity, 0);
if (newArrowVelocity == 0)
@ -405,16 +406,16 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
entityArrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
world.spawnEntityInWorld(entityArrow);
world.spawnEntity(entityArrow);
}
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + arrowVelocity * 0.5F);
if (!flag1)
{
--itemstack.stackSize;
itemstack.shrink(1);
if (itemstack.stackSize == 0)
if (itemstack.isEmpty())
{
player.inventory.deleteStack(itemstack);
}
@ -453,7 +454,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
@Override
public boolean spawnSentientEntityOnDrop(ItemStack droppedStack, EntityPlayer player)
{
World world = player.worldObj;
World world = player.getEntityWorld();
if (!world.isRemote)
{
this.recalculatePowers(droppedStack, world, player);
@ -469,7 +470,7 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
EntitySentientSpecter specterEntity = new EntitySentientSpecter(world);
specterEntity.setPosition(player.posX, player.posY, player.posZ);
world.spawnEntityInWorld(specterEntity);
world.spawnEntity(specterEntity);
specterEntity.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, droppedStack.copy());