aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java28
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/style/StyleEntry.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/data/Color.java30
3 files changed, 66 insertions, 0 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
index 2e35a55..99c5b07 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
@@ -1,7 +1,14 @@
package io.github.cottonmc.test;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Optional;
+
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
+import net.fabricmc.loader.api.FabricLoader;
+import net.fabricmc.loader.api.ModContainer;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.container.BlockContext;
import net.minecraft.entity.player.PlayerEntity;
@@ -33,6 +40,27 @@ public class LibGuiTest implements ModInitializer {
ContainerProviderRegistry.INSTANCE.registerFactory(new Identifier(MODID, "gui"), (int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf)->{
return new TestContainer(syncId, player.inventory, BlockContext.create(player.getEntityWorld(), buf.readBlockPos()));
});
+
+ Optional<ModContainer> containerOpt = FabricLoader.getInstance().getModContainer("jankson");
+ if (containerOpt.isPresent()) {
+ ModContainer jankson = containerOpt.get();
+ System.out.println("Jankson root path: "+jankson.getRootPath());
+ try {
+ Files.list(jankson.getRootPath()).forEach((path)->{
+ path.getFileSystem().getFileStores().forEach((store)->{
+ System.out.println(" Filestore: "+store.name());
+ });
+ System.out.println(" "+path.toAbsolutePath());
+ });
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ Path modJson = jankson.getPath("/fabric.mod.json");
+ System.out.println("Jankson fabric.mod.json path: "+modJson);
+ System.out.println(Files.exists(modJson) ? "Exists" : "Does Not Exist");
+ } else {
+ System.out.println("Container isn't present!");
+ }
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/style/StyleEntry.java b/src/main/java/io/github/cottonmc/cotton/gui/style/StyleEntry.java
index 0af23ad..e7318a7 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/style/StyleEntry.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/style/StyleEntry.java
@@ -2,8 +2,16 @@ package io.github.cottonmc.cotton.gui.style;
import java.util.HashMap;
+import io.github.cottonmc.cotton.gui.widget.data.Color;
+
public class StyleEntry {
+ private String selector = "*";
private HashMap<String, String> customEntries = new HashMap<>();
+ private Color foreground;
+ private Color background;
+ public Color getForeground() {
+ return (foreground!=null) ? foreground : Color.WHITE;
+ }
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/data/Color.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/data/Color.java
index bf6806a..ec40500 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/data/Color.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/data/Color.java
@@ -1,6 +1,36 @@
package io.github.cottonmc.cotton.gui.widget.data;
public interface Color {
+ public static final Color WHITE = rgb(0xFF_FFFFFF);
+ public static final Color BLACK = rgb(0xFF_000000);
+ public static final Color RED = rgb(0xFF_FF0000);
+ public static final Color GREEN = rgb(0xFF_00FF00);
+ public static final Color BLUE = rgb(0xFF_0000FF);
+
+ public static final Color WHITE_DYE = rgb(0xFF_F9FFFE);
+ public static final Color ORANGE_DYE = rgb(0xFF_F9801D);
+ public static final Color MAGENTA_DYE = rgb(0xFF_C74EBD);
+ public static final Color LIGHT_BLUE_DYE = rgb(0xFF_3AB3DA);
+ public static final Color YELLOW_DYE = rgb(0xFF_FED83D);
+ public static final Color LIME_DYE = rgb(0xFF_80C71F);
+ public static final Color PINK_DYE = rgb(0xFF_F38BAA);
+ public static final Color GRAY_DYE = rgb(0xFF_474F52);
+ public static final Color LIGHT_GRAY_DYE = rgb(0xFF_9D9D97);
+ public static final Color CYAN_DYE = rgb(0xFF_169C9C);
+ public static final Color PURPLE_DYE = rgb(0xFF_8932B8);
+ public static final Color BLUE_DYE = rgb(0xFF_3C44AA);
+ public static final Color BROWN_DYE = rgb(0xFF_835432);
+ public static final Color GREEN_DYE = rgb(0xFF_5E7C16);
+ public static final Color RED_DYE = rgb(0xFF_B02E26);
+ public static final Color BLACK_DYE = rgb(0xFF_1D1D21);
+
+ Color[] DYE_COLORS = {
+ WHITE_DYE, ORANGE_DYE, MAGENTA_DYE, LIGHT_BLUE_DYE,
+ YELLOW_DYE, LIME_DYE, PINK_DYE, GRAY_DYE,
+ LIGHT_GRAY_DYE, CYAN_DYE, PURPLE_DYE, BLUE_DYE,
+ BROWN_DYE, GREEN_DYE, RED_DYE, BLACK_DYE
+ };
+
/**
* Gets an ARGB integer representing this color in the sRGB colorspace.
*/