OSDN Git Service

ed2709c31168e69d19ab097312b0751b8d3900f4
[chemicraft/chemicraft.git] / common / chemicraft / util / CommandSetTile.java
1 package chemicraft.util;
2
3 import net.minecraft.src.Block;
4 import net.minecraft.src.CommandBase;
5 import net.minecraft.src.EntityPlayer;
6 import net.minecraft.src.ICommandSender;
7 import net.minecraft.src.World;
8 import setBlockSupport.SetBlockSupport;
9
10 public class CommandSetTile extends CommandBase {
11
12         @Override
13         public String getCommandName() {
14                 return "setTile";
15         }
16
17         @Override
18         public void processCommand(ICommandSender var1, String[] var2) {
19                 try{
20                         EntityPlayer player = (EntityPlayer)var1;
21                         World wolrd = player.worldObj;
22                         if(var2.length > 0){
23                                 try{
24                                         if(Integer.parseInt(var2[0]) < 256){
25                                                 if(var2.length > 1){
26                                                         SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), Integer.parseInt(var2[1]), 12, 12);
27                                                 }else{
28                                                         SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), 0, 12, 12);
29                                                 }
30                                         }else{
31                                                 var1.sendChatToPlayer("Over 256 than the Block ID.");
32                                         }
33                                 }catch(NumberFormatException e){
34                                         var1.sendChatToPlayer("A given Character is not a number.");
35                                 }
36                         }else{
37                                 var1.sendChatToPlayer("Please specify the BlockID.(Optional have Metadata)");
38                         }
39                 }catch(ClassCastException e){
40
41                 }
42         }
43
44 }