예제 #1
0
  @Override
  public void sendBlockChange(int x, int y, int z, BlockState state) {
    checkNotNull(state, "state");
    S23PacketBlockChange packet = new S23PacketBlockChange();
    packet.blockPosition = new BlockPos(x, y, z);
    packet.blockState = (IBlockState) state;

    for (EntityPlayer player : this.playerEntities) {
      if (player instanceof EntityPlayerMP) {
        ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(packet);
      }
    }
  }
예제 #2
0
  public void sendClientUpdate(
      Volume updateVolume, BlockPos center, EntityPlayerMP player, ForgeDirection face) {
    World world = DimensionManager.getWorld(center.getDim());
    int x, y, z;

    if (face != null) updateVolume = translateVolume(updateVolume, face);

    for (int i = updateVolume.getMinX(); i <= updateVolume.getMaxX(); i++) {
      for (int j = updateVolume.getMinY(); j <= updateVolume.getMaxY(); j++) {
        for (int k = updateVolume.getMinZ(); k <= updateVolume.getMaxZ(); k++) {
          x = center.getX() + i;
          y = center.getY() + j;
          z = center.getZ() + k;

          S23PacketBlockChange packet = new S23PacketBlockChange(x, y, z, world);
          packet.field_148884_e = world.getBlockMetadata(x, y, z);
          FMLCommonHandler.instance()
              .getMinecraftServerInstance()
              .getConfigurationManager()
              .sendPacketToAllPlayers(packet);
        }
      }
    }
  }