mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-19 11:25:21 +01:00
forgot version if for attribute fix
This commit is contained in:
parent
af1d2de9bf
commit
5e286c0e62
@ -3,6 +3,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.item;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.settings.groups.DebugSettings;
|
||||
import de.florianmichael.vialoadingbase.ViaLoadingBase;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
@ -47,12 +48,11 @@ public abstract class MixinItemStack {
|
||||
@SuppressWarnings({"InvalidInjectorMethodSignature", "MixinAnnotationTarget"})
|
||||
@ModifyVariable(method = "getAttributeModifiers", ordinal = 0, at = @At(value = "STORE", ordinal = 1))
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> modifyVariableGetAttributeModifiers(Multimap<EntityAttribute, EntityAttributeModifier> modifiers) {
|
||||
if (modifiers.isEmpty()) {
|
||||
return modifiers;
|
||||
}
|
||||
if (!DebugSettings.getClassWrapper().replaceAttributeModifiers.getValue() || modifiers.isEmpty()) return modifiers;
|
||||
|
||||
modifiers = HashMultimap.create(modifiers);
|
||||
modifiers.removeAll(EntityAttributes.GENERIC_ATTACK_DAMAGE);
|
||||
OptionalDouble defaultAttackDamage = protocolhack_getDefaultAttackDamage(getItem());
|
||||
OptionalDouble defaultAttackDamage = viafabricplus_getDefaultAttackDamage(getItem());
|
||||
if (defaultAttackDamage.isPresent()) {
|
||||
modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, new EntityAttributeModifier(Item.ATTACK_DAMAGE_MODIFIER_ID, "Weapon Modifier", defaultAttackDamage.getAsDouble(), EntityAttributeModifier.Operation.ADDITION));
|
||||
}
|
||||
@ -63,7 +63,7 @@ public abstract class MixinItemStack {
|
||||
}
|
||||
|
||||
@Unique
|
||||
private OptionalDouble protocolhack_getDefaultAttackDamage(Item item) {
|
||||
private OptionalDouble viafabricplus_getDefaultAttackDamage(Item item) {
|
||||
if (item instanceof ToolItem) {
|
||||
ToolMaterial material = ((ToolItem) item).getMaterial();
|
||||
int materialBonus;
|
||||
|
@ -26,6 +26,7 @@ public class DebugSettings extends SettingGroup {
|
||||
// 1.9 -> 1.8.x
|
||||
public final ProtocolSyncBooleanSetting removeCooldowns = new ProtocolSyncBooleanSetting(this, "Remove cooldowns", ProtocolRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final ProtocolSyncBooleanSetting sendIdlePacket = new ProtocolSyncBooleanSetting(this, "Send idle packet", new ProtocolRange(ProtocolVersion.v1_8, LegacyProtocolVersion.r1_3_1tor1_3_2));
|
||||
public final ProtocolSyncBooleanSetting replaceAttributeModifiers = new ProtocolSyncBooleanSetting(this, "Replace attribute modifiers", ProtocolRange.andOlder(ProtocolVersion.v1_8));
|
||||
|
||||
// 1.8.x -> 1.7.6
|
||||
public final ProtocolSyncBooleanSetting replaceSneaking = new ProtocolSyncBooleanSetting(this, "Replace sneaking", ProtocolRange.andOlder(ProtocolVersion.v1_7_6));
|
||||
|
Loading…
Reference in New Issue
Block a user