Examples of WorldServer


Examples of net.minecraft.world.WorldServer

{
    // patch method
    public static void processUpdateSign(NetHandlerPlayServer net, C12PacketUpdateSign p_147343_1_)
    {
        net.playerEntity.func_143004_u();
        WorldServer worldserver = net.serverController.worldServerForDimension(net.playerEntity.dimension);

        if (worldserver.blockExists(p_147343_1_.func_149588_c(), p_147343_1_.func_149586_d(), p_147343_1_.func_149585_e()))
        {
            TileEntity tileentity = worldserver.getTileEntity(p_147343_1_.func_149588_c(), p_147343_1_.func_149586_d(), p_147343_1_.func_149585_e());

            if (tileentity instanceof TileEntitySign)
            {
                TileEntitySign tileentitysign = (TileEntitySign)tileentity;

                if (!tileentitysign.func_145914_a() || tileentitysign.func_145911_b() != net.playerEntity)
                {
                    net.serverController.logWarning("Player " + net.playerEntity.getCommandSenderName() + " just tried to change non-editable sign");
                    return;
                }
            }

            int i;
            int j;

            for (j = 0; j < 4; ++j)
            {
                boolean flag = true;

                if (p_147343_1_.func_149589_f()[j].length() > 15)
                {
                    flag = false;
                }
                else
                {
                    for (i = 0; i < p_147343_1_.func_149589_f()[j].length(); ++i)
                    {
                        if (!ChatAllowedCharacters.isAllowedCharacter(p_147343_1_.func_149589_f()[j].charAt(i)))
                        {
                            flag = false;
                        }
                    }
                }

                if (!flag)
                {
                    p_147343_1_.func_149589_f()[j] = "!?";
                }
            }

            if (tileentity instanceof TileEntitySign)
            {
                j = p_147343_1_.func_149588_c();
                int k = p_147343_1_.func_149586_d();
                i = p_147343_1_.func_149585_e();
                TileEntitySign tileentitysign1 = (TileEntitySign)tileentity;
                System.arraycopy(Preconditions.checkNotNull(onSignEditEvent(net, p_147343_1_)), 0, tileentitysign1.signText, 0, 4);
                tileentitysign1.markDirty();
                worldserver.markBlockForUpdate(j, k, i);
            }
        }
    }
View Full Code Here

Examples of net.minecraft.world.WorldServer

            float percent = playersS * 100.0f / playersT;
            OutputHandler.felog.finer("Players sleeping: " + percent + "%");
            if (percent > 50)
            {
                WorldServer world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[0];
                long time = world.getWorldInfo().getWorldTime() + 24000L;
                world.getWorldInfo().setWorldTime(time - time % 24000L);

                for (Object obj : world.playerEntities)
                {
                    EntityPlayer var2 = (EntityPlayer) obj;

View Full Code Here

Examples of net.minecraft.world.WorldServer

        MinecraftServer.getServer().worldServers = tmp.toArray(new WorldServer[tmp.size()]);
    }

    public static void initDimension(int dim) {
        WorldServer overworld = getWorld(0);
        if (overworld == null)
        {
            throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!");
        }
        try
        {
            DimensionManager.getProviderType(dim);
        }
        catch (Exception e)
        {
            System.err.println("Cannot Hotload Dim: " + e.getMessage());
            return; // If a provider hasn't been registered then we can't hotload the dim
        }
        MinecraftServer mcServer = overworld.func_73046_m();
        ISaveHandler savehandler = overworld.getSaveHandler();
        WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo());

        WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler));
        world.addWorldAccess(new WorldManager(mcServer, world));
        MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
        if (!mcServer.isSinglePlayer())
        {
            world.getWorldInfo().setGameType(mcServer.getGameType());
        }

        mcServer.func_147139_a(mcServer.func_147135_j());
    }
View Full Code Here

Examples of net.minecraft.world.WorldServer

    /*
    * To be called by the server at the appropriate time, do not call from mod code.
    */
    public static void unloadWorlds(Hashtable<Integer, long[]> worldTickTimes) {
        for (int id : unloadQueue) {
            WorldServer w = worlds.get(id);
            try {
                if (w != null)
                {
                    w.saveAllChunks(true, null);
                }
                else
                {
                    FMLLog.warning("Unexpected world unload - world %d is already unloaded", id);
                }
            } catch (MinecraftException e) {
                e.printStackTrace();
            }
            finally
            {
                if (w != null)
                {
                    MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(w));
                    w.flush();
                    setWorld(id, null);
                }
            }
        }
        unloadQueue.clear();
View Full Code Here

Examples of net.minecraft.world.WorldServer

        {
            return;
        }

        dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize(dormantChunkCacheSize).<Long, Chunk>build());
        WorldServer worldServer = (WorldServer) world;
        File chunkDir = worldServer.getChunkSaveLocation();
        File chunkLoaderData = new File(chunkDir, "forcedchunks.dat");

        if (chunkLoaderData.exists() && chunkLoaderData.isFile())
        {
            ArrayListMultimap<String, Ticket> loadedTickets = ArrayListMultimap.<String, Ticket>create();
View Full Code Here

Examples of net.minecraft.world.WorldServer

        // 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

Examples of net.minecraft.world.WorldServer

   * @param link destination
   * @return teleported entity
   */
  public Entity teleportEntity(Entity entity, TelDestination link)
  {
    WorldServer oldWorld, newWorld;
    EntityPlayerMP player;

    try
    {
      oldWorld = (WorldServer) entity.worldObj;
      newWorld = (WorldServer) link.dim;
      player = (entity instanceof EntityPlayerMP) ? (EntityPlayerMP) entity : null;
    }
    catch (Throwable e)
    {
      return entity;
    }

    if ( oldWorld == null )
      return entity;
    if ( newWorld == null )
      return entity;

    // Is something riding? Handle it first.
    if ( entity.riddenByEntity != null )
    {
      return teleportEntity( entity.riddenByEntity, link );
    }
    // Are we riding something? Dismount and tell the mount to go first.
    Entity cart = entity.ridingEntity;
    if ( cart != null )
    {
      entity.mountEntity( null );
      cart = teleportEntity( cart, link );
      // We keep track of both so we can remount them on the other side.
    }

    // load the chunk!
    WorldServer.class.cast( newWorld ).getChunkProvider().loadChunk( MathHelper.floor_double( link.x ) >> 4, MathHelper.floor_double( link.z ) >> 4 );

    boolean difDest = newWorld != oldWorld;
    if ( difDest )
    {
      if ( player != null )
      {
        if ( link.dim.provider instanceof StorageWorldProvider )
          Achievements.SpatialIOExplorer.addToPlayer( player );

        player.mcServer.getConfigurationManager().transferPlayerToDimension( player, link.dim.provider.dimensionId, new METeleporter( newWorld, link ) );
      }
      else
      {
        int entX = entity.chunkCoordX;
        int entZ = entity.chunkCoordZ;

        if ( (entity.addedToChunk) && (oldWorld.getChunkProvider().chunkExists( entX, entZ )) )
        {
          oldWorld.getChunkFromChunkCoords( entX, entZ ).removeEntity( entity );
          oldWorld.getChunkFromChunkCoords( entX, entZ ).isModified = true;
        }

        Entity newEntity = EntityList.createEntityByName( EntityList.getEntityString( entity ), newWorld );
        if ( newEntity != null )
        {
View Full Code Here

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

Examples of net.minecraft.world.WorldServer

    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

Examples of net.minecraft.world.WorldServer

    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
TOP
Copyright © 2018 www.massapi.com. 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.