MedievalWeapons

MedievalWeapons

3M Downloads

Conflict with Fabric Shield Lib | 1.18.1

Opened this issue ยท 7 comments

commented

Mods used:
Medieval Weapons v1.1.7
Cloth Config API (Fabric) v6.1.48
Fabric API v0.46.2
Fabric Shield Lib v1.4.5

Issue: With Fabric Shield Lib installed alongside your mod, shields do not block melee attacks. There's a few shield mods that rely on FSL in order to load and function, which means people have to make a choice of whether to use your mod or the shield mods that rely on FSL.

Replication:

  1. Make a profile with the mods listed above, no need for other shield mods that use FSL but you can add them if you wish to see that it affects those too.
  2. Grab a vanilla shield and a zombie
  3. Let the zombie attack you while in survival and watch your health get hit despite blocking (shield loses durability to show it was used)

Notes: Not sure who's mod is the one breaking the other, but since the mods that depend on FSL worked after removing your mod, I though I'd post it here first. If needed, I can post it on their GitHub too.

commented

Yes i have the same bug

commented

I think something is wrong with this:

@Inject(method = "takeShieldHit", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;takeShieldHit(Lnet/minecraft/entity/LivingEntity;)V", shift = Shift.AFTER))
public void takeShieldHitMixin(LivingEntity attacker, CallbackInfo info) {
if (!(attacker.getMainHandStack().getItem() instanceof AxeItem)) {
PlayerEntity playerEntity = (PlayerEntity) (Object) this;
playerEntity.getItemCooldownManager().set(Items.SHIELD, ConfigInit.CONFIG.shield_blocking_cooldown);
playerEntity.clearActiveItem();
}

commented
gieees.mp4

A video of the issue

commented

@Inject(method = "takeShieldHit", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;takeShieldHit(Lnet/minecraft/entity/LivingEntity;)V", shift = Shift.AFTER))
public void takeShieldHitMixin(LivingEntity attacker, CallbackInfo info) {
if (!(attacker.getMainHandStack().getItem() instanceof AxeItem)) {
PlayerEntity playerEntity = (PlayerEntity) (Object) this;
playerEntity.getItemCooldownManager().set(Items.SHIELD, ConfigInit.CONFIG.shield_blocking_cooldown);
playerEntity.clearActiveItem();
}

Line 44 is causing the problem, it breaks every other shields, not just those added with shield api. Removing this mixin fixes the problem. Im not too sure what this mixin intended for.

commented

rikka0w0 there is a way to me to fix it for my modpack?

commented

Thanks!!!!

commented

It is used to balance shields :)
I fixed it with c0c69e0 and it can be disabled by setting the cooldown to 0 ticks