Vampirism - Become a vampire!

Vampirism - Become a vampire!

16M Downloads

Shield prevents to use Altar of inspiration

LemADEC opened this issue ยท 8 comments

commented

As of Vampirism-1.10.2-1.1.0-alpha+03-06-19-21.jar, you can't level up using the Altar of inspiration while wearing a shield.

commented

Should not be that big a deal, since you can always un-equip the shield, but it might confuse new players, so I will try to fix that.

commented

I took a look, but I'm not sure what's the best way to fix this.

  1. I could remove the requirement to sneak to activate it. So simply right-clicking it with a bare hand would start it (might happen accidentally).
  2. It could check each PlayerInteractEvent to force bypass the shield action (dirty and CPU time consuming, but would keep everything like it is)

What do you think?

commented

Both sounds bad.
Can we just catch it at block level instead with on onBlockActivated()?

commented

The problem is that this is not called when the player is sneaking and holding an item in any hand (which does not bypass use when sneaking) :/

commented

yes, you need to allow the item to bypass the sneak usage, which is what it already does anyway ;).

commented

Looks like SneakBypass changed since 1.7.10, seems to unusable for us now.
I guess removing the sneak requirement is the best option here then.

commented

Not sure what you mean. As far as I can see OnActivated is only called if one of the following three conditions are fulfilled.

  1. The player is not sneaking.
  2. All held items have to doesSneakByPassUse (shields do not).
  3. Or the event force bypasses it (possible solution 2).
    Or did I miss something?
boolean bypass = true;
     for (ItemStack s : new ItemStack[]{player.getHeldItemMainhand(), player.getHeldItemOffhand()}) //TODO: Expand to more hands? player.inv.getHands()?
                bypass = bypass && (s == null || s.getItem().doesSneakBypassUse(s, worldIn, pos, player));
            EnumActionResult result = EnumActionResult.PASS;

     if (!player.isSneaking() || bypass || event.getUseBlock() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW)
    //onBlockActivated

net.minecraft.server.management.PlayerInteractionManager#processRightClickBlock @Forge1.10.2-12.18.3.2185

commented

As of Version 1.2, sneak right click is no longer required.
Rightclicking any altar with an empty hand will try to start the ritual