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 /GuiTest/src/main/java | |
parent | 4a0360b555821cf4d2d3342540608f3361f6a0e7 (diff) | |
download | LibGui-486ca631fc2747adaad3268dfa1ec9ac16c5cd86.tar.gz LibGui-486ca631fc2747adaad3268dfa1ec9ac16c5cd86.tar.bz2 LibGui-486ca631fc2747adaad3268dfa1ec9ac16c5cd86.zip |
Palette work
Diffstat (limited to 'GuiTest/src/main/java')
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java | 28 |
1 files changed, 28 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!"); + } } } |