Sigils should draw LP from the bound network, not the user
This commit is contained in:
parent
ae2ff03547
commit
082d2b8f4d
|
@ -64,7 +64,7 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return (NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && onSigilUse(stack, player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
return (NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()) && onSigilUse(stack, player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
public boolean onSigilUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
|
@ -79,7 +79,7 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
{
|
||||
if (entityIn.ticksExisted % 100 == 0)
|
||||
{
|
||||
if (!NetworkHelper.getSoulNetwork((EntityPlayerMP) entityIn).syphonAndDamage((EntityPlayer) entityIn, getLpUsed()))
|
||||
if (!NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage((EntityPlayer) entityIn, getLpUsed()))
|
||||
{
|
||||
setActivatedState(stack, false);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,9 @@ public class NetworkHelper
|
|||
* - Amount of LP to syphon
|
||||
*
|
||||
* @return - Whether the action should be performed.
|
||||
* @deprecated Use {@link #getSoulNetwork(EntityPlayer)} and {@link SoulNetwork#syphonAndDamage(EntityPlayer, int)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean syphonAndDamage(SoulNetwork soulNetwork, EntityPlayer user, int toSyphon)
|
||||
{
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class SubCommandNetwork extends SubCommandBase
|
|||
if (Utils.isInteger(args[2]))
|
||||
{
|
||||
int amount = Integer.parseInt(args[2]);
|
||||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, amount);
|
||||
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, amount);
|
||||
displaySuccessString(sender, "commands.network.syphon.success", amount, player.getDisplayName().getFormattedText());
|
||||
} else
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ItemSigilAir extends ItemSigilBase implements ISentientSwordEffectP
|
|||
if (!world.isRemote)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
this.setUnusable(stack, !NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()));
|
||||
this.setUnusable(stack, !NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()));
|
||||
|
||||
if (!unusable)
|
||||
player.fallDistance = 0;
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.impl.ItemSigil;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import com.google.common.base.Strings;
|
||||
import lombok.Getter;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ItemSigilBloodLight extends ItemSigilBase
|
|||
{
|
||||
world.setBlockState(blockPos, ModBlocks.BLOOD_LIGHT.getDefaultState());
|
||||
if (!world.isRemote)
|
||||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLpUsed());
|
||||
NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed());
|
||||
resetCooldown(stack);
|
||||
player.swingArm(hand);
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
|
@ -59,7 +59,7 @@ public class ItemSigilBloodLight extends ItemSigilBase
|
|||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityBloodLight(world, player));
|
||||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLpUsed());
|
||||
NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed());
|
||||
}
|
||||
resetCooldown(stack);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.registry.ModPotions;
|
||||
|
||||
public class ItemSigilEnderSeverance extends ItemSigilToggleableBase
|
||||
|
|
|
@ -6,8 +6,6 @@ import net.minecraft.block.IGrowable;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.registry.ModPotions;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraftforge.event.ForgeEventFactory;
|
|||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
|
||||
public class ItemSigilLava extends ItemSigilBase
|
||||
{
|
||||
|
@ -64,7 +63,7 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
return super.onItemRightClick(stack, world, player, hand);
|
||||
}
|
||||
|
||||
if (this.canPlaceLava(world, blockpos1) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceLava(world, blockpos1))
|
||||
if (this.canPlaceLava(world, blockpos1) && NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()) && this.tryPlaceLava(world, blockpos1))
|
||||
{
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ public class ItemSigilLava extends ItemSigilBase
|
|||
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
|
||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||
|
||||
if (amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
if (amount > 0 && NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).fill(side, fluid, true);
|
||||
return EnumActionResult.SUCCESS;
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.util.math.RayTraceResult;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.iface.IAltarReader;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class ItemSigilTransposition extends ItemSigilBase
|
|||
stack.getTagCompound().setByte(Constants.NBT.CONTAINED_BLOCK_META, metadata);
|
||||
stack.getTagCompound().setTag(Constants.NBT.CONTAINED_TILE_ENTITY, tileNBTTag);
|
||||
|
||||
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, cost);
|
||||
NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, cost);
|
||||
|
||||
world.removeTileEntity(blockPos);
|
||||
world.setBlockToAir(blockPos);
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraftforge.event.ForgeEventFactory;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
|
||||
public class ItemSigilVoid extends ItemSigilBase
|
||||
{
|
||||
|
@ -99,7 +98,7 @@ public class ItemSigilVoid extends ItemSigilBase
|
|||
{
|
||||
FluidStack amount = ((IFluidHandler) tile).drain(side, 1000, false);
|
||||
|
||||
if (amount != null && amount.amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
if (amount != null && amount.amount > 0 && NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()))
|
||||
{
|
||||
((IFluidHandler) tile).drain(side, 1000, true);
|
||||
return EnumActionResult.SUCCESS;
|
||||
|
@ -115,7 +114,7 @@ public class ItemSigilVoid extends ItemSigilBase
|
|||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (world.getBlockState(newPos).getBlock() instanceof IFluidBlock && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
if (world.getBlockState(newPos).getBlock() instanceof IFluidBlock && NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()))
|
||||
{
|
||||
world.setBlockToAir(newPos);
|
||||
return EnumActionResult.SUCCESS;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ItemSigilWater extends ItemSigilBase
|
|||
if (!player.canPlayerEdit(blockpos1, rayTrace.sideHit, stack))
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
|
||||
if (this.canPlaceWater(world, blockpos1) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceWater(world, blockpos1))
|
||||
if (this.canPlaceWater(world, blockpos1) && NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()) && this.tryPlaceWater(world, blockpos1))
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.registry.ModPotions;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSigilWhirlwind extends ItemSigilToggleableBase
|
||||
|
|
Loading…
Reference in a new issue