Пример #1
0
  @Override
  public NBTTagCompound writeToNBT(NBTTagCompound nbtTags) {
    super.writeToNBT(nbtTags);

    nbtTags.setInteger("tier", tier.ordinal());
    nbtTags.setBoolean("isActive", isActive);
    nbtTags.setInteger("editMode", editMode.ordinal());

    if (fluidTank.getFluid() != null) {
      nbtTags.setTag("fluidTank", fluidTank.writeToNBT(new NBTTagCompound()));
    }

    return nbtTags;
  }
Пример #2
0
  @Override
  public boolean upgrade(BaseTier upgradeTier) {
    if (upgradeTier.ordinal() != tier.ordinal() + 1) {
      return false;
    }

    tier = FluidTankTier.values()[upgradeTier.ordinal()];
    fluidTank.setCapacity(tier.storage);

    Mekanism.packetHandler.sendToReceivers(
        new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())),
        new Range4D(Coord4D.get(this)));
    markDirty();

    return true;
  }
Пример #3
0
  @Override
  public ArrayList<Object> getNetworkedData(ArrayList<Object> data) {
    super.getNetworkedData(data);

    data.add(tier.ordinal());
    data.add(isActive);
    data.add(valve);
    data.add(editMode.ordinal());

    if (valve > 0) {
      data.add(FluidRegistry.getFluidName(valveFluid));
    }

    if (fluidTank.getFluid() != null) {
      data.add(1);
      data.add(FluidRegistry.getFluidName(fluidTank.getFluid()));
      data.add(fluidTank.getFluid().amount);
    } else {
      data.add(0);
    }

    return data;
  }