Package buildcraft.api.statements

Examples of buildcraft.api.statements.IStatementParameter


    if (!(container instanceof IGate)) {
      return false;
    }
   
    Pipe<?> pipe = (Pipe<?>) ((IGate) container).getPipe();
    IStatementParameter parameter = parameters[0];

    if (pipe.transport instanceof PipeTransportItems) {
      PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
      if (kind == PipeContents.empty) {
        return transportItems.items.isEmpty();
      } else if (kind == PipeContents.containsItems) {
        if (parameter != null && parameter.getItemStack() != null) {
          for (TravelingItem item : transportItems.items) {
            if (StackHelper.isMatchingItemOrList(parameter.getItemStack(), item.getItemStack())) {
              return true;
            }
          }
        } else {
          return !transportItems.items.isEmpty();
        }
      }
    } else if (pipe.transport instanceof PipeTransportFluids) {
      PipeTransportFluids transportFluids = (PipeTransportFluids) pipe.transport;

      FluidStack searchedFluid = null;

      if (parameter != null && parameter.getItemStack() != null) {
        searchedFluid = FluidContainerRegistry.getFluidForFilledItem(parameter.getItemStack());
      }

      if (kind == PipeContents.empty) {
        for (FluidTankInfo b : transportFluids.getTankInfo(ForgeDirection.UNKNOWN)) {
          if (b.fluid != null && b.fluid.amount != 0) {
View Full Code Here


*/
public class SerializerIStatementParameter extends ClassSerializer {

  @Override
  public void write (ByteBuf data, Object o, SerializationContext context) {
    IStatementParameter parameter = (IStatementParameter) o;

    if (parameter == null) {
      data.writeBoolean(false);
    } else {
      NBTTagCompound cpt = new NBTTagCompound();
      parameter.writeToNBT(cpt);
     
      data.writeBoolean(true);
      Utils.writeUTF(data, parameter.getUniqueTag());
      Utils.writeNBT(data, cpt);
    }
  }
View Full Code Here

  public Object read (ByteBuf data, Object o, SerializationContext context) {
    if (!data.readBoolean()) {
      return null;
    } else {
      String kind = Utils.readUTF(data);
      IStatementParameter parameter = StatementManager.createParameter(kind);
      parameter.readFromNBT(Utils.readNBT(data));
      return parameter;
    }
  }
View Full Code Here

TOP

Related Classes of buildcraft.api.statements.IStatementParameter

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.