diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
commit | cbe0e497be8e466c380a5b4fa781b314ede9ada3 (patch) | |
tree | b85848b432adf458e3abda466ee46d9dfc3e454b /src/Java/gtPlusPlus/core/commands/CommandMath.java | |
parent | c40416b036c0e89451e1558253ccf07bbee028d0 (diff) | |
download | GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.gz GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.bz2 GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.zip |
Revert "$ Cleaned up the entire project."
This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747.
# Conflicts:
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
Revert "% Cleaned up Imports."
This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966.
Diffstat (limited to 'src/Java/gtPlusPlus/core/commands/CommandMath.java')
-rw-r--r-- | src/Java/gtPlusPlus/core/commands/CommandMath.java | 235 |
1 files changed, 124 insertions, 111 deletions
diff --git a/src/Java/gtPlusPlus/core/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java index 97391f3c77..01091d84e3 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandMath.java +++ b/src/Java/gtPlusPlus/core/commands/CommandMath.java @@ -1,10 +1,11 @@ package gtPlusPlus.core.commands; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.PlayerUtils; + import java.util.ArrayList; import java.util.List; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.player.PlayerUtils; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; @@ -13,136 +14,117 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; -public class CommandMath implements ICommand { - private final List<String> aliases; - protected String fullEntityName; - protected Entity conjuredEntity; +public class CommandMath implements ICommand +{ + private final List<String> aliases; - public CommandMath() { - this.aliases = new ArrayList<String>(); + protected String fullEntityName; + protected Entity conjuredEntity; - this.aliases.add("hometele"); + public CommandMath() + { + aliases = new ArrayList<String>(); - this.aliases.add("warphome"); + aliases.add("hometele"); - } + aliases.add("warphome"); - @Override - public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2) { - // TODO Auto-generated method stub + } - return null; + @Override + public int compareTo(Object o) + { + return 0; - } + } - @Override - public boolean canCommandSenderUseCommand(final ICommandSender var1) { - return true; + @Override + public String getCommandName() + { + return "bed"; - } + } - @Override - public int compareTo(final Object o) { - return 0; + @Override + public String getCommandUsage(ICommandSender var1) + { + return "/bed [Teleports you to your bed for XP]"; - } + } - @Override - public List<String> getCommandAliases() { + @Override + public List<String> getCommandAliases() + { return this.aliases; - } - - @Override - public String getCommandName() { - return "bed"; - - } - - @Override - public String getCommandUsage(final ICommandSender var1) { - return "/bed [Teleports you to your bed for XP]"; - - } - - @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; - } + } - @Override - public void processCommand(final ICommandSender S, final String[] argString) { - final World W = S.getEntityWorld(); - final CommandUtils C = new CommandUtils(); - final EntityPlayer P = C.getPlayer(S); - // System.out.println(P.getCommandSenderName()); - // System.out.println(P.getDisplayName()); - if (W.isRemote) + public void processCommand(ICommandSender S, String[] argString) + { + World W = S.getEntityWorld(); + CommandUtils C = new CommandUtils(); + EntityPlayer P = C.getPlayer(S); + //System.out.println(P.getCommandSenderName()); + //System.out.println(P.getDisplayName()); + if (W.isRemote) - { + { - System.out.println("Not processing on Client side"); + System.out.println("Not processing on Client side"); - } + } - else + else - { + { - System.out.println("Processing on Server side - Home Teleport engaged by: " + P.getDisplayName()); + System.out.println("Processing on Server side - Home Teleport engaged by: "+P.getDisplayName()); - final int XP_TOTAL = P.experienceTotal; + int XP_TOTAL = P.experienceTotal; Utils.LOG_WARNING("Total Xp:" + XP_TOTAL); - final ChunkCoordinates X = P.getPlayerCoordinates(); - Utils.LOG_WARNING("Player Location: " + X); + ChunkCoordinates X = P.getPlayerCoordinates(); + Utils.LOG_WARNING("Player Location: "+X); ChunkCoordinates Y = null; - Utils.LOG_WARNING("Bed Location: " + Y); + Utils.LOG_WARNING("Bed Location: "+Y); try { - if (P.getBedLocation(0).equals(null)) { + if (P.getBedLocation(0).equals(null)){ Y = W.getSpawnPoint(); - Utils.LOG_WARNING("Spawn Location: " + Y); - } - else if (!P.getBedLocation(0).equals(null)) { + Utils.LOG_WARNING("Spawn Location: "+Y); + } + else if (!P.getBedLocation(0).equals(null)){ Y = P.getBedLocation(0); - Utils.LOG_WARNING("Bed Location: " + Y); + Utils.LOG_WARNING("Bed Location: "+Y); } else { Y = W.getSpawnPoint(); - Utils.LOG_WARNING("Spawn Location: " + Y); + Utils.LOG_WARNING("Spawn Location: "+Y); } } - catch (final NullPointerException e) { - PlayerUtils.messagePlayer(P, "You do not have a spawn, so..."); + catch(NullPointerException e) { + PlayerUtils.messagePlayer(P, "You do not have a spawn, so..."); } if (Y == null || Y.equals(null)) { Y = W.getSpawnPoint(); - Utils.LOG_WARNING("Spawn Location: " + Y); + Utils.LOG_WARNING("Spawn Location: "+Y); } - final int x1 = X.posX; - Utils.LOG_WARNING("X1: " + x1); - final int x2 = Y.posX; - Utils.LOG_WARNING("X2: " + x2); - final int y1 = X.posY; - Utils.LOG_WARNING("Y1: " + y1); - final int y2 = Y.posY; - Utils.LOG_WARNING("Y2: " + y2); - final int z1 = X.posZ; - Utils.LOG_WARNING("Z1: " + z1); - final int z2 = Y.posZ; - Utils.LOG_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)); + int x1 = X.posX; + Utils.LOG_WARNING("X1: "+x1); + int x2 = Y.posX; + Utils.LOG_WARNING("X2: "+x2); + int y1 = X.posY; + Utils.LOG_WARNING("Y1: "+y1); + int y2 = Y.posY; + Utils.LOG_WARNING("Y2: "+y2); + int z1 = X.posZ; + Utils.LOG_WARNING("Z1: "+z1); + int z2 = Y.posZ; + Utils.LOG_WARNING("Z2: "+z2); + + + double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); + String xpCost = String.valueOf((int)(d*0.15)); Utils.LOG_WARNING("d:" + d); Utils.LOG_WARNING("-----------------------------------------"); @@ -150,36 +132,34 @@ public class CommandMath implements ICommand { Utils.LOG_WARNING(String.valueOf(d)); Utils.LOG_WARNING("-----------------------------------------"); Utils.LOG_WARNING("Xp Cost based on answer B."); - Utils.LOG_WARNING(String.valueOf(d * 0.15) + " | " + String.valueOf(xpCost)); + Utils.LOG_WARNING(String.valueOf(d*0.15) + " | " + String.valueOf(xpCost)); Utils.LOG_WARNING("-----------------------------------------"); Utils.LOG_WARNING("Xp Total"); Utils.LOG_WARNING(String.valueOf(XP_TOTAL)); Utils.LOG_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); + + + if ((XP_TOTAL-Float.valueOf(xpCost)) > 0){ + EntityXPOrb E = new EntityXPOrb(W, P.posX, P.posY + 1.62D - (double) P.yOffset, P.posZ, 1); + //E.moveTowards((double) Y.posX + 0.5D, (int) Y.posY + 3, (double) Y.posZ + 0.5D); + E.setVelocity((double) Y.posX + 0.5D, (int) Y.posY + 0.1, (double) 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); + 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, "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."); + 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")) { + 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. :)"); + gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Something went wrong with the math, have this one on the house. :)"); } } @@ -188,6 +168,39 @@ public class CommandMath implements ICommand { } } + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender var1) + { + return true; + + } + + @Override + public List<?> addTabCompletionOptions(ICommandSender var1, String[] var2) + { + // TODO Auto-generated method stub + + return null; + + } + + @Override + public boolean isUsernameIndex(String[] var1, int var2) + { + // TODO Auto-generated method stub + + return false; + + } + + public boolean playerUsesCommand(World W, EntityPlayer P, int cost) + { + + + return true; } } + |