forked from DaFuqs/Spectrum
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add trinkets dependency. Template items
- Loading branch information
Showing
13 changed files
with
204 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/de/dafuqs/spectrum/items/trinkets/BlueTearstoneRingItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package de.dafuqs.spectrum.items.trinkets; | ||
|
||
import com.google.common.collect.Multimap; | ||
import de.dafuqs.spectrum.SpectrumCommon; | ||
import dev.emi.trinkets.api.SlotAttributes; | ||
import dev.emi.trinkets.api.SlotReference; | ||
import dev.emi.trinkets.api.TrinketItem; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.attribute.EntityAttribute; | ||
import net.minecraft.entity.attribute.EntityAttributeModifier; | ||
import net.minecraft.entity.attribute.EntityAttributes; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.UUID; | ||
|
||
public class BlueTearstoneRingItem extends SpectrumTrinketItem { | ||
|
||
private final Identifier UNLOCK_IDENTIFIER = new Identifier(SpectrumCommon.MOD_ID, "midgame/spectrum_midgame"); | ||
|
||
public BlueTearstoneRingItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
protected Identifier getUnlockIdentifier() { | ||
return UNLOCK_IDENTIFIER; | ||
} | ||
|
||
public Multimap<EntityAttribute, EntityAttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, UUID uuid) { | ||
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = super.getModifiers(stack, slot, entity, uuid); | ||
|
||
// +25% movement speed | ||
modifiers.put(EntityAttributes.GENERIC_MOVEMENT_SPEED, new EntityAttributeModifier(uuid, "spectrum:movement_speed", 0.25, EntityAttributeModifier.Operation.MULTIPLY_TOTAL)); | ||
|
||
return modifiers; | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/de/dafuqs/spectrum/items/trinkets/RedTearstoneRingItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package de.dafuqs.spectrum.items.trinkets; | ||
|
||
import com.google.common.collect.Multimap; | ||
import de.dafuqs.spectrum.SpectrumCommon; | ||
import dev.emi.trinkets.api.SlotAttributes; | ||
import dev.emi.trinkets.api.SlotReference; | ||
import dev.emi.trinkets.api.TrinketItem; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.attribute.EntityAttribute; | ||
import net.minecraft.entity.attribute.EntityAttributeModifier; | ||
import net.minecraft.entity.attribute.EntityAttributes; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.UUID; | ||
|
||
public class RedTearstoneRingItem extends SpectrumTrinketItem { | ||
|
||
private final Identifier UNLOCK_IDENTIFIER = new Identifier(SpectrumCommon.MOD_ID, "midgame/spectrum_midgame"); | ||
|
||
public RedTearstoneRingItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
protected Identifier getUnlockIdentifier() { | ||
return UNLOCK_IDENTIFIER; | ||
} | ||
|
||
public Multimap<EntityAttribute, EntityAttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, UUID uuid) { | ||
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = super.getModifiers(stack, slot, entity, uuid); | ||
|
||
// +20% movement speed | ||
modifiers.put(EntityAttributes.GENERIC_MOVEMENT_SPEED, new EntityAttributeModifier(uuid, "spectrum:movement_speed", 0.2, EntityAttributeModifier.Operation.MULTIPLY_TOTAL)); | ||
|
||
return modifiers; | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/de/dafuqs/spectrum/items/trinkets/SpectrumTrinketItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.dafuqs.spectrum.items.trinkets; | ||
|
||
import de.dafuqs.spectrum.Support; | ||
import dev.emi.trinkets.api.SlotReference; | ||
import dev.emi.trinkets.api.TrinketItem; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Identifier; | ||
|
||
public abstract class SpectrumTrinketItem extends TrinketItem { | ||
|
||
public SpectrumTrinketItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public boolean canEquip(ItemStack stack, SlotReference slot, LivingEntity entity) { | ||
if(entity instanceof PlayerEntity playerEntity) { | ||
if(Support.hasAdvancement(playerEntity, getUnlockIdentifier())) { | ||
return super.canEquip(stack, slot, entity); | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
protected abstract Identifier getUnlockIdentifier(); | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/de/dafuqs/spectrum/items/trinkets/SpeedBootsItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package de.dafuqs.spectrum.items.trinkets; | ||
|
||
import com.google.common.collect.Multimap; | ||
import de.dafuqs.spectrum.SpectrumCommon; | ||
import dev.emi.trinkets.api.SlotReference; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.attribute.EntityAttribute; | ||
import net.minecraft.entity.attribute.EntityAttributeModifier; | ||
import net.minecraft.entity.attribute.EntityAttributes; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.UUID; | ||
|
||
public class SpeedBootsItem extends SpectrumTrinketItem { | ||
|
||
private final Identifier UNLOCK_IDENTIFIER = new Identifier(SpectrumCommon.MOD_ID, "midgame/spectrum_midgame"); | ||
|
||
public SpeedBootsItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
protected Identifier getUnlockIdentifier() { | ||
return UNLOCK_IDENTIFIER; | ||
} | ||
|
||
public Multimap<EntityAttribute, EntityAttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, UUID uuid) { | ||
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = super.getModifiers(stack, slot, entity, uuid); | ||
|
||
// +25% movement speed | ||
modifiers.put(EntityAttributes.GENERIC_MOVEMENT_SPEED, new EntityAttributeModifier(uuid, "spectrum:movement_speed", 0.25, EntityAttributeModifier.Operation.MULTIPLY_TOTAL)); | ||
|
||
return modifiers; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"entities": [ | ||
"player" | ||
], | ||
"slots": [ | ||
"feet/shoes", | ||
"hand/ring", | ||
"offhand/ring" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"spectrum:speed_boots" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"spectrum:red_tearstone_ring", | ||
"spectrum:blue_tearstone_ring" | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/data/trinkets/tags/items/offhand/ring.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"spectrum:red_tearstone_ring", | ||
"spectrum:blue_tearstone_ring" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters