-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
525 additions
and
31 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
4 changes: 2 additions & 2 deletions
4
src/main/generated/.cache/cabcb80d088276cffde41e74584028f1c00b99b8
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// 1.21.3 2024-11-17T23:09:20.9370947 cookies-mod/Language (en_us) | ||
9f18fc62d9f1688bfa5af6de8a9d7f91b600ea9c assets\cookies-mod\lang\en_us.json | ||
// 1.21.3 2024-11-18T21:50:02.348035 cookies-mod/Language (en_us) | ||
c4ccaf30006997855f4e249ad734e937b167f02f assets/cookies-mod/lang/en_us.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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/codes/cookies/mod/data/mining/crystal/CrystalStatus.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 codes.cookies.mod.data.mining.crystal; | ||
|
||
import com.mojang.serialization.Codec; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Formatting; | ||
import net.minecraft.util.StringIdentifiable; | ||
|
||
/** | ||
* All types of crystal status, and their display name. | ||
*/ | ||
@RequiredArgsConstructor | ||
@Getter | ||
public enum CrystalStatus implements StringIdentifiable { | ||
|
||
NOT_FOUND(Text.literal("✖ Not Placed").formatted(Formatting.RED)), | ||
FOUND(Text.literal("✔ Found").formatted(Formatting.GREEN)), | ||
PLACED(Text.literal("✔ Placed").formatted(Formatting.YELLOW)); | ||
|
||
public static final Codec<CrystalStatus> CODEC = StringIdentifiable.createCodec(CrystalStatus::values); | ||
private final Text text; | ||
|
||
public static CrystalStatus getCrystalStatusFromText(String text) { | ||
return switch (text) { | ||
case "✖ Not Placed", "✔ Found" -> FOUND; | ||
case "✔ Placed" -> PLACED; | ||
default -> NOT_FOUND; | ||
}; | ||
} | ||
|
||
@Override | ||
public String asString() { | ||
return name(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/codes/cookies/mod/data/mining/crystal/CrystalStatusData.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,46 @@ | ||
package codes.cookies.mod.data.mining.crystal; | ||
|
||
import codes.cookies.mod.utils.json.CodecJsonSerializable; | ||
import com.mojang.serialization.Codec; | ||
import org.slf4j.Logger; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Data about the different crystal types and their respective status. | ||
*/ | ||
public class CrystalStatusData implements CodecJsonSerializable<Map<CrystalType, CrystalStatus>> { | ||
private static final Codec<Map<CrystalType, CrystalStatus>> CODEC = Codec.unboundedMap(CrystalType.CODEC, CrystalStatus.CODEC); | ||
|
||
private final Map<CrystalType, CrystalStatus> map = new HashMap<>(); | ||
|
||
public CrystalStatus getStatus(CrystalType type) { | ||
return Objects.requireNonNullElse(map.get(type), CrystalStatus.NOT_FOUND); | ||
} | ||
|
||
public void setStatus(CrystalType type, CrystalStatus status) { | ||
map.put(type, Objects.requireNonNullElse(status, CrystalStatus.NOT_FOUND)); | ||
} | ||
|
||
@Override | ||
public Codec<Map<CrystalType, CrystalStatus>> getCodec() { | ||
return CODEC; | ||
} | ||
|
||
@Override | ||
public void load(Map<CrystalType, CrystalStatus> value) { | ||
map.putAll(value); | ||
} | ||
|
||
@Override | ||
public Map<CrystalType, CrystalStatus> getValue() { | ||
return map; | ||
} | ||
|
||
@Override | ||
public Logger getLogger() { | ||
return logger; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/codes/cookies/mod/data/mining/crystal/CrystalType.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,55 @@ | ||
package codes.cookies.mod.data.mining.crystal; | ||
|
||
import java.util.Optional; | ||
|
||
import codes.cookies.mod.utils.skyblock.playerlist.widgets.crystal.CrystalOrigin; | ||
import com.mojang.serialization.Codec; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
import net.minecraft.util.Formatting; | ||
import net.minecraft.util.StringIdentifiable; | ||
|
||
/** | ||
* All crystal types in the game plus their respective formatting. | ||
*/ | ||
@Getter | ||
@AllArgsConstructor | ||
public enum CrystalType implements StringIdentifiable { | ||
|
||
JADE(CrystalOrigin.CRYSTAL_HOLLOWS, Formatting.GREEN), | ||
AMBER(CrystalOrigin.CRYSTAL_HOLLOWS, Formatting.GOLD), | ||
AMETHYST(CrystalOrigin.CRYSTAL_HOLLOWS, Formatting.DARK_PURPLE), | ||
SAPPHIRE(CrystalOrigin.CRYSTAL_HOLLOWS, Formatting.AQUA), | ||
TOPAZ(CrystalOrigin.CRYSTAL_HOLLOWS, Formatting.YELLOW), | ||
JASPER(CrystalOrigin.MISC, Formatting.LIGHT_PURPLE), | ||
RUBY(CrystalOrigin.MISC, Formatting.RED), // Misc crystals | ||
OPAL(CrystalOrigin.CRIMSON_ISLE, Formatting.WHITE), // Crimson isle | ||
AQUAMARINE(CrystalOrigin.GLACITE_TUNNELS, Formatting.BLUE), | ||
PERIDOT(CrystalOrigin.GLACITE_TUNNELS, Formatting.DARK_GREEN), | ||
CITRINE(CrystalOrigin.GLACITE_TUNNELS, Formatting.DARK_RED), | ||
ONYX(CrystalOrigin.GLACITE_TUNNELS, Formatting.DARK_GRAY); // Tunnels | ||
|
||
public static final Codec<CrystalType> CODEC = StringIdentifiable.createCodec(CrystalType::values); | ||
private final CrystalOrigin crystalOrigin; | ||
private final Formatting formatting; | ||
|
||
public static Optional<CrystalType> getCrystalTypeByDisplayName(String displayName) { | ||
if (displayName == null) { | ||
return Optional.empty(); | ||
} | ||
|
||
for (CrystalType value : values()) { | ||
if (value.name().equalsIgnoreCase(displayName)) { | ||
return Optional.of(value); | ||
} | ||
} | ||
|
||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public String asString() { | ||
return name(); | ||
} | ||
} |
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
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
Oops, something went wrong.