aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bloodasp/galacticgreg/command
diff options
context:
space:
mode:
authorNotAPenguin <michiel.vandeginste@gmail.com>2024-09-02 23:17:17 +0200
committerGitHub <noreply@github.com>2024-09-02 23:17:17 +0200
commit1b820de08a05070909a267e17f033fcf58ac8710 (patch)
tree02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/bloodasp/galacticgreg/command
parentafd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff)
downloadGT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.gz
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.bz2
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.zip
The Great Renaming (#3014)
* move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names
Diffstat (limited to 'src/main/java/bloodasp/galacticgreg/command')
-rw-r--r--src/main/java/bloodasp/galacticgreg/command/AEStorageCommand.java180
-rw-r--r--src/main/java/bloodasp/galacticgreg/command/ProfilingCommand.java99
2 files changed, 0 insertions, 279 deletions
diff --git a/src/main/java/bloodasp/galacticgreg/command/AEStorageCommand.java b/src/main/java/bloodasp/galacticgreg/command/AEStorageCommand.java
deleted file mode 100644
index 6192603bcd..0000000000
--- a/src/main/java/bloodasp/galacticgreg/command/AEStorageCommand.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package bloodasp.galacticgreg.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.command.ICommand;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.World;
-
-import appeng.api.util.WorldCoord;
-import appeng.items.storage.ItemSpatialStorageCell;
-import bloodasp.galacticgreg.GalacticGreg;
-import bloodasp.galacticgreg.auxiliary.PlayerChatHelper;
-import bloodasp.galacticgreg.schematics.SpaceSchematic;
-import bloodasp.galacticgreg.schematics.SpaceSchematicFactory;
-
-/**
- * This command allows to export any structure that has been stored inside a spatial storage cell to a xml file that can
- * later be enabled for spawning in dimensions.
- */
-public class AEStorageCommand implements ICommand {
-
- private List<String> aliases;
-
- public AEStorageCommand() {
- this.aliases = new ArrayList<>();
- this.aliases.add("exportae");
- }
-
- @Override
- public String getCommandName() {
- return "exportae";
- }
-
- @Override
- public String getCommandUsage(ICommandSender pCommandSender) {
- return "exportae <structure name>";
- }
-
- @Override
- public List<String> getCommandAliases() {
- return this.aliases;
- }
-
- @Override
- public void processCommand(ICommandSender pCommandSender, String[] pArgs) {
- try {
- if (pCommandSender instanceof EntityPlayer) {
- if (pArgs.length < 1) return;
-
- String tName = pArgs[0];
-
- EntityPlayer tEP = (EntityPlayer) pCommandSender;
- // Check if item in hand is a spatial storage cell
- ItemStack tIS = tEP.inventory.getCurrentItem();
- if (tIS.getItem() instanceof ItemSpatialStorageCell) {
- ItemSpatialStorageCell tCell = (ItemSpatialStorageCell) tIS.getItem();
- World tSpatialWorld = tCell.getWorld(tIS);
- WorldCoord storedSize = tCell.getStoredSize(tIS);
-
- // Check if SSC is filled
- if (storedSize.x == 0 || storedSize.y == 0 || storedSize.z == 0) {
- PlayerChatHelper.SendError(pCommandSender, "Error: This spatial storage is empty");
- return;
- }
-
- // Export structure
- GalacticGreg.Logger.info(
- "Creating Structure from Spatial AE drive. Dimensions: X [%d] Y [%d] Z [%d]",
- storedSize.x,
- storedSize.y,
- storedSize.z);
- SpaceSchematic tSchematic = SpaceSchematicFactory.createSchematic(tName);
- boolean tTEWarningSend = false;
-
- // Loop all 3 dimensions
- for (int lX = 1; lX <= storedSize.x; lX++) {
- for (int lY = 65; lY < 65 + storedSize.y; lY++) {
- for (int lZ = 1; lZ <= storedSize.z; lZ++) {
-
- // Get the block
- Block b = tSpatialWorld.getBlock(lX, lY, lZ);
- // Get the meta
- int bm = tSpatialWorld.getBlockMetadata(lX, lY, lZ);
-
- // Search for the blocks name
- String tBlockName = Block.blockRegistry.getNameForObject(b);
-
- // Check if block is a tileentity
- TileEntity bTE = tSpatialWorld.getTileEntity(lX, lY, lZ);
-
- String tMsg = String.format("[X-%d][Y-%d][Z-%d] ", lX, lY, lZ);
- String nbtComp = "";
- // If block could be found...
- if (b != null) {
- tMsg += tBlockName;
- // If block is a TileEntity
- if (bTE != null) {
- // Print a warning on the console
- tMsg += " TE";
- GalacticGreg.Logger.warn(
- "Warning: Found TileEntity at X[%d] Y[%d] Z[%d]. NBT States are not exported!",
- lX,
- lY,
- lZ);
- if (!tTEWarningSend) {
- // Send a warning ingame, once per export command
- tTEWarningSend = true;
- PlayerChatHelper
- .SendWarn(pCommandSender, "TileEntity states are not exported!");
- }
-
- }
-
- // If the block is not air, add it to the structure
- if (b != Blocks.air) tSchematic
- .addStructureInfo(SpaceSchematicFactory.createStructureInfo(lX, lY, lZ, b, bm));
- }
- }
- }
- }
-
- // Save structure to disk
- if (!GalacticGreg.SchematicHandler.SaveSpaceStructure(tSchematic)) {
- // Something went wrong...
- PlayerChatHelper.SendError(pCommandSender, "Something went wrong. Structure not saved");
- } else {
- // All good, xml exported. Notify player that he needs to edit the file
- PlayerChatHelper.SendInfo(
- pCommandSender,
- "Structure has been exported to " + tSchematic.getName()
- + ".xml. It contains "
- + tSchematic.coordInfo()
- .size()
- + " Blocks");
- PlayerChatHelper
- .SendInfo(pCommandSender, "You have to edit the file before a reload will accept it!");
- }
- } else PlayerChatHelper
- .SendError(pCommandSender, "Error: Item in your hand is not a spatial storage drive!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public boolean canCommandSenderUseCommand(ICommandSender pCommandSender) {
- // Command is only enabled for actual players and only if they are OP-ed
- if (pCommandSender instanceof EntityPlayerMP) {
- EntityPlayerMP tEP = (EntityPlayerMP) pCommandSender;
- return MinecraftServer.getServer()
- .getConfigurationManager()
- .func_152596_g(tEP.getGameProfile());
- } else return false;
- }
-
- @Override
- public int compareTo(Object o) {
- return 0;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public List addTabCompletionOptions(ICommandSender p_71516_1_, String[] p_71516_2_) {
- return null;
- }
-
- @Override
- public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) {
- return false;
- }
-}
diff --git a/src/main/java/bloodasp/galacticgreg/command/ProfilingCommand.java b/src/main/java/bloodasp/galacticgreg/command/ProfilingCommand.java
deleted file mode 100644
index be43da5a4c..0000000000
--- a/src/main/java/bloodasp/galacticgreg/command/ProfilingCommand.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package bloodasp.galacticgreg.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.minecraft.command.ICommand;
-import net.minecraft.command.ICommandSender;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.ChatComponentText;
-
-import bloodasp.galacticgreg.GalacticGreg;
-import bloodasp.galacticgreg.api.ModContainer;
-import bloodasp.galacticgreg.api.ModDimensionDef;
-import bloodasp.galacticgreg.registry.GalacticGregRegistry;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.relauncher.Side;
-
-/**
- * Ingame command to get the average oregen time(s) for the active dimensions Doesn't need to be changed when adding new
- * planets/mods
- *
- */
-public class ProfilingCommand implements ICommand {
-
- private List<String> aliases;
-
- public ProfilingCommand() {
- this.aliases = new ArrayList<>();
- this.aliases.add("ggregprofiler");
- }
-
- @Override
- public String getCommandName() {
- return "ggregprofiler";
- }
-
- @Override
- public String getCommandUsage(ICommandSender pCommandSender) {
- return "ggregprofiler";
- }
-
- @Override
- public List<String> getCommandAliases() {
- return this.aliases;
- }
-
- @Override
- public void processCommand(ICommandSender pCommandSender, String[] pArgs) {
- pCommandSender.addChatMessage(new ChatComponentText("Average OreGen times:"));
-
- for (ModContainer mc : GalacticGregRegistry.getModContainers()) {
- String tModName = mc.getModName();
- for (ModDimensionDef mdd : mc.getDimensionList()) {
- long tTime = GalacticGreg.Profiler.GetAverageTime(mdd);
- String tInfo;
- if (tTime == -1) tInfo = "N/A";
- else tInfo = String.format("%d ms", tTime);
- pCommandSender.addChatMessage(
- new ChatComponentText(
- String.format("%s (%s): %s", mdd.getDimIdentifier(), mdd.getDimensionName(), tInfo)));
- }
- }
- }
-
- @Override
- public boolean canCommandSenderUseCommand(ICommandSender pCommandSender) {
- if (FMLCommonHandler.instance()
- .getEffectiveSide() == Side.SERVER
- && !FMLCommonHandler.instance()
- .getMinecraftServerInstance()
- .isDedicatedServer())
- return true;
-
- if (pCommandSender instanceof EntityPlayerMP) {
- EntityPlayerMP tEP = (EntityPlayerMP) pCommandSender;
- return MinecraftServer.getServer()
- .getConfigurationManager()
- .func_152596_g(tEP.getGameProfile());
- }
- return false;
- }
-
- @Override
- public int compareTo(Object o) {
- return 0;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public List addTabCompletionOptions(ICommandSender p_71516_1_, String[] p_71516_2_) {
- return null;
- }
-
- @Override
- public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) {
- return false;
- }
-}