aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kubatech/commands/CommandCustomDrops.java
diff options
context:
space:
mode:
authorJakub <53441451+kuba6000@users.noreply.github.com>2023-06-15 17:53:16 +0200
committerGitHub <noreply@github.com>2023-06-15 17:53:16 +0200
commitcb383c824c3f799e678fb98f29661d79b5a13836 (patch)
treec27ec3672eb0cb1726565bf28ae2655404496231 /src/main/java/kubatech/commands/CommandCustomDrops.java
parentb2c2a6dfe91696d4ecada95e5e43806ddb144ece (diff)
downloadGT5-Unofficial-cb383c824c3f799e678fb98f29661d79b5a13836.tar.gz
GT5-Unofficial-cb383c824c3f799e678fb98f29661d79b5a13836.tar.bz2
GT5-Unofficial-cb383c824c3f799e678fb98f29661d79b5a13836.zip
Use mixins accessors + some misc fixes (#77)
* Change reflections to mixins * Wrap witchery checking * Remove more repeating code * hmm * test generation * test * client sided * Update CommandCustomDrops.java * Update MobRecipeLoader.java * Save to static variable * Imports * Log message * Convert InfernalHelper to mixin accessors * Update build.gradle * One more * Return class nodes to optimize * Translations mixin * Automatically add commands * Fixes * Fix https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/12021 * Update kubatech.java * Update CommonProxy.java * Unnecessary qualified reference * Simplify ItemUtils * Check if single player diffrently * Remove accessor for infernal-mobs
Diffstat (limited to 'src/main/java/kubatech/commands/CommandCustomDrops.java')
-rw-r--r--src/main/java/kubatech/commands/CommandCustomDrops.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/main/java/kubatech/commands/CommandCustomDrops.java b/src/main/java/kubatech/commands/CommandCustomDrops.java
new file mode 100644
index 0000000000..80148eb796
--- /dev/null
+++ b/src/main/java/kubatech/commands/CommandCustomDrops.java
@@ -0,0 +1,67 @@
+/*
+ * spotless:off
+ * KubaTech - Gregtech Addon
+ * Copyright (C) 2022 - 2023 kuba6000
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <https://www.gnu.org/licenses/>.
+ * spotless:on
+ */
+
+package kubatech.commands;
+
+import java.io.File;
+
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+import kubatech.api.utils.ModUtils;
+import kubatech.loaders.MobRecipeLoader;
+
+@CommandHandler.ChildCommand
+public class CommandCustomDrops extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "customdrops";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "customdrops";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 4;
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+
+ if (!ModUtils.isClientSided) {
+ p_71515_1_
+ .addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This command is single-player only!"));
+ return;
+ }
+
+ File f = MobRecipeLoader.makeCustomDrops();
+
+ if (f == null) {
+ p_71515_1_.addChatMessage(
+ new ChatComponentText(EnumChatFormatting.RED + "There was an error! Look in the console"));
+ } else p_71515_1_.addChatMessage(new ChatComponentText(f.getAbsolutePath()));
+ }
+}