2014-12-13 01:19:51 +01:00
|
|
|
/*
|
|
|
|
* The MIT License (MIT)
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* Copyright (c) 2013 AlgorithmX2
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
|
* this software and associated documentation files (the "Software"), to deal in
|
|
|
|
* the Software without restriction, including without limitation the rights to
|
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
|
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
|
|
* subject to the following conditions:
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
* copies or substantial portions of the Software.
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-13 01:19:51 +01:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2014-12-04 13:00:54 +01:00
|
|
|
package appeng.api.networking.crafting;
|
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
|
|
|
|
import java.util.concurrent.Future;
|
|
|
|
|
2016-01-01 01:47:22 +01:00
|
|
|
import com.google.common.collect.ImmutableCollection;
|
|
|
|
import com.google.common.collect.ImmutableSet;
|
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
import net.minecraft.world.World;
|
2016-01-01 01:47:22 +01:00
|
|
|
|
2014-12-04 13:00:54 +01:00
|
|
|
import appeng.api.networking.IGrid;
|
|
|
|
import appeng.api.networking.IGridCache;
|
|
|
|
import appeng.api.networking.security.BaseActionSource;
|
|
|
|
import appeng.api.storage.data.IAEItemStack;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-12-04 13:00:54 +01:00
|
|
|
public interface ICraftingGrid extends IGridCache
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param whatToCraft requested craft
|
2016-01-01 01:48:15 +01:00
|
|
|
* @param world crafting world
|
|
|
|
* @param slot slot index
|
|
|
|
* @param details pattern details
|
2015-04-03 08:54:31 +02:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @return a collection of crafting patterns for the item in question.
|
|
|
|
*/
|
2015-04-03 08:54:31 +02:00
|
|
|
ImmutableCollection<ICraftingPatternDetails> getCraftingFor( IAEItemStack whatToCraft, ICraftingPatternDetails details, int slot, World world );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Begin calculating a crafting job.
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2016-01-01 01:48:15 +01:00
|
|
|
* @param world crafting world
|
|
|
|
* @param grid network
|
2014-12-04 13:00:54 +01:00
|
|
|
* @param actionSrc source
|
|
|
|
* @param craftWhat result
|
2016-01-01 01:48:15 +01:00
|
|
|
* @param callback callback
|
|
|
|
* -- optional
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @return a future which will at an undetermined point in the future get you the {@link ICraftingJob} do not wait
|
2015-04-03 08:54:31 +02:00
|
|
|
* on this, your be waiting forever.
|
2014-12-04 13:00:54 +01:00
|
|
|
*/
|
2015-04-03 08:54:31 +02:00
|
|
|
Future<ICraftingJob> beginCraftingJob( World world, IGrid grid, BaseActionSource actionSrc, IAEItemStack craftWhat, ICraftingCallback callback );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Submit the job to the Crafting system for processing.
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2016-01-01 01:48:15 +01:00
|
|
|
* @param job - the crafting job from beginCraftingJob
|
2015-04-03 08:54:31 +02:00
|
|
|
* @param requestingMachine - a machine if its being requested via automation, may be null.
|
2016-01-01 01:48:15 +01:00
|
|
|
* @param target - can be null
|
|
|
|
* @param prioritizePower - if cpu is null, this determine if the system should prioritize power, or if it should
|
|
|
|
* find the lower
|
|
|
|
* end cpus, automatic processes generally should pick lower end cpus.
|
|
|
|
* @param src - the action source to use when starting the job, this will be used for extracting items, should
|
|
|
|
* usually be the same as the one provided to beginCraftingJob.
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @return null ( if failed ) or an {@link ICraftingLink} other wise, if you send requestingMachine you need to
|
2015-04-03 08:54:31 +02:00
|
|
|
* properly keep track of this and handle the nbt saving and loading of the object as well as the
|
|
|
|
* {@link ICraftingRequester} methods. if you send null, this object should be discarded after verifying the
|
|
|
|
* return state.
|
2014-12-04 13:00:54 +01:00
|
|
|
*/
|
2015-04-03 08:54:31 +02:00
|
|
|
ICraftingLink submitJob( ICraftingJob job, ICraftingRequester requestingMachine, ICraftingCPU target, boolean prioritizePower, BaseActionSource src );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return list of all the crafting cpus on the grid
|
|
|
|
*/
|
|
|
|
ImmutableSet<ICraftingCPU> getCpus();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param what to be requested item
|
2015-04-03 08:54:31 +02:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @return true if the item can be requested via a crafting emitter.
|
|
|
|
*/
|
2015-04-03 08:54:31 +02:00
|
|
|
boolean canEmitFor( IAEItemStack what );
|
2014-12-04 13:00:54 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* is this item being crafted?
|
2015-02-03 12:04:13 +01:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @param aeStackInSlot item being crafted
|
2015-04-03 08:54:31 +02:00
|
|
|
*
|
2014-12-04 13:00:54 +01:00
|
|
|
* @return true if it is being crafting
|
|
|
|
*/
|
2015-04-03 08:54:31 +02:00
|
|
|
boolean isRequesting( IAEItemStack aeStackInSlot );
|
2014-12-04 13:00:54 +01:00
|
|
|
}
|