Class ShoppingBasket
java.lang.Object
me.desht.pneumaticcraft.common.amadron.ShoppingBasket
- All Implemented Interfaces:
Iterable<net.minecraft.resources.ResourceLocation>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUnitsToOffer(net.minecraft.resources.ResourceLocation offerId, int toAdd) voidclear()static ShoppingBasketfromNBT(net.minecraft.nbt.CompoundTag subTag) intgetUnits(net.minecraft.resources.ResourceLocation offerId) voidhalve(net.minecraft.resources.ResourceLocation offerId) booleanisEmpty()Iterator<net.minecraft.resources.ResourceLocation>iterator()voidremove(net.minecraft.resources.ResourceLocation offerId) voidsetUnits(net.minecraft.resources.ResourceLocation offerId, int units) voidsyncToPlayer(net.minecraft.server.level.ServerPlayer player) net.minecraft.nbt.CompoundTagtoNBT()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 outputMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ShoppingBasket
public ShoppingBasket()
-
-
Method Details
-
fromNBT
-
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
-
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:- 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
The basket may be modified to make the order(s) valid
- Parameters:
tablet- the Amadron tablet, to get the inventory/tank locationsallOffers- 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()
-