Package net.minecraft.server

Examples of net.minecraft.server.MinecraftServer


    World world = server.worldServerForDimension(worldId);
    return world.getBlock(x, y, z);
  }

  static int getBlockMetaAt(String key) {
    MinecraftServer server = MinecraftServer.getServer();
    if(server == null)
      return 0;

    String[] tokens = key.split(":");
    int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
    World world = server.worldServerForDimension(worldId);
    return world.getBlockMetadata(x, y, z);
  }
View Full Code Here


        if(block == Blocks.piston_extension) {
          int meta = getBlockMetaAt(s);
          boolean sticky = (meta & 8) == 8;
          ForgeDirection dir = ForgeDirection.getOrientation(meta & ~8);

          MinecraftServer server = MinecraftServer.getServer();

          if(server != null && getTimeInCoords(s) == 0) {
            String newPos;

            {
              String[] tokens = s.split(":");
              int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
              World world = server.worldServerForDimension(worldId);
              world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.pistonRelay);
              newPos = getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
            }

            if(mappedPositions.containsKey(s)) {
              String pos = mappedPositions.get(s);
              String[] tokens = pos.split(":");
              int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
              World world = server.worldServerForDimension(worldId);

              Block srcBlock = world.getBlock(x, y, z);
              int srcMeta = world.getBlockMetadata(x, y, z);
              TileEntity tile = world.getTileEntity(x, y, z);
              Material mat = srcBlock.getMaterial();
View Full Code Here

      if(sender.getCommandSenderName().equals("@") && commandMappings.containsKey(cmdName)) {
         try {
            commandMappings.get(cmdName).processCommand(sender, args);
         } catch (CommandException ce) {
            // sends command error to opped creative players
            MinecraftServer mcServer = MinecraftServer.getServer();
            List<EntityPlayerMP> players =
               mcServer.getConfigurationManager().playerEntityList;
            for(EntityPlayerMP plr : players) {
               if(plr.canCommandSenderUseCommand(2, "") && plr.capabilities.isCreativeMode) {
                  String cmdErr = StatCollector.translateToLocalFormatted(ce.getMessage(), ce.getErrorOjbects());
                  plr.addChatMessage(EnumChatFormatting.RED + cmdErr);
               }
View Full Code Here

    this.prevRotationYaw = this.rotationYaw;
    int var2;

    if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) {
      this.worldObj.theProfiler.startSection("portal");
      MinecraftServer var1 = ((WorldServer)this.worldObj).getMinecraftServer();
      var2 = this.getMaxInPortalTime();

      if (this.inPortal) {
        if (var1.getAllowNether()) {
          if (this.ridingEntity == null && this.portalCounter++ >= var2) {
            this.portalCounter = var2;
            this.timeUntilPortal = this.getPortalCooldown();
            byte var3;
View Full Code Here

   * Teleports the entity to another dimension. Params: Dimension number to teleport to
   */
  public void travelToDimension(int par1) {
    if (!this.worldObj.isRemote && !this.isDead) {
      this.worldObj.theProfiler.startSection("changeDimension");
      MinecraftServer var2 = MinecraftServer.getServer();
      int var3 = this.dimension;
      WorldServer var4 = var2.worldServerForDimension(var3);
      WorldServer var5 = var2.worldServerForDimension(par1);
      this.dimension = par1;

      if (var3 == 1 && par1 == 1) {
        var5 = var2.worldServerForDimension(0);
        this.dimension = 0;
      }

      this.worldObj.removeEntity(this);
      this.isDead = false;
      this.worldObj.theProfiler.startSection("reposition");
      var2.getConfigurationManager().transferEntityToWorld(this, var3, var4, var5);
      this.worldObj.theProfiler.endStartSection("reloading");
      Entity var6 = EntityList.createEntityByName(EntityList.getEntityString(this), var5);

      if (var6 != null) {
        var6.copyDataFrom(this, true);
View Full Code Here

     * Applies the patch, if not already applied.
     * Call before using addTask or getTaskList().
     */
    public static void applyPatch() {

        MinecraftServer s = etc.getServer().getMCServer();
        try {
            s.k.getClass().getDeclaredField("IM_PATCH_APPLIED");
        } catch (SecurityException e) {
            throw new RuntimeException("unexpected error: cannot use reflection");
        } catch (NoSuchFieldException e) {
View Full Code Here

     * Retrieves the task list.
     */
    @SuppressWarnings("unchecked")
    public static CopyOnWriteArrayList<Runnable> getTaskList() {

        MinecraftServer s = etc.getServer().getMCServer();
        try {
            return (CopyOnWriteArrayList<Runnable>) s.k.getClass().getField("TASK_LIST").get(null);
        } catch (SecurityException e) {
            throw new RuntimeException("unexpected error: cannot use reflection");
        } catch (NoSuchFieldException e) {
View Full Code Here

   * @param cuboid - the AABB cuboid to send the packet in
   * @param dimId - the dimension the cuboid is in
   */
  public void sendToCuboid(IMessage message, AxisAlignedBB cuboid, int dimId)
  {
    MinecraftServer server = MinecraftServer.getServer();

    if(server != null && cuboid != null)
    {
      for(EntityPlayerMP player : (List<EntityPlayerMP>)server.getConfigurationManager().playerEntityList)
      {
        if(player.dimension == dimId && cuboid.isVecInside(Vec3.createVectorHelper(player.posX, player.posY, player.posZ)))
        {
          sendTo(message, player);
        }
View Full Code Here

    }
  }
 
  public void sendToReceivers(IMessage message, Range4D range)
  {
    MinecraftServer server = MinecraftServer.getServer();

    if(server != null)
    {
      for(EntityPlayerMP player : (List<EntityPlayerMP>)server.getConfigurationManager().playerEntityList)
      {
        if(player.dimension == range.dimensionId && Range4D.getChunkRange(player).intersects(range))
        {
          sendTo(message, player);
        }
View Full Code Here

            }
            break;
        case C_UPDATE_GEAR_SLOT:
            int subtype = (Integer) this.data.get(2);
            EntityPlayer gearDataPlayer = null;
            MinecraftServer server = MinecraftServer.getServer();

            if (server != null)
            {
                gearDataPlayer = PlayerUtil.getPlayerForUsernameVanilla(server, (String) this.data.get(0));
            }
View Full Code Here

TOP

Related Classes of net.minecraft.server.MinecraftServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.