Fixed many sigils using the wrong stack for their logic (#1102)
This is why you use custom methods for things like this instead of MC methods
This commit is contained in:
parent
41c2f37042
commit
216bdb2d2e
12 changed files with 55 additions and 1 deletions
|
@ -1,8 +1,12 @@
|
|||
package WayofTime.bloodmagic.api.iface;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Used for all {@link WayofTime.bloodmagic.api.impl.ItemSigil} <b>EXCEPT</b>
|
||||
* Sigils of Holdings.
|
||||
|
@ -12,4 +16,10 @@ public interface ISigil
|
|||
boolean performArrayEffect(World world, BlockPos pos);
|
||||
|
||||
boolean hasArrayEffect();
|
||||
|
||||
interface Holding
|
||||
{
|
||||
@Nonnull
|
||||
ItemStack getHeldItem(ItemStack holdingStack, EntityPlayer player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package WayofTime.bloodmagic.api.impl;
|
|||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IActivatable;
|
||||
import WayofTime.bloodmagic.api.iface.ISigil;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
|
@ -49,6 +50,8 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
|
@ -67,6 +70,8 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (Strings.isNullOrEmpty(getOwnerUUID(stack)) || player.isSneaking()) // Make sure Sigils are bound before handling. Also ignores while toggling state
|
||||
return EnumActionResult.PASS;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue