From cb383c824c3f799e678fb98f29661d79b5a13836 Mon Sep 17 00:00:00 2001 From: Jakub <53441451+kuba6000@users.noreply.github.com> Date: Thu, 15 Jun 2023 17:53:16 +0200 Subject: 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 --- .../java/kubatech/commands/CommandCustomDrops.java | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/main/java/kubatech/commands/CommandCustomDrops.java (limited to 'src/main/java/kubatech/commands/CommandCustomDrops.java') 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 . + * 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())); + } +} -- cgit