diff options
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
-rw-r--r-- | src/main/java/gregtech/api/interfaces/IRecipeMap.java (renamed from src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java) | 16 | ||||
-rw-r--r-- | src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java | 26 | ||||
-rw-r--r-- | src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java | 8 | ||||
-rw-r--r-- | src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java | 15 | ||||
-rw-r--r-- | src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java | 5 | ||||
-rw-r--r-- | src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java | 49 |
6 files changed, 73 insertions, 46 deletions
diff --git a/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java b/src/main/java/gregtech/api/interfaces/IRecipeMap.java index 2c5259882a..ce48b29927 100644 --- a/src/main/java/gregtech/api/interfaces/IGT_RecipeMap.java +++ b/src/main/java/gregtech/api/interfaces/IRecipeMap.java @@ -14,7 +14,7 @@ import gregtech.api.util.GT_Utility; /** * Represents the target of a recipe adding action, usually, but not necessarily, is a recipe map itself. */ -public interface IGT_RecipeMap { +public interface IRecipeMap { /** * Add a downstream recipe map that will get to handle the original builder. @@ -27,7 +27,7 @@ public interface IGT_RecipeMap { * * @param downstream the downstream recipe map to add */ - void addDownstream(IGT_RecipeMap downstream); + void addDownstream(IRecipeMap downstream); /** * Actually add the recipe represented by the builder. CAN modify the builder's internal states!!! @@ -41,17 +41,17 @@ public interface IGT_RecipeMap { * <p> * The returned recipe map will not have any downstreams, but can accept new downstreams. */ - default IGT_RecipeMap deepCopyInput() { + default IRecipeMap deepCopyInput() { return newRecipeMap(b -> doAdd(b.copy())); } - static IGT_RecipeMap newRecipeMap(Function<? super GT_RecipeBuilder, Collection<GT_Recipe>> func) { - return new IGT_RecipeMap() { + static IRecipeMap newRecipeMap(Function<? super GT_RecipeBuilder, Collection<GT_Recipe>> func) { + return new IRecipeMap() { - private final Collection<IGT_RecipeMap> downstreams = new ArrayList<>(); + private final Collection<IRecipeMap> downstreams = new ArrayList<>(); @Override - public void addDownstream(IGT_RecipeMap downstream) { + public void addDownstream(IRecipeMap downstream) { downstreams.add(downstream); } @@ -63,7 +63,7 @@ public interface IGT_RecipeMap { ret.add(out); builder.clearInvalid(); if (!out.isEmpty()) { - for (IGT_RecipeMap downstream : downstreams) { + for (IRecipeMap downstream : downstreams) { ret.add(downstream.doAdd(builder)); } } diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index 361e391a9b..e7abfea98f 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -321,17 +321,6 @@ public interface IGT_RecipeAdder { boolean hidden); /** - * Adds a CNC-Machine Recipe - * - * @param aInput1 must be != null - * @param aOutput1 must be != null - * @param aDuration must be > 0 - * @param aEUt should be > 0 - */ - @Deprecated - boolean addCNCRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt); - - /** * Adds an Assembler Recipe * * @param aInput1 must be != null @@ -1047,21 +1036,6 @@ public interface IGT_RecipeAdder { FluidStack[] aFluidOutputs, int[] aChances, int aDuration, int aEUt, int aSpecialValue); /** - * Add a Board Manufacturer Recipe. The Board Manufacturer's main use is to make the circuit boards needed to make - * circuits. - * - * @param aInputs must not be null - * @param aFluidInputs must not be null - * @param aOutputs must not be null - * @param aDuration recipe duration - * @param aEUt recipe EU/t expenditure - * @param aSpecialValue defines the tier of the board manufacturer required. - */ - @Deprecated - boolean addPCBFactoryRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack[] aOutputs, int aDuration, - int aEUt, int aSpecialValue); - - /** * Add a breeder cell. * * @param input raw stack. should be undamaged. diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index ba164352aa..04522b1012 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -38,7 +38,6 @@ import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Util; -import gregtech.common.power.Power; /** * Warning, this Interface has just been made to be able to add multiple kinds of MetaTileEntities (Cables, Pipes, @@ -366,13 +365,6 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand String getSpecialVoltageToolTip(); /** - * @return Power object used for displaying in NEI - */ - default Power getPower() { - return null; - } - - /** * Icon of the Texture. If this returns null then it falls back to getTextureIndex. * * @param side is the Side of the Block diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java b/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java new file mode 100644 index 0000000000..495cd9def4 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/IOverclockDescriptionProvider.java @@ -0,0 +1,15 @@ +package gregtech.api.interfaces.tileentity; + +import javax.annotation.Nullable; + +import gregtech.api.objects.overclockdescriber.OverclockDescriber; + +/** + * Classes implementing this interface can provide {@link OverclockDescriber} to provide overclock behavior and NEI + * description. + */ +public interface IOverclockDescriptionProvider { + + @Nullable + OverclockDescriber getOverclockDescriber(); +} diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java b/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java index f793221a50..54d178af3c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IRecipeLockable.java @@ -1,12 +1,11 @@ package gregtech.api.interfaces.tileentity; import gregtech.api.recipe.check.SingleRecipeCheck; -import gregtech.api.util.GT_Recipe; /** * Machines implementing this interface can have logic to lock to a single recipe. */ -public interface IRecipeLockable { +public interface IRecipeLockable extends RecipeMapWorkable { /** * @return if this machine supports single recipe locking. @@ -29,6 +28,4 @@ public interface IRecipeLockable { } default void setSingleRecipeCheck(SingleRecipeCheck recipeCheck) {} - - GT_Recipe.GT_Recipe_Map getRecipeMap(); } diff --git a/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java b/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java new file mode 100644 index 0000000000..7d4db4396c --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/tileentity/RecipeMapWorkable.java @@ -0,0 +1,49 @@ +package gregtech.api.interfaces.tileentity; + +import java.util.Collection; +import java.util.Collections; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; + +import gregtech.api.recipe.RecipeMap; + +/** + * Machines implementing this interface are capable of executing certain recipes provided by {@link RecipeMap}. + * They will also be automatically registered as NEI recipe catalyst for the corresponding recipemaps. + */ +public interface RecipeMapWorkable { + + /** + * @return RecipeMap this machine currently can execute. In general, it's allowed to be null. + */ + RecipeMap<?> getRecipeMap(); + + /** + * @return ItemStack form of this machine. + */ + ItemStack getStackForm(long amount); + + /** + * If the machine supports multiple recipemaps by switching mode, override this method so that it will be displayed + * as NEI recipe catalyst on all the supported recipemaps. + * + * @return List of possible {@link RecipeMap}s this machine can execute. Must not contain null element. + */ + @Nonnull + default Collection<RecipeMap<?>> getAvailableRecipeMaps() { + RecipeMap<?> recipeMap = getRecipeMap(); + if (recipeMap != null) { + return Collections.singletonList(recipeMap); + } + return Collections.emptyList(); + } + + /** + * @return Priority for NEI recipe catalyst. Higher priority comes first. + */ + default int getRecipeCatalystPriority() { + return 0; + } +} |