Improved the API and internal workings
Update things Fix some more things Update once more Refactoring and removing unnecessary null checks Woops Fix Nother fix Moar fix Fix imports Update ItemBindable.java
This commit is contained in:
parent
0a2dfb4fd4
commit
3e50dd4117
28 changed files with 389 additions and 340 deletions
|
@ -9,11 +9,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
@ -21,9 +17,8 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.DamageSourceBloodMagic;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerSacrificeHelper;
|
||||
|
||||
public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
|
||||
{
|
||||
|
@ -57,11 +52,11 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
|
|||
if (BloodMagicAPI.getEntitySacrificeValues().containsKey(entityName))
|
||||
lifeEssence = BloodMagicAPI.getEntitySacrificeValues().get(entityName);
|
||||
|
||||
if (findAndFillAltar(attacker.worldObj, target, lifeEssence))
|
||||
if (PlayerSacrificeHelper.findAndFillAltar(attacker.worldObj, target, lifeEssence))
|
||||
{
|
||||
target.worldObj.playSound(null, target.posX, target.posY, target.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (target.worldObj.rand.nextFloat() - target.worldObj.rand.nextFloat()) * 0.8F);
|
||||
target.setHealth(-1);
|
||||
target.onDeath(new DamageSourceBloodMagic());
|
||||
target.onDeath(BloodMagicAPI.getDamageSource());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -74,39 +69,4 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
|
|||
ret.add(new ImmutablePair<Integer, String>(0, "type=normal"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount)
|
||||
{
|
||||
IBloodAltar bloodAltar = findBloodAltar(world, sacrifice.getPosition());
|
||||
|
||||
if (bloodAltar != null)
|
||||
{
|
||||
bloodAltar.sacrificialDaggerCall(amount, true);
|
||||
bloodAltar.startCycle();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public IBloodAltar findBloodAltar(World world, BlockPos blockPos)
|
||||
{
|
||||
TileEntity tileEntity;
|
||||
|
||||
for (int i = -2; i <= 2; i++)
|
||||
{
|
||||
for (int j = -2; j <= 2; j++)
|
||||
{
|
||||
for (int k = -2; k <= 1; k++)
|
||||
{
|
||||
tileEntity = world.getTileEntity(blockPos.add(i, k, j));
|
||||
|
||||
if ((tileEntity instanceof IBloodAltar))
|
||||
return (IBloodAltar) tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue