Skip to content

Commit 6409f1a

Browse files
committed
Remove an offhand glove slot if one of the gloves is worn. Implements #686
1 parent 6bb125c commit 6409f1a

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/main/java/de/dafuqs/spectrum/items/trinkets/AetherGracedNectarGlovesItem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import java.util.*;
2020

21-
public class AetherGracedNectarGlovesItem extends AzureDikeTrinketItem implements SlotBackgroundEffectProvider {
21+
public class AetherGracedNectarGlovesItem extends AzureDikeTrinketItem implements SlotBackgroundEffectProvider, SingleSlotGlove {
2222

2323
public static final int HARMFUL_EFFECT_COST = 7;
2424
public static ResourceLocation MENTAL_PRESENCE_ATTRIBUTE_ID = SpectrumCommon.locate("nectar_gloves_sleep");
@@ -43,6 +43,7 @@ public void appendHoverText(ItemStack stack, TooltipContext context, List<Compon
4343
public Multimap<Holder<Attribute>, AttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, ResourceLocation slotIdentifier) {
4444
Multimap<Holder<Attribute>, AttributeModifier> modifiers = super.getModifiers(stack, slot, entity, slotIdentifier);
4545
modifiers.put(SpectrumEntityAttributes.MENTAL_PRESENCE, new AttributeModifier(MENTAL_PRESENCE_ATTRIBUTE_ID, -1F, AttributeModifier.Operation.ADD_VALUE));
46+
SingleSlotGlove.disableSecondGloveSlot(modifiers);
4647
return modifiers;
4748
}
4849

src/main/java/de/dafuqs/spectrum/items/trinkets/ExtraReachGlovesItem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import java.util.*;
1717

18-
public class ExtraReachGlovesItem extends InkDrainTrinketItem {
18+
public class ExtraReachGlovesItem extends InkDrainTrinketItem implements SingleSlotGlove {
1919

2020
public ExtraReachGlovesItem(Properties settings) {
2121
super(settings, SpectrumCommon.locate("unlocks/trinkets/gloves_of_dawns_grasp"), InkColors.LIGHT_BLUE);
@@ -41,6 +41,7 @@ public Multimap<Holder<Attribute>, AttributeModifier> getModifiers(ItemStack sta
4141
modifiers.put(Attributes.BLOCK_INTERACTION_RANGE, new AttributeModifier(BLOCK_INTERACTION_ATTRIBUTE_ID, extraReach, AttributeModifier.Operation.ADD_VALUE));
4242
modifiers.put(Attributes.ENTITY_INTERACTION_RANGE, new AttributeModifier(ENTITY_INTERACTION_ATTRIBUTE_ID, extraReach / 6, AttributeModifier.Operation.ADD_VALUE));
4343
}
44+
SingleSlotGlove.disableSecondGloveSlot(modifiers);
4445

4546
return modifiers;
4647
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package de.dafuqs.spectrum.items.trinkets;
2+
3+
import com.google.common.collect.*;
4+
import de.dafuqs.spectrum.*;
5+
import dev.emi.trinkets.api.*;
6+
import net.minecraft.core.*;
7+
import net.minecraft.world.entity.ai.attributes.*;
8+
9+
public interface SingleSlotGlove {
10+
11+
static void disableSecondGloveSlot(Multimap<Holder<Attribute>, AttributeModifier> modifiers) {
12+
SlotAttributes.addSlotModifier(modifiers, "offhand/glove", SpectrumCommon.locate("disable_offhand_glove"), -1, AttributeModifier.Operation.ADD_VALUE);
13+
}
14+
15+
}

0 commit comments

Comments
 (0)