Skip to content

Commit

Permalink
moved few code blocks around
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluboxer authored and kevinthegreat1 committed Sep 26, 2024
1 parent ea2ddd2 commit b961414
Showing 1 changed file with 36 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public class CorpseFinder {
private static final String PREFIX = "[Skyblocker Corpse Finder] ";
private static final Logger LOGGER = LoggerFactory.getLogger(CorpseFinder.class);
private static final Map<String, List<Corpse>> corpsesByType = new HashMap<>();
private static final Set<String> ITEM_IDS = Set.of(
"LAPIS_ARMOR_HELMET",
"ARMOR_OF_YOG_HELMET",
"MINERAL_HELMET",
"VANGUARD_HELMET"
);

@Init
public static void init() {
Expand Down Expand Up @@ -162,43 +168,6 @@ private static void setSeen(Corpse corpse) {
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("Click to share the location in chat!").formatted(Formatting.GREEN)))));
}

static class Corpse {
private final ArmorStandEntity entity;
private final Waypoint waypoint;
private boolean opened;
private boolean seen;
private long messageLastSent = 0;
private Formatting color = Formatting.YELLOW;
private float[] colors;
private String name;

Corpse(ArmorStandEntity entity, Waypoint waypoint, boolean opened) {
this.entity = entity;
this.waypoint = waypoint;
this.opened = opened;
this.seen = false;
this.color = getColor(entity);
this.colors = getColors(color);
this.name = getType(entity);
}
Corpse(ArmorStandEntity entity, Waypoint waypoint, boolean opened, Formatting color) {
this.entity = entity;
this.waypoint = waypoint;
this.opened = opened;
this.seen = false;
this.color = color;
this.colors = getColors(color);
this.name = getType(entity);
}
}

private static final Set<String> ITEM_IDS = Set.of(
"LAPIS_ARMOR_HELMET",
"ARMOR_OF_YOG_HELMET",
"MINERAL_HELMET",
"VANGUARD_HELMET"
);

static String getType(ArmorStandEntity entity) {
for (ItemStack stack : entity.getArmorItems()) {
String itemId = ItemUtils.getItemId(stack);
Expand Down Expand Up @@ -267,4 +236,34 @@ private static void parseCords(Text text) {
}
}
}

static class Corpse {
private final ArmorStandEntity entity;
private final Waypoint waypoint;
private boolean opened;
private boolean seen;
private long messageLastSent = 0;
private Formatting color = Formatting.YELLOW;
private float[] colors;
private String name;

Corpse(ArmorStandEntity entity, Waypoint waypoint, boolean opened) {
this.entity = entity;
this.waypoint = waypoint;
this.opened = opened;
this.seen = false;
this.color = getColor(entity);
this.colors = getColors(color);
this.name = getType(entity);
}
Corpse(ArmorStandEntity entity, Waypoint waypoint, boolean opened, Formatting color) {
this.entity = entity;
this.waypoint = waypoint;
this.opened = opened;
this.seen = false;
this.color = color;
this.colors = getColors(color);
this.name = getType(entity);
}
}
}

0 comments on commit b961414

Please sign in to comment.