Package net.minecraft.world

Examples of net.minecraft.world.WorldServer


  public static void sendChunk(Chunk c, int verticalBits)
  {
    try
    {
      WorldServer ws = (WorldServer) c.worldObj;
      PlayerManager pm = ws.getPlayerManager();

      if ( getOrCreateChunkWatcher == null )
      {
        getOrCreateChunkWatcher = ReflectionHelper.findMethod( PlayerManager.class, pm, new String[] { "getOrCreateChunkWatcher", "func_72690_a" },
            int.class, int.class, boolean.class );
View Full Code Here


    if ( isAccepting() && proxy.isActive() )
    {
      try
      {
        TileEntity te = getTile();
        WorldServer w = (WorldServer) te.getWorldObj();

        int x = te.xCoord + side.offsetX;
        int y = te.yCoord + side.offsetY;
        int z = te.zCoord + side.offsetZ;

        Block blk = w.getBlock( x, y, z );

        IStorageGrid storage = proxy.getStorage();
        IEnergyGrid energy = proxy.getEnergy();

        Material mat = blk.getMaterial();
        boolean ignore = mat == Material.air || mat == Material.lava || mat == Material.water || mat.isLiquid() || blk == Blocks.bedrock
            || blk == Blocks.end_portal || blk == Blocks.end_portal_frame || blk == Blocks.command_block;

        if ( !ignore )
        {
          if ( !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) )
          {
            float hardness = blk.getBlockHardness( w, x, y, z );
            if ( hardness >= 0.0 )
            {
              ItemStack[] out = Platform.getBlockDrops( w, x, y, z );
              float total = 1 + hardness;
              for (ItemStack is : out)
                total += is.stackSize;

              boolean hasPower = energy.extractAEPower( total, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > total - 0.1;
              if ( hasPower )
              {
                if ( eatForReal )
                {
                  energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
                  w.setBlock( x, y, z, Platform.air, 0, 3 );

                  AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
                  for (Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ))
                  {
                    if ( ei instanceof EntityItem )
                    {
                      EntityItem item = (EntityItem) ei;
                      if ( !item.isDead )
View Full Code Here

    private PacketBuilder() {
    }

    public void sendTileEntityPacket(RailcraftTileEntity tile) {
        if (tile.getWorldObj() instanceof WorldServer) {
            WorldServer world = (WorldServer) tile.getWorldObj();
            PacketTileEntity pkt = new PacketTileEntity(tile);
            PacketDispatcher.sendToWatchers(pkt, world, tile.xCoord, tile.zCoord);
        }
    }
View Full Code Here

            player.addChatMessage(getLocalizedMessage(msg, args));
    }

    public static void sendLocalizedChatToAllFromServer(World world, String msg, Object... args) {
        if (world instanceof WorldServer) {
            WorldServer worldServer = (WorldServer) world;
            for (Object obj : worldServer.playerEntities) {
                if (obj instanceof EntityPlayer)
                    sendLocalizedChat((EntityPlayer) obj, msg, args);
            }
        }
View Full Code Here

    return a * a;
  }

  @Declare
  public static void sendPacketAroundPlayer(EntityPlayerMP player, Packet packet, int squaredDistance) {
    WorldServer worldServer = ((WorldServer) player.worldObj);
    int cX = player.chunkCoordX;
    int cZ = player.chunkCoordZ;
    for (EntityPlayerMP entityPlayerMP : (Iterable<EntityPlayerMP>) worldServer.playerEntities) {
      if (entityPlayerMP != player && (square((entityPlayerMP.chunkCoordX - cX) << 4) + square((entityPlayerMP.chunkCoordZ - cZ) << 4)) < squaredDistance) {
        entityPlayerMP.playerNetServerHandler.sendPacketToPlayer(packet);
View Full Code Here

      }
    }
  }

  public static void sendPacketToAllAround(double X, double Y, double Z, double range, int dimensionId, Packet packet) {
    WorldServer worldServer = MinecraftServer.getServer().worldServerForDimension(dimensionId);
    int x = MathHelper.floor_double(X);
    int z = MathHelper.floor_double(Z);
    PlayerInstance playerInstance = worldServer.getPlayerManager().getOrCreateChunkWatcher(x >> 4, z >> 4, false);
    if (playerInstance != null) {
      range *= range;
      synchronized (playerInstance) {
        for (EntityPlayerMP entityPlayerMP : (Iterable<EntityPlayerMP>) playerInstance.playersInChunk) {
          double xD = X - entityPlayerMP.posX;
View Full Code Here

    }
  }

  @SubscribeEvent
  public void tick(WorldTickEvent evt) {
    WorldServer world = MinecraftServer.getServer().worldServers[0];
    long time = world.getTotalWorldTime();

    if (startTestTime == 0) {
      startTestTime = time;
    } else if (testSequence == null) {
      if (time - startTestTime > 10) {
View Full Code Here

    if (sendClientUpdate) {
      sendClientUpdate = false;

      if (worldObj instanceof WorldServer) {
        WorldServer world = (WorldServer) worldObj;
        BuildCraftPacket updatePacket = getBCDescriptionPacket();

        for (Object o : world.playerEntities) {
          EntityPlayerMP player = (EntityPlayerMP) o;

          if (world.getPlayerManager().isPlayerWatchingChunk (player, xCoord >> 4, zCoord >> 4)) {
            BuildCraftCore.instance.sendToPlayer(player, updatePacket);
          }
        }
      }
    }
View Full Code Here

  public volatile nallar.tickthreading.minecraft.tickregion.TileEntityTickRegion tickRegion_;

  @Override
  @Declare
  public void sendTileWithNotify() {
    WorldServer worldServer = ((WorldServer) worldObj);
    if (worldServer == null) {
      return;
    }
    Block blockType = getBlockType();
    worldServer.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType == null ? worldServer.getBlockId(xCoord, yCoord, zCoord) : blockType.blockID);
    PlayerInstance p = worldServer.getPlayerManager().getOrCreateChunkWatcher(xCoord >> 4, zCoord >> 4, false);
    if (p != null) {
      p.updateTile(this);
    }
  }
View Full Code Here

  public static void saveWorld(World world) {
    // only persist persistent worlds
    if (!(world instanceof WorldServer)) {
      return;
    }
    WorldServer worldServer = (WorldServer) world;
    File chunkDir = worldServer.getChunkSaveLocation();
    File chunkLoaderData = new File(chunkDir, "forcedchunks.dat");

    NBTTagCompound forcedChunkData = new NBTTagCompound();
    NBTTagList ticketList = new NBTTagList();
    forcedChunkData.setTag("TicketList", ticketList);
View Full Code Here

TOP

Related Classes of net.minecraft.world.WorldServer

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.