OSDN Git Service

commonとsrc統合。電解機中途半端なので注意。
[chemicraft/chemicraft.git] / src / chemicraft / debug / CommandSetTile.java
diff --git a/src/chemicraft/debug/CommandSetTile.java b/src/chemicraft/debug/CommandSetTile.java
new file mode 100644 (file)
index 0000000..6f649fa
--- /dev/null
@@ -0,0 +1,45 @@
+package chemicraft.debug;
+
+import net.minecraft.block.Block;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public class CommandSetTile extends CommandBase {
+
+       @Override
+       public String getCommandName() {
+               return "setTile";
+       }
+
+       @Override
+       public void processCommand(ICommandSender var1, String[] var2) {
+               try{
+                       EntityPlayer player = (EntityPlayer)var1;
+                       World wolrd = player.worldObj;
+                       if(var2.length > 0){
+                               try{
+                                       if(Integer.parseInt(var2[0]) < 4096 && Block.blocksList[Integer.parseInt(var2[0])] != null || Integer.parseInt(var2[0]) == 0){
+                                               if(var2.length == 1){
+                                                       SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), Integer.parseInt(var2[1]), 12, 12);
+                                               }else if(var2.length > 2){
+                                                       SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), Integer.parseInt(var2[1]), Integer.parseInt(var2[2]), Integer.parseInt(var2[2]));
+                                               }else{
+                                                       SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), 0, 12, 12);
+                                               }
+                                       }else{
+                                               var1.sendChatToPlayer("\u00a7cBlockが存在しないか指定された数が4096を超えています。");
+                                       }
+                               }catch(NumberFormatException e){
+                                       var1.sendChatToPlayer("\u00a7c指定された文字は数値ではありません。");
+                               }
+                       }else{
+                               var1.sendChatToPlayer("\u00a7cBlockIDを指定してください。(Metadata, Sizeも可能)");
+                       }
+               }catch(ClassCastException e){
+
+               }
+       }
+
+}