diff options
author | Falkreon <falkreon@gmail.com> | 2019-09-22 10:46:44 -0500 |
---|---|---|
committer | Falkreon <falkreon@gmail.com> | 2019-09-22 10:46:49 -0500 |
commit | 486ca631fc2747adaad3268dfa1ec9ac16c5cd86 (patch) | |
tree | 43a5f6fcbeba81f0a9e9e0b7929513f5ad6349d5 | |
parent | 4a0360b555821cf4d2d3342540608f3361f6a0e7 (diff) | |
download | LibGui-486ca631fc2747adaad3268dfa1ec9ac16c5cd86.tar.gz LibGui-486ca631fc2747adaad3268dfa1ec9ac16c5cd86.tar.bz2 LibGui-486ca631fc2747adaad3268dfa1ec9ac16c5cd86.zip |
Palette work
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. */ |