Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mrzorse.startrek.packets;
- import com.mrzorse.startrek.StarTrek;
- import com.mrzorse.startrek.api.weaponeffects.SimpleEffects;
- import com.mrzorse.startrek.blocks.BlockIngotFurnace;
- import com.mrzorse.startrek.blocks.BlockTransporterInterlock;
- import com.mrzorse.startrek.tileentity.tileentities.TileEntityTransportInterlock;
- import net.minecraft.block.Block;
- import net.minecraft.client.Minecraft;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.server.MinecraftServer;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.MathHelper;
- import net.minecraft.world.World;
- import cpw.mods.fml.common.network.simpleimpl.IMessage;
- import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
- import cpw.mods.fml.common.network.simpleimpl.MessageContext;
- public class TeleporterHandler implements IMessageHandler<TransporterPacket, IMessage> {
- private String bp;
- @Override
- public IMessage onMessage(TransporterPacket message, MessageContext ctx) {
- String command = message.text.toString();
- String[] finalcommand = command.split(" ");
- String playerName = finalcommand[1].toString();
- EntityPlayer playertp = ctx.getServerHandler().playerEntity.worldObj.getPlayerEntityByName(playerName);
- World world = ctx.getServerHandler().playerEntity.worldObj;
- if(finalcommand[0].equalsIgnoreCase("bts")){
- //command is: {{{ bts MrZorse betastation
- String tilexs2 = finalcommand[3];
- String tileys2 = finalcommand[4];
- String tilezs2 = finalcommand[5];
- int tilex2 = Integer.valueOf(tilexs2);
- int tiley2 = Integer.valueOf(tileys2);
- int tilez2 = Integer.valueOf(tilezs2);
- int r = 120;
- boolean finished = false;
- for(int x1 = -r; x1 < r && !finished; x1++){
- for(int y1 = -r; y1 < r && !finished; y1++){
- for(int z1 = -r; z1 < r; z1++){
- double dist = MathHelper.sqrt_double((x1*x1 + y1*y1 + z1*z1)); //Calculates the distance
- if(dist > r)
- continue;
- Block blockatcords = world.getBlock(tilex2+x1, tiley2+y1, tilez2+z1);
- if(blockatcords==StarTrek.blockTransporterInterlock){
- int blocktilex = tilex2 + x1;
- int blocktiley = tiley2 + y1;
- int blocktilez = tilez2+ z1;
- TileEntityTransportInterlock tinterlock = (TileEntityTransportInterlock) world.getTileEntity(blocktilex, blocktiley, blocktilez);
- System.out.println(tinterlock.id);
- x1=r;
- y1=r;
- z1=r;
- }
- }
- }
- }
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement