Package org.spout.api.protocol.reposition

Examples of org.spout.api.protocol.reposition.RepositionManager


  private void freeChunk(Point p) {
    int x = (int) p.getX() >> Chunk.BLOCKS.BITS;
    int y = (int) p.getY() >> Chunk.BLOCKS.BITS; // + SEALEVEL_CHUNK;
    int z = (int) p.getZ() >> Chunk.BLOCKS.BITS;

    RepositionManager rm = getRepositionManager();

    int cY = rm.convertChunkY(y);

    if (cY < 0 || cY >= WORLD_HEIGHT >> Chunk.BLOCKS.BITS) {
      return;
    }
View Full Code Here


  private void initChunkRaw(Point p) {
    int x = p.getChunkX();
    int y = p.getChunkY();// + SEALEVEL_CHUNK;
    int z = p.getChunkZ();

    RepositionManager rm = getRepositionManager();

    int cY = rm.convertChunkY(y);

    if (cY < 0 || cY >= WORLD_HEIGHT >> Chunk.BLOCKS.BITS) {
      return;
    }
View Full Code Here

    int x = c.getX();
    int y = c.getY();// + SEALEVEL_CHUNK;
    int z = c.getZ();

    RepositionManager rm = getRepositionManager();

    int cY = rm.convertChunkY(y);

    if (cY < 0 || cY >= WORLD_HEIGHT >> Chunk.BLOCKS.BITS) {
      return null;
    }

    initChunkRaw(c.getBase());

    Collection<Chunk> chunks = null;

    List<ProtocolEvent> events = new ArrayList<ProtocolEvent>();

    if (activeColumns.add(x, z)) {
      Point p = c.getBase();
      int[][] heights = getColumnHeights(p);
      BlockMaterial[][] materials = getColumnTopmostMaterials(p);

      byte[][] packetChunkData = new byte[16][];

      for (int cube = 0; cube < 16; cube++) {
        int serverCube = rm.getInverse().convertChunkY(cube);
        Point pp = new Point(c.getWorld(), x << Chunk.BLOCKS.BITS, serverCube << Chunk.BLOCKS.BITS, z << Chunk.BLOCKS.BITS);
        packetChunkData[cube] = chunkInit.getChunkData(heights, materials, pp, events);
      }

      Chunk chunk = p.getWorld().getChunkFromBlock(p, LoadOption.LOAD_ONLY);
View Full Code Here

    return (hash & FORCE_MASK) == 0 || (VanillaPlugin.getInstance().getEngine().debugMode() && getOwner().get(ForceMessages.class) != null);
  }

  @Override
  public Iterator<IntVector3> getViewableVolume(int cx, int cy, int cz, int viewDistance) {
    RepositionManager rmI = this.getRepositionManager().getInverse();

    int convertY = rmI.convertChunkY(0);

    return new FlatIterator(cx, convertY, cz, 16, viewDistance);
  }
View Full Code Here

public class BlockBulkHandler extends MessageHandler<BlockBulkMessage> {
  @Override
  public void handleClient(ClientSession session, BlockBulkMessage message) {
    Player player = session.getPlayer();
    World world = player.getWorld();
    RepositionManager rm = player.getNetwork().getRepositionManager();
    int baseX = message.getChunkX() << Chunk.BLOCKS.BITS;
    int baseZ = message.getChunkZ() << Chunk.BLOCKS.BITS;

    for (int i = 0; i < message.getChanges(); i++) {
      int x = rm.convertX(message.getCoordinates()[i * 3] + baseX);
      int y = rm.convertY(message.getCoordinates()[i * 3 + 1]);
      int z = rm.convertZ(message.getCoordinates()[i * 3 + 2] + baseZ);

      short type = message.getTypes()[i];
      byte data = message.getMetadata()[i];

      BlockMaterial material = (BlockMaterial) VanillaMaterials.getMaterial(type, data);
View Full Code Here

public class ChunkDataHandler extends MessageHandler<ChunkDataMessage> {
  @Override
  public void handleClient(ClientSession session, ChunkDataMessage message) {
    Player player = session.getPlayer();
    World world = player.getEngine().getDefaultWorld();//player.getWorld();
    RepositionManager rm = player.getNetwork().getRepositionManager();

    int baseX = message.getX() << Chunk.BLOCKS.BITS;
    int baseZ = message.getZ() << Chunk.BLOCKS.BITS;

    final byte[][] data = message.getData();

    for (int i = 0; i < 16; i++) {
      int baseY = i << Chunk.BLOCKS.BITS;

      if (data[i] == null) {
        continue;
      }

      int index = 0;
      for (int xx = 0; xx < Chunk.BLOCKS.SIZE; xx++) {
        for (int yy = 0; yy < Chunk.BLOCKS.SIZE; yy++) {
          for (int zz = 0; zz < Chunk.BLOCKS.SIZE; zz++) {
            int x = rm.convertX(xx + baseX);
            int y = rm.convertY(yy + baseY);
            int z = rm.convertZ(zz + baseZ);

            short type = data[i][index];
            byte dat;
            if (index % 2 == 0) {
              dat = (byte) (data[i][(index / 2) + 4096] >> 4);
View Full Code Here

public class SignHandler extends MessageHandler<SignMessage> {
  @Override
  public void handleServer(ServerSession session, SignMessage message) {
    Player player = session.getPlayer();
    RepositionManager rmInverse = player.getNetwork().getRepositionManager().getInverse();

    int x = rmInverse.convertX(message.getX());
    int y = rmInverse.convertY(message.getY());
    int z = rmInverse.convertZ(message.getZ());

    Sign sign = player.getWorld().getBlock(x, y, z).get(Sign.class);
    if (sign == null) {
      return;
    }
View Full Code Here

public class ChunkBulkHandler extends MessageHandler<ChunkBulkMessage> {
  @Override
  public void handleClient(ClientSession session, ChunkBulkMessage message) {
    Player player = session.getPlayer();
    World world = player.getEngine().getDefaultWorld();//player.getWorld();
    RepositionManager rm = player.getNetwork().getRepositionManager();

    for (int c = 0; c < message.getX().length; c++) {
      int baseX = message.getX()[c] << Chunk.BLOCKS.BITS;
      int baseZ = message.getZ()[c] << Chunk.BLOCKS.BITS;

      final byte[][] data = message.getData()[c];

      for (int i = 0; i < 16; i++) {
        int baseY = i << Chunk.BLOCKS.BITS;

        int index = 0;
        for (int xx = 0; xx < Chunk.BLOCKS.SIZE; xx++) {
          for (int yy = 0; yy < Chunk.BLOCKS.SIZE; yy++) {
            for (int zz = 0; zz < Chunk.BLOCKS.SIZE; zz++) {
              int x = rm.convertX(xx + baseX);
              int y = rm.convertY(yy + baseY);
              int z = rm.convertZ(zz + baseZ);

              short type = data[i][index];
              byte dat;
              if (index % 2 == 0) {
                dat = (byte) (data[i][(index / 2) + 4096] >> 4);
View Full Code Here

  }

  @Override
  public void handleClient(ClientSession session, SignMessage message) {
    Player player = session.getPlayer();
    RepositionManager rm = player.getNetwork().getRepositionManager();

    int x = rm.convertX(message.getX());
    int y = rm.convertY(message.getY());
    int z = rm.convertZ(message.getZ());

    Sign sign = player.getWorld().getBlock(x, y, z).get(Sign.class);
    if (sign == null) {
      return;
    }
View Full Code Here

public class BlockChangeHandler extends MessageHandler<BlockChangeMessage> {
  @Override
  public void handleClient(ClientSession session, BlockChangeMessage message) {
    Player player = session.getPlayer();
    World world = player.getWorld();
    RepositionManager rm = player.getNetwork().getRepositionManager();

    int x = rm.convertX(message.getX());
    int y = rm.convertY(message.getY());
    int z = rm.convertZ(message.getZ());

    short type = message.getType();
    int data = message.getMetadata();

    BlockMaterial material = (BlockMaterial) VanillaMaterials.getMaterial(type, (short) data);
View Full Code Here

TOP

Related Classes of org.spout.api.protocol.reposition.RepositionManager

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.