Advertisement
Guest User

Untitled

a guest
Sep 8th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.94 KB | None | 0 0
  1. package com.mrzorse.startrek.packets;
  2.  
  3. import com.mrzorse.startrek.StarTrek;
  4. import com.mrzorse.startrek.api.weaponeffects.SimpleEffects;
  5. import com.mrzorse.startrek.blocks.BlockIngotFurnace;
  6. import com.mrzorse.startrek.blocks.BlockTransporterInterlock;
  7. import com.mrzorse.startrek.tileentity.tileentities.TileEntityTransportInterlock;
  8.  
  9. import net.minecraft.block.Block;
  10. import net.minecraft.client.Minecraft;
  11. import net.minecraft.entity.player.EntityPlayer;
  12. import net.minecraft.nbt.NBTTagCompound;
  13. import net.minecraft.server.MinecraftServer;
  14. import net.minecraft.tileentity.TileEntity;
  15. import net.minecraft.util.MathHelper;
  16. import net.minecraft.world.World;
  17. import cpw.mods.fml.common.network.simpleimpl.IMessage;
  18. import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
  19. import cpw.mods.fml.common.network.simpleimpl.MessageContext;
  20.  
  21. public class TeleporterHandler implements IMessageHandler<TransporterPacket, IMessage> {
  22.     private String bp;
  23.    
  24.     @Override
  25.     public IMessage onMessage(TransporterPacket message, MessageContext ctx) {
  26.    
  27.         String command = message.text.toString();
  28.         String[] finalcommand = command.split(" ");
  29.         String playerName = finalcommand[1].toString();
  30.        
  31.        
  32.         EntityPlayer playertp = ctx.getServerHandler().playerEntity.worldObj.getPlayerEntityByName(playerName);
  33.         World world = ctx.getServerHandler().playerEntity.worldObj;
  34. if(finalcommand[0].equalsIgnoreCase("bts")){
  35.             //command is: {{{ bts MrZorse betastation
  36.             String tilexs2 = finalcommand[3];
  37.             String tileys2 = finalcommand[4];
  38.             String tilezs2 = finalcommand[5];
  39.             int tilex2 = Integer.valueOf(tilexs2);
  40.             int tiley2 = Integer.valueOf(tileys2);
  41.             int tilez2 = Integer.valueOf(tilezs2);
  42.             int r = 120;
  43.            
  44.             for(int x1 = -r; x1 < r; x1++){
  45.                 for(int y1 = -r; y1 < r; y1++){
  46.                         for(int z1 = -r; z1 < r; z1++){                                    
  47.                                 double dist = MathHelper.sqrt_double((x1*x1 + y1*y1 + z1*z1)); //Calculates the distance
  48.                                 if(dist > r)
  49.                                        
  50.                                         continue;
  51.                                        
  52.  
  53.                                 Block blockatcords = world.getBlock(tilex2+x1, tiley2+y1, tilez2+z1);
  54.                                 if(blockatcords==StarTrek.blockTransporterInterlock){
  55.                                     int blocktilex = tilex2 + x1;
  56.                                     int blocktiley = tiley2 + y1;
  57.                                     int blocktilez = tilez2+ z1;
  58.                                
  59.                                     TileEntityTransportInterlock tinterlock = (TileEntityTransportInterlock) world.getTileEntity(blocktilex, blocktiley, blocktilez);
  60.                                    
  61.                                     System.out.println(tinterlock.id);
  62.                                    
  63.                                 }
  64.                         }
  65.                 }
  66.             }
  67.         }
  68.        
  69.         return null;
  70.     }
  71.    
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement