diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-08-08 16:53:46 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-08-08 16:53:46 +0800 |
| commit | 10fa4cea1da644efe5b3045d3159a3eebdb8c0a8 (patch) | |
| tree | 0e8f504b66391d6762d526c0e7cdd94c3cb6022f /src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java | |
| parent | 6464acb0a7fe98ab30f9419e6aa95bdd1e92bc74 (diff) | |
| download | RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.tar.gz RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.tar.bz2 RoughlyEnoughItems-10fa4cea1da644efe5b3045d3159a3eebdb8c0a8.zip | |
Using fiber as a config lib
Diffstat (limited to 'src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java index b05f5d15e..700a0ab97 100644 --- a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java @@ -18,6 +18,7 @@ import me.shedaniel.rei.gui.PreRecipeViewingScreen; import me.shedaniel.rei.gui.RecipeViewingScreen; import me.shedaniel.rei.gui.VillagerRecipeViewingScreen; import me.shedaniel.rei.gui.config.RecipeScreenType; +import me.zeroeightsix.fiber.exception.FiberException; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; @@ -124,15 +125,15 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { @Override public boolean isCheating() { - return RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating; + return RoughlyEnoughItemsCore.getConfigManager().getConfig().isCheating(); } @Override public void setCheating(boolean cheating) { - RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating = cheating; + RoughlyEnoughItemsCore.getConfigManager().getConfig().setCheating(cheating); try { RoughlyEnoughItemsCore.getConfigManager().saveConfig(); - } catch (IOException e) { + } catch (IOException | FiberException e) { e.printStackTrace(); } } @@ -158,7 +159,7 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { } else { Identifier identifier = Registry.ITEM.getId(cheatedStack.getItem()); String tagMessage = cheatedStack.copy().getTag() != null && !cheatedStack.copy().getTag().isEmpty() ? cheatedStack.copy().getTag().asString() : ""; - String og = cheatedStack.getCount() == 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand.replaceAll(" \\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand; + String og = cheatedStack.getCount() == 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().getGiveCommand().replaceAll(" \\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().getGiveCommand(); String madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_name}", identifier.getPath()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", tagMessage).replaceAll("\\{count}", String.valueOf(cheatedStack.getCount())); if (madeUpCommand.length() > 256) { madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_name}", identifier.getPath()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", "").replaceAll("\\{count}", String.valueOf(cheatedStack.getCount())); @@ -234,9 +235,9 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { @Override public void openRecipeViewingScreen(Map<RecipeCategory<?>, List<RecipeDisplay>> map) { - if (RoughlyEnoughItemsCore.getConfigManager().getConfig().screenType == RecipeScreenType.VILLAGER) + if (RoughlyEnoughItemsCore.getConfigManager().getConfig().getRecipeScreenType() == RecipeScreenType.VILLAGER) MinecraftClient.getInstance().openScreen(new VillagerRecipeViewingScreen(map)); - else if (RoughlyEnoughItemsCore.getConfigManager().getConfig().screenType == RecipeScreenType.UNSET) + else if (RoughlyEnoughItemsCore.getConfigManager().getConfig().getRecipeScreenType() == RecipeScreenType.UNSET) MinecraftClient.getInstance().openScreen(new PreRecipeViewingScreen(map)); else MinecraftClient.getInstance().openScreen(new RecipeViewingScreen(map)); |
