Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Annotate Outer Void items [skip ci] #3052

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © Wynntils 2022-2024.
* Copyright © Wynntils 2022-2025.
* This file is released under LGPLv3. See LICENSE for full license details.
*/
package com.wynntils.models.items;
Expand Down Expand Up @@ -28,6 +28,7 @@
import com.wynntils.models.items.annotators.game.MaterialAnnotator;
import com.wynntils.models.items.annotators.game.MiscAnnotator;
import com.wynntils.models.items.annotators.game.MultiHealthPotionAnnotator;
import com.wynntils.models.items.annotators.game.OuterVoidItemAnnotator;
import com.wynntils.models.items.annotators.game.PotionAnnotator;
import com.wynntils.models.items.annotators.game.PowderAnnotator;
import com.wynntils.models.items.annotators.game.RuneAnnotator;
Expand Down Expand Up @@ -66,6 +67,7 @@ public ItemModel() {
Handlers.Item.registerAnnotator(new CharmAnnotator());
Handlers.Item.registerAnnotator(new IngredientAnnotator());
Handlers.Item.registerAnnotator(new MaterialAnnotator());
Handlers.Item.registerAnnotator(new OuterVoidItemAnnotator());
Handlers.Item.registerAnnotator(new UnknownGearAnnotator());

// Then alphabetically
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright © Wynntils 2024-2025.
* This file is released under LGPLv3. See LICENSE for full license details.
*/
package com.wynntils.models.items.annotators.game;

import com.wynntils.core.text.StyledText;
import com.wynntils.handlers.item.GameItemAnnotator;
import com.wynntils.handlers.item.ItemAnnotation;
import com.wynntils.models.gear.type.GearTier;
import com.wynntils.models.items.items.game.OuterVoidItem;
import com.wynntils.utils.mc.LoreUtils;
import java.util.List;
import java.util.regex.Pattern;
import net.minecraft.world.item.ItemStack;

public class OuterVoidItemAnnotator implements GameItemAnnotator {
private static final Pattern OUTER_VOID_TAG = Pattern.compile(
"§#cc66bbff\uE060\uDAFF\uDFFF\uE043\uDAFF\uDFFF\uE037\uDAFF\uDFFF\uE034\uDAFF\uDFFF\uE061\uDAFF\uDFFF\uE03E\uDAFF\uDFFF\uE044\uDAFF\uDFFF\uE043\uDAFF\uDFFF\uE034\uDAFF\uDFFF\uE041\uDAFF\uDFFF\uE061\uDAFF\uDFFF\uE045\uDAFF\uDFFF\uE03E\uDAFF\uDFFF\uE038\uDAFF\uDFFF\uE033\uDAFF\uDFFF\uE062\uDAFF\uDFB0§f\uE013\uE007\uE004 \uE00E\uE014\uE013\uE004\uE011 \uE015\uE00E\uE008\uE003\uDB00\uDC02");

@Override
public ItemAnnotation getAnnotation(ItemStack itemStack, StyledText name) {
List<StyledText> lore = LoreUtils.getLore(itemStack);
if (lore.isEmpty()) return null;

if (lore.getFirst().matches(OUTER_VOID_TAG)) {
GearTier gearTier = GearTier.fromStyledText(name);

return new OuterVoidItem(gearTier);
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright © Wynntils 2024-2025.
* This file is released under LGPLv3. See LICENSE for full license details.
*/
package com.wynntils.models.items.items.game;

import com.wynntils.models.gear.type.GearTier;
import com.wynntils.models.items.properties.GearTierItemProperty;

public class OuterVoidItem extends GameItem implements GearTierItemProperty {
private final GearTier gearTier;

public OuterVoidItem(GearTier gearTier) {
this.gearTier = gearTier;
}

@Override
public GearTier getGearTier() {
return gearTier;
}

@Override
public String toString() {
return "OuterVoidItem{" + "gearTier=" + gearTier + '}';
}
}
Loading