Ejemplo n.º 1
0
  @RPC(RPCSide.CLIENT)
  public void requestSelectedBlueprint() {
    if (isOutputConsistent()) {
      if (selected > -1 && selected < currentPage.size()) {
        BlueprintBase bpt = BuildCraftBuilders.clientDB.load(currentPage.get(selected));

        RPCHandler.rpcServer(this, "uploadBlueprintToServer", bpt.id, bpt.getData());
      } else {
        RPCHandler.rpcServer(this, "uploadBlueprintToServer", null, null);
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public void updateEntity() {
    super.updateEntity();

    if (worldObj.isRemote) {
      return;
    }

    if (progressIn > 0 && progressIn < PROGRESS_TIME) {
      progressIn++;
    }

    if (progressOut > 0 && progressOut < PROGRESS_TIME) {
      if (selected == -1) {
        progressOut++;
      } else {
        progressOut = 1;
      }
    }

    // On progress IN, we'll download the blueprint from the server to the
    // client, and then store it to the client.
    if (progressIn == 100 && getStackInSlot(1) == null) {
      setInventorySlotContents(1, getStackInSlot(0));
      setInventorySlotContents(0, null);

      BlueprintBase bpt = ItemBlueprint.loadBlueprint(getStackInSlot(1));

      if (bpt != null && uploadingPlayer != null) {
        RPCHandler.rpcPlayer(
            uploadingPlayer, this, "downloadBlueprintToClient", bpt.id, bpt.getData());
        uploadingPlayer = null;
      }
    }

    if (progressOut == 100 && getStackInSlot(3) == null) {
      RPCHandler.rpcPlayer(downloadingPlayer, this, "requestSelectedBlueprint");
      progressOut = 0;
    }
  }