Sigils should draw LP from the bound network, not the user

(cherry picked from commit 082d2b8)
This commit is contained in:
Nicholas Ignoffo 2016-12-19 17:32:03 -08:00
parent 852d32f233
commit c46ed3e648
14 changed files with 14 additions and 18 deletions

View file

@ -65,7 +65,7 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
return (NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && onSigilUse(player.getHeldItem(hand), player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
return (NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()) && onSigilUse(player.getHeldItem(hand), 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)
@ -80,7 +80,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);
}

View file

@ -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)
{

View file

@ -73,7 +73,7 @@ public class SubCommandNetwork extends CommandBase
if (Utils.isInteger(args[2]))
{
int amount = Integer.parseInt(args[2]);
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, amount);
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, amount);
CommandBloodMagic.displaySuccessString(sender, "commands.network.syphon.success", amount, player.getDisplayName().getFormattedText());
} else
{

View file

@ -54,7 +54,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;

View file

@ -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;

View file

@ -50,7 +50,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(world, player, hand);
@ -60,7 +60,7 @@ public class ItemSigilBloodLight extends ItemSigilBase
if (!world.isRemote)
{
world.spawnEntity(new EntityBloodLight(world, player));
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLpUsed());
NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed());
}
resetCooldown(stack);
}

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -65,7 +65,7 @@ public class ItemSigilLava extends ItemSigilBase
return super.onItemRightClick(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(world, player, hand);
}
@ -96,7 +96,7 @@ public class ItemSigilLava extends ItemSigilBase
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
int amount = handler.fill(fluid, false);
if (amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
if (amount > 0 && NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage(player, getLpUsed()))
{
handler.fill(fluid, true);
return EnumActionResult.SUCCESS;

View file

@ -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;

View file

@ -106,7 +106,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);

View file

@ -102,7 +102,7 @@ public class ItemSigilVoid extends ItemSigilBase
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
FluidStack amount = handler.drain(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()))
{
handler.drain(1000, true);
return EnumActionResult.SUCCESS;
@ -118,7 +118,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;

View file

@ -62,7 +62,7 @@ public class ItemSigilWater extends ItemSigilBase
if (!player.canPlayerEdit(blockpos1, rayTrace.sideHit, stack))
return super.onItemRightClick(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(world, player, hand);
}
}