Class ShoppingBasket

java.lang.Object
me.desht.pneumaticcraft.common.amadron.ShoppingBasket
All Implemented Interfaces:
Iterable<net.minecraft.resources.ResourceLocation>

public class ShoppingBasket extends Object implements Iterable<net.minecraft.resources.ResourceLocation>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addUnitsToOffer(net.minecraft.resources.ResourceLocation offerId, int toAdd)
     
    void
     
    fromNBT(net.minecraft.nbt.CompoundTag subTag)
     
    int
    getUnits(net.minecraft.resources.ResourceLocation offerId)
     
    void
    halve(net.minecraft.resources.ResourceLocation offerId)
     
    boolean
     
    Iterator<net.minecraft.resources.ResourceLocation>
     
    void
    remove(net.minecraft.resources.ResourceLocation offerId)
     
    void
    setUnits(net.minecraft.resources.ResourceLocation offerId, int units)
     
    void
    syncToPlayer(net.minecraft.server.level.ServerPlayer player)
     
    net.minecraft.nbt.CompoundTag
     
    validate(net.minecraft.world.item.ItemStack tablet, boolean allOffers)
    Go through all items and fluids in the basket and ensure that: the providing inventory/tank exists there's enough of the offer in stock, where applicable the providing inventory/tank contains enough resources to fund all of the offers the Amadrone has space to carry all resources (36 itemstacks and/or 576000mB fluid) there's enough space in the output

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • ShoppingBasket

      public ShoppingBasket()
  • Method Details

    • fromNBT

      public static ShoppingBasket fromNBT(net.minecraft.nbt.CompoundTag subTag)
    • toNBT

      public net.minecraft.nbt.CompoundTag toNBT()
    • getUnits

      public int getUnits(net.minecraft.resources.ResourceLocation offerId)
    • setUnits

      public void setUnits(net.minecraft.resources.ResourceLocation offerId, int units)
    • addUnitsToOffer

      public void addUnitsToOffer(net.minecraft.resources.ResourceLocation offerId, int toAdd)
    • remove

      public void remove(net.minecraft.resources.ResourceLocation offerId)
    • halve

      public void halve(net.minecraft.resources.ResourceLocation offerId)
    • clear

      public void clear()
    • iterator

      public Iterator<net.minecraft.resources.ResourceLocation> iterator()
      Specified by:
      iterator in interface Iterable<net.minecraft.resources.ResourceLocation>
    • validate

      public AmadronMenu.EnumProblemState validate(net.minecraft.world.item.ItemStack tablet, boolean allOffers)
      Go through all items and fluids in the basket and ensure that:
      1. the providing inventory/tank exists
      2. there's enough of the offer in stock, where applicable
      3. the providing inventory/tank contains enough resources to fund all of the offers
      4. the Amadrone has space to carry all resources (36 itemstacks and/or 576000mB fluid)
      5. there's enough space in the output

      The basket may be modified to make the order(s) valid

      Parameters:
      tablet - the Amadron tablet, to get the inventory/tank locations
      allOffers - true to check all offers as one, false to check each individually
    • syncToPlayer

      public void syncToPlayer(net.minecraft.server.level.ServerPlayer player)
    • isEmpty

      public boolean isEmpty()