aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/commands/CommandDebugChunks.java152
-rw-r--r--src/Java/gtPlusPlus/core/commands/CommandMath.java145
2 files changed, 161 insertions, 136 deletions
diff --git a/src/Java/gtPlusPlus/core/commands/CommandDebugChunks.java b/src/Java/gtPlusPlus/core/commands/CommandDebugChunks.java
new file mode 100644
index 0000000000..8e86bcdcd6
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/commands/CommandDebugChunks.java
@@ -0,0 +1,152 @@
+package gtPlusPlus.core.commands;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.preloader.ChunkDebugger;
+import gtPlusPlus.preloader.asm.AsmConfig;
+
+
+public class CommandDebugChunks implements ICommand
+{
+ private final List<String> aliases;
+
+ protected String fullEntityName;
+ protected Entity conjuredEntity;
+
+ public CommandDebugChunks(){
+ this.aliases = new ArrayList<>();
+ aliases.add("debugchunks");
+ aliases.add("DC");
+ }
+
+ @Override
+ public int compareTo(final Object o){
+ return 0;
+
+ }
+
+ @Override
+ public String getCommandName(){
+ return "DebugChunks";
+
+ }
+
+ @Override
+ public String getCommandUsage(final ICommandSender var1){
+ return "/DebugChunks";
+
+ }
+
+ @Override
+ public List<String> getCommandAliases(){
+ return this.aliases;
+
+ }
+
+ @Override
+ public void processCommand(final ICommandSender S, final String[] argString){
+ Logger.INFO("Debug Command");
+
+ final World W = S.getEntityWorld();
+ final EntityPlayer P = CommandUtils.getPlayer(S);
+
+ if (!AsmConfig.enableChunkDebugging) {
+ PlayerUtils.messagePlayer(P, "Chunk Debugging is disabled.");
+ return;
+ }
+
+
+ Map<String, Integer> aTicketCounter = new LinkedHashMap<String, Integer>();
+ for (Pair<String, String> f : ChunkDebugger.mChunkTicketsMap.values()) {
+ String aMod = f.getKey();
+ String aDim = f.getValue();
+ if (aMod != null) {
+ if (aTicketCounter.containsKey(aMod)) {
+ int aModTicketCount = aTicketCounter.get(aMod);
+ aModTicketCount++;
+ aTicketCounter.put(aMod, aModTicketCount);
+ }
+ else {
+ aTicketCounter.put(aMod, 1);
+ }
+ }
+ }
+ if (aTicketCounter.isEmpty()) {
+ PlayerUtils.messagePlayer(P, "No forced chunk tickets active.");
+ }
+ for (String x : aTicketCounter.keySet()) {
+ PlayerUtils.messagePlayer(P, x+" has "+aTicketCounter.get(x)+" tickets active.");
+ }
+
+
+ Map<String, Integer> aChunkCounter = new LinkedHashMap<String, Integer>();
+ for (Pair<String, String> f : ChunkDebugger.mChunksLoadedByModsMap.values()) {
+ String aMod = f.getKey();
+ String aDim = f.getValue();
+ if (aMod == null) {
+ aMod = "Bad ModId";
+ }
+
+ if (aMod != null) {
+ //PlayerUtils.messagePlayer(P, aMod+" has "+aDim+" active.");
+ if (aChunkCounter.containsKey(aMod)) {
+ int aModTicketCount = aChunkCounter.get(aMod);
+ aModTicketCount = aModTicketCount + 1;
+ aChunkCounter.put(aMod, aModTicketCount);
+ Logger.INFO("Counting +1 for "+aMod+", total of "+aModTicketCount);
+ }
+ else {
+ aChunkCounter.put(aMod, 1);
+ Logger.INFO("Counting +1 for "+aMod);
+ }
+ }
+ }
+ if (aChunkCounter.isEmpty()) {
+ PlayerUtils.messagePlayer(P, "No chunks force loaded.");
+ }
+ for (String x : aChunkCounter.keySet()) {
+ PlayerUtils.messagePlayer(P, x+" has "+aChunkCounter.get(x)+" chunks active.");
+ }
+
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(final ICommandSender var1){
+ final EntityPlayer P = CommandUtils.getPlayer(var1);
+ if (P == null){
+ return false;
+ }
+ if (PlayerUtils.isPlayerOP(P)) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2){
+ return new ArrayList<>();
+ }
+
+ @Override
+ public boolean isUsernameIndex(final String[] var1, final int var2){
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java
index 8772af641b..5ccfb3397f 100644
--- a/src/Java/gtPlusPlus/core/commands/CommandMath.java
+++ b/src/Java/gtPlusPlus/core/commands/CommandMath.java
@@ -1,7 +1,9 @@
package gtPlusPlus.core.commands;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
@@ -10,7 +12,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.MiningUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.preloader.ChunkDebugger;
public class CommandMath implements ICommand
@@ -52,147 +58,14 @@ public class CommandMath implements ICommand
@Override
public void processCommand(final ICommandSender S, final String[] argString){
+ Logger.INFO("Debug Command");
final World W = S.getEntityWorld();
final EntityPlayer P = CommandUtils.getPlayer(S);
if (P.getDisplayName().equalsIgnoreCase("draknyte1")) {
Logger.INFO("[Bedrock Miner] OreType Scan");
MiningUtils.iterateAllOreTypes();
- }
+ }
- /*if (!W.isRemote && P != null){
- if (P.getDisplayName().toLowerCase().equals("draknyte1") || P.getCommandSenderName().toLowerCase().equals("draknyte1")) {
- String[] prefixes = new String[] {
- "ingot",
- "plate",
- "dust",
- "gearGt",
- "block",
- "ore"
- };
- String[] loots = new String[] {
- "Iron",
- "Iron",
- "Iron",
- "Copper",
- "Copper",
- "Copper",
- "Tin",
- "Mica",
- "Steel",
- "Steel",
- "Steel",
- "Invar",
- "Titanium",
- "Gold",
- "Silver",
- "Lead",
- "Aluminium"
- };
- AutoMap<EntityItem> itemEntities = new AutoMap<EntityItem>();
- for (String g : prefixes) {
- for (String s : loots) {
- itemEntities.put(new EntityItem(W, P.posX, P.posY, P.posZ, ItemUtils.getItemStackOfAmountFromOreDictNoBroken(g+s, 64)));
- }}
- for (EntityItem e : itemEntities.values()) {
- e.lifespan = 30000;
- }
-
- }
- }*/
-
- /*else
-
- {
-
- System.out.println("Processing on Server side - Home Teleport engaged by: "+P.getDisplayName());
-
- final int XP_TOTAL = P.experienceTotal;
- Logger.WARNING("Total Xp:" + XP_TOTAL);
- final ChunkCoordinates X = P.getPlayerCoordinates();
- Logger.WARNING("Player Location: "+X);
- ChunkCoordinates Y = null;
- Logger.WARNING("Bed Location: "+Y);
- try {
- if (P.getBedLocation(0) == null){
- Y = W.getSpawnPoint();
- Logger.WARNING("Spawn Location: "+Y);
- }
- else if (P.getBedLocation(0) != null){
- Y = P.getBedLocation(0);
- Logger.WARNING("Bed Location: "+Y);
- }
- else {
- Y = W.getSpawnPoint();
- Logger.WARNING("Spawn Location: "+Y);
- }
- }
- catch(final NullPointerException e) {
- PlayerUtils.messagePlayer(P, "You do not have a spawn, so...");
- }
- if (Y == null) {
- Y = W.getSpawnPoint();
- Logger.WARNING("Spawn Location: "+Y);
- }
-
- final int x1 = X.posX;
- Logger.WARNING("X1: "+x1);
- final int x2 = Y.posX;
- Logger.WARNING("X2: "+x2);
- final int y1 = X.posY;
- Logger.WARNING("Y1: "+y1);
- final int y2 = Y.posY;
- Logger.WARNING("Y2: "+y2);
- final int z1 = X.posZ;
- Logger.WARNING("Z1: "+z1);
- final int z2 = Y.posZ;
- Logger.WARNING("Z2: "+z2);
-
-
- final double d = Math.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))+((z2-z1)*(z2-z1)));
- final String xpCost = String.valueOf((int)(d*0.15));
-
- Logger.WARNING("d:" + d);
- Logger.WARNING("-----------------------------------------");
- Logger.WARNING("Actual math formulae");
- Logger.WARNING(String.valueOf(d));
- Logger.WARNING("-----------------------------------------");
- Logger.WARNING("Xp Cost based on answer B.");
- Logger.WARNING(String.valueOf(d*0.15) + " | " + String.valueOf(xpCost));
- Logger.WARNING("-----------------------------------------");
- Logger.WARNING("Xp Total");
- Logger.WARNING(String.valueOf(XP_TOTAL));
- Logger.WARNING("-----------------------------------------");
-
-
-
- if ((XP_TOTAL-Float.valueOf(xpCost)) > 0){
- final EntityXPOrb E = new EntityXPOrb(W, P.posX, (P.posY + 1.62D) - P.yOffset, P.posZ, 1);
- //E.moveTowards((double) Y.posX + 0.5D, (int) Y.posY + 3, (double) Y.posZ + 0.5D);
- E.setVelocity(Y.posX + 0.5D, Y.posY + 0.1, Y.posZ + 0.5D);
- W.spawnEntityInWorld(E);
- W.playAuxSFXAtEntity((EntityPlayer) null, 1002, (int) P.posX, (int) P.posY, (int) P.posZ, 0);
- P.setPositionAndUpdate(x2, y2+1, z2);
-
- //gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Movement | X:"+x2+" | Y:"+y2+" | Z:"+z2);
- gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Distance Traveled | "+String.valueOf((int)(d)) + " Blocks & " + xpCost + "xp");
- gregtech.api.util.GT_Utility.sendChatToPlayer(P, "You suddenly feel at home.");
- P.experienceTotal = (int) (XP_TOTAL-Float.valueOf(xpCost));
- if (!xpCost.equals("0") && (Float.valueOf(xpCost) > 0)){
- gregtech.api.util.GT_Utility.sendChatToPlayer(P, "...At the loss of "+xpCost+" xp.");
- }
- else if (xpCost.equals("0")){
- gregtech.api.util.GT_Utility.sendChatToPlayer(P, "...At the loss of very little xp.");
- }
- else {
- gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Something went wrong with the math, have this one on the house. :)");
- }
- }
-
- else {
- gregtech.api.util.GT_Utility.sendChatToPlayer(P, "You don't feel you're able to do this yet.");
- }
-
- }*/
}
@Override
@@ -201,7 +74,7 @@ public class CommandMath implements ICommand
if (P == null){
return false;
}
- if (P.getDisplayName().toLowerCase().equals("draknyte1") || P.getCommandSenderName().toLowerCase().equals("draknyte1")) {
+ if (P.getDisplayName().toLowerCase().equals("draknyte1") || P.getCommandSenderName().toLowerCase().equals("draknyte1") || CORE.DEVENV) {
return true;
}
return false;