Advertisement
jadenquinn

ITrainTransferHelper.java

Sep 28th, 2018
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.10 KB | None | 0 0
  1. /*------------------------------------------------------------------------------
  2.  Copyright (c) CovertJaguar, 2011-2017
  3.  
  4.  This work (the API) is licensed under the "MIT" License,
  5.  see LICENSE.md for details.
  6.  -----------------------------------------------------------------------------*/
  7. package mods.railcraft.api.carts;
  8.  
  9. import net.minecraft.entity.item.EntityMinecart;
  10. import net.minecraft.item.ItemStack;
  11. import net.minecraftforge.fluids.FluidStack;
  12. import net.minecraftforge.fluids.capability.IFluidHandler;
  13. import net.minecraftforge.items.IItemHandler;
  14.  
  15. import javax.annotation.Nullable;
  16. import java.util.function.Predicate;
  17.  
  18. /**
  19.  * This interface is the API facing wrapper for an internal helper class that makes it
  20.  * simple to pass items and fluids around within a Train.
  21.  * <p/>
  22.  * The helper object can be accessed from CartTools and is aware of the IItemCart and IFluidCart interfaces.
  23.  * <p/>
  24.  * Created by CovertJaguar on 5/11/2015.
  25.  *
  26.  * @see CartToolsAPI
  27.  * @see mods.railcraft.api.carts.IItemCart
  28.  * @see mods.railcraft.api.carts.IFluidCart
  29.  */
  30. @SuppressWarnings("unused")
  31. public interface ITrainTransferHelper {
  32.     // ***************************************************************************************************************************
  33.     // Items
  34.     // ***************************************************************************************************************************
  35.  
  36.     /**
  37.      * Will attempt to push an ItemStack to the Train.
  38.      *
  39.      * @param requester the source EntityMinecart
  40.      * @param stack     the ItemStack to be pushed
  41.      * @return the ItemStack that remains after any pushed items were removed, or null if it was fully pushed
  42.      * @see mods.railcraft.api.carts.IFluidCart
  43.      */
  44.     @Nullable
  45.     ItemStack pushStack(EntityMinecart requester, ItemStack stack);
  46.  
  47.     /**
  48.      * Will request an item from the Train.
  49.      *
  50.      * @param requester the source EntityMinecart
  51.      * @param filter    aPredicate<ItemStack> that defines the requested item
  52.      * @return the ItemStack pulled from the Train, or null if the request cannot be met
  53.      * @see mods.railcraft.api.carts.IItemCart
  54.      */
  55.     ItemStack pullStack(EntityMinecart requester, Predicate<ItemStack> filter);
  56.  
  57.     /**
  58.      * Offers an item stack to the Train or drops it if no one wants it.
  59.      *
  60.      * @param requester the source EntityMinecart
  61.      * @param stack     the ItemStack to be offered
  62.      */
  63.     void offerOrDropItem(EntityMinecart requester, ItemStack stack);
  64.  
  65.     /**
  66.      * Returns an IItemHandler with represents the entire train.
  67.      *
  68.      * @param cart a cart in the train
  69.      * @return IItemHandler
  70.      */
  71.     @Nullable
  72.     IItemHandler getTrainItemHandler(EntityMinecart cart);
  73.  
  74.  
  75.     // ***************************************************************************************************************************
  76.     // Fluids
  77.     // ***************************************************************************************************************************
  78.  
  79.     /**
  80.      * Will attempt to push fluid to the Train.
  81.      *
  82.      * @param requester  the source EntityMinecart
  83.      * @param fluidStack the amount and type of Fluid to be pushed
  84.      * @return the FluidStack that remains after any pushed Fluid was removed, or null if it was fully pushed
  85.      * @see mods.railcraft.api.carts.IFluidCart
  86.      */
  87.     @Nullable
  88.     FluidStack pushFluid(EntityMinecart requester, FluidStack fluidStack);
  89.  
  90.     /**
  91.      * Will request fluid from the Train.
  92.      *
  93.      * @param requester  the source EntityMinecart
  94.      * @param fluidStack the amount and type of Fluid requested
  95.      * @return the FluidStack pulled from the Train, or null if the request cannot be met
  96.      * @see mods.railcraft.api.carts.IFluidCart
  97.      */
  98.     @Nullable
  99.     FluidStack pullFluid(EntityMinecart requester, FluidStack fluidStack);
  100.  
  101.     /**
  102.      * Returns an IFluidHandler with represents the entire train.
  103.      *
  104.      * @param cart a cart in the train
  105.      * @return IFluidHandler
  106.      */
  107.     @Nullable
  108.     IFluidHandler getTrainFluidHandler(EntityMinecart cart);
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement