aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2019-11-15 20:09:15 +0800
committershedaniel <daniel@shedaniel.me>2019-11-15 20:09:15 +0800
commitb7246fa0016888fd52c45f9c77df46f9d791e326 (patch)
treeca455d73ea2213ef6e5a62855834119715a13fe2 /src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java
parent5c34cd8dae4879e04fd825f423e0ddbf8480668e (diff)
downloadRoughlyEnoughItems-b7246fa0016888fd52c45f9c77df46f9d791e326.tar.gz
RoughlyEnoughItems-b7246fa0016888fd52c45f9c77df46f9d791e326.tar.bz2
RoughlyEnoughItems-b7246fa0016888fd52c45f9c77df46f9d791e326.zip
Using more of the API instead of the Impl
Diffstat (limited to 'src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java')
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java b/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java
index 0115104fb..63a8e3424 100644
--- a/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java
@@ -11,6 +11,7 @@ import io.netty.buffer.Unpooled;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.RoughlyEnoughItemsNetwork;
import me.shedaniel.rei.api.*;
+import me.shedaniel.rei.api.annotations.Internal;
import me.shedaniel.rei.gui.PreRecipeViewingScreen;
import me.shedaniel.rei.gui.RecipeViewingScreen;
import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
@@ -43,6 +44,8 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+@Deprecated
+@Internal
public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
public static ClientHelperImpl instance;
@@ -129,14 +132,14 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
@Override
public boolean isCheating() {
- return RoughlyEnoughItemsCore.getConfigManager().getConfig().isCheating();
+ return ConfigManager.getInstance().getConfig().isCheating();
}
@Override
public void setCheating(boolean cheating) {
- RoughlyEnoughItemsCore.getConfigManager().getConfig().setCheating(cheating);
+ ConfigManager.getInstance().getConfig().setCheating(cheating);
try {
- RoughlyEnoughItemsCore.getConfigManager().saveConfig();
+ ConfigManager.getInstance().saveConfig();
} catch (IOException | FiberException e) {
e.printStackTrace();
}
@@ -168,7 +171,7 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
if (identifier == null)
return false;
String tagMessage = cheatedStack.copy().getTag() != null && !cheatedStack.copy().getTag().isEmpty() ? cheatedStack.copy().getTag().asString() : "";
- String og = cheatedStack.getCount() == 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().getGiveCommand().replaceAll(" \\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().getGiveCommand();
+ String og = cheatedStack.getCount() == 1 ? ConfigManager.getInstance().getConfig().getGiveCommand().replaceAll(" \\{count}", "") : ConfigManager.getInstance().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()));
@@ -217,7 +220,7 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
@Override
public boolean executeViewAllRecipesFromCategory(Identifier category) {
Map<RecipeCategory<?>, List<RecipeDisplay>> map = Maps.newLinkedHashMap();
- Optional<RecipeCategory> any = RecipeHelper.getInstance().getAllCategories().stream().filter(c -> c.getIdentifier().equals(category)).findAny();
+ Optional<RecipeCategory<?>> any = RecipeHelper.getInstance().getAllCategories().stream().filter(c -> c.getIdentifier().equals(category)).findAny();
if (!any.isPresent())
return false;
RecipeCategory<?> recipeCategory = any.get();
@@ -231,7 +234,7 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
public boolean executeViewAllRecipesFromCategories(List<Identifier> categories) {
Map<RecipeCategory<?>, List<RecipeDisplay>> map = Maps.newLinkedHashMap();
for (Identifier category : categories) {
- Optional<RecipeCategory> any = RecipeHelper.getInstance().getAllCategories().stream().filter(c -> c.getIdentifier().equals(category)).findAny();
+ Optional<RecipeCategory<?>> any = RecipeHelper.getInstance().getAllCategories().stream().filter(c -> c.getIdentifier().equals(category)).findAny();
if (!any.isPresent())
continue;
RecipeCategory<?> recipeCategory = any.get();
@@ -245,9 +248,9 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
@Override
public void openRecipeViewingScreen(Map<RecipeCategory<?>, List<RecipeDisplay>> map) {
Screen screen = null;
- if (RoughlyEnoughItemsCore.getConfigManager().getConfig().getRecipeScreenType() == RecipeScreenType.VILLAGER)
+ if (ConfigManager.getInstance().getConfig().getRecipeScreenType() == RecipeScreenType.VILLAGER)
screen = new VillagerRecipeViewingScreen(map);
- else if (RoughlyEnoughItemsCore.getConfigManager().getConfig().getRecipeScreenType() == RecipeScreenType.UNSET)
+ else if (ConfigManager.getInstance().getConfig().getRecipeScreenType() == RecipeScreenType.UNSET)
screen = new PreRecipeViewingScreen(map);
else
screen = new RecipeViewingScreen(map);