|
@@ -17,6 +17,7 @@ import me.shedaniel.rei.api.RecipeHelper;
|
|
|
import me.shedaniel.rei.gui.PreRecipeViewingScreen;
|
|
|
import me.shedaniel.rei.gui.RecipeViewingScreen;
|
|
|
import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
|
|
|
+import net.fabricmc.api.ClientModInitializer;
|
|
|
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
|
|
|
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
|
|
import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl;
|
|
@@ -41,7 +42,7 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
-public class ClientHelperImpl implements ClientHelper {
|
|
|
+public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
|
|
|
|
|
|
public static ClientHelperImpl instance;
|
|
|
private final Identifier recipeKeybind = new Identifier("roughlyenoughitems", "recipe_keybind");
|
|
@@ -150,10 +151,10 @@ public class ClientHelperImpl implements ClientHelper {
|
|
|
Identifier identifier = Registry.ITEM.getId(cheatedStack.getItem());
|
|
|
String tagMessage = cheatedStack.copy().getTag() != null && !cheatedStack.copy().getTag().isEmpty() ? cheatedStack.copy().getTag().asString() : "";
|
|
|
String og = cheatedStack.getAmount() != 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand.replaceAll(" \\{count}", "").replaceAll("\\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand;
|
|
|
- String madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", tagMessage).replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));
|
|
|
+ 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.getAmount()));
|
|
|
if (madeUpCommand.length() > 256) {
|
|
|
- madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", "").replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));
|
|
|
- MinecraftClient.getInstance().player.addChatMessage(new TranslatableTextComponent("text.rei" + ".too_long_nbt"), false);
|
|
|
+ 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.getAmount()));
|
|
|
+ MinecraftClient.getInstance().player.addChatMessage(new TranslatableTextComponent("text.rei.too_long_nbt"), false);
|
|
|
}
|
|
|
MinecraftClient.getInstance().player.sendChatMessage(madeUpCommand);
|
|
|
return true;
|