Mixin correction

This commit is contained in:
paulevsGitch 2021-03-19 20:51:13 +03:00
parent 836cac6f7e
commit 72113034ea
7 changed files with 8 additions and 8 deletions

View file

@ -28,20 +28,20 @@ public class EndArmorItem extends ArmorItem implements Patterned {
return;
}
Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers = accessor.getAttributeModifiers();
Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers = accessor.be_getAttributeModifiers();
// In case Mojang or anyone else decided to fix this
if (attributeModifiers.keys().contains(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE)) {
return;
}
UUID uuid = accessor.getModifiers()[slot.getEntitySlotId()];
UUID uuid = accessor.be_getModifiers()[slot.getEntitySlotId()];
// Rebuild attributeModifiers to include knockback resistance
ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
builder.putAll(attributeModifiers);
builder.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uuid, "Armor knockback resistance", knockbackResistance, EntityAttributeModifier.Operation.ADDITION));
accessor.setAttributeModifiers(builder.build());
accessor.be_setAttributeModifiers(builder.build());
}
@Override

View file

@ -12,11 +12,11 @@ import java.util.UUID;
@Mixin(ArmorItem.class)
public interface ArmorItemAccessor {
@Accessor("MODIFIERS")
UUID[] getModifiers();
UUID[] be_getModifiers();
@Accessor("attributeModifiers")
Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers();
Multimap<EntityAttribute, EntityAttributeModifier> be_getAttributeModifiers();
@Accessor("attributeModifiers")
void setAttributeModifiers(Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers);
void be_setAttributeModifiers(Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

View file

@ -4,7 +4,6 @@
"package": "ru.betterend.mixin.common",
"compatibilityLevel": "JAVA_8",
"mixins": [
"ArmorItemAccessor",
"EnchantmentScreenHandlerMixin",
"PlayerAdvancementTrackerMixin",
"CraftingScreenHandlerMixin",
@ -28,8 +27,9 @@
"PlayerManagerMixin",
"RecipeManagerMixin",
"HostileEntityMixin",
"LivingEntityMixin",
"ArmorItemAccessor",
"BoneMealItemMixin",
"LivingEntityMixin",
"PlayerEntityMixin",
"ServerWorldMixin",
"SlimeEntityMixin",