Ported the api package. All minor changes

This commit is contained in:
Michael 2020-09-07 15:24:04 +01:00
parent 4020a1a95d
commit d04ba602d8
No known key found for this signature in database
GPG key ID: 971C5B254742488F
21 changed files with 113 additions and 108 deletions

View file

@ -10,11 +10,6 @@
package de.ellpeck.actuallyadditions.api; package de.ellpeck.actuallyadditions.api;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
@ -23,22 +18,18 @@ import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler; import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.api.lens.LensConversion;
import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn; import de.ellpeck.actuallyadditions.api.recipe.*;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
import de.ellpeck.actuallyadditions.api.recipe.IColorLensChanger;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe;
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public final class ActuallyAdditionsAPI { public final class ActuallyAdditionsAPI {
public static final String MOD_ID = "actuallyadditions"; public static final String MOD_ID = "actuallyadditions";
@ -217,7 +208,7 @@ public final class ActuallyAdditionsAPI {
* @param output The itemstack to be output from the compost once conversion finishes * @param output The itemstack to be output from the compost once conversion finishes
* @param outputDisplay The state to display when there is output in the compost * @param outputDisplay The state to display when there is output in the compost
*/ */
public static void addCompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) { public static void addCompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay)); COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
} }

View file

@ -11,17 +11,17 @@
package de.ellpeck.actuallyadditions.api.booklet; package de.ellpeck.actuallyadditions.api.booklet;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.api.distmarker.OnlyIn;
public interface IBookletChapter { public interface IBookletChapter {
IBookletPage[] getAllPages(); IBookletPage[] getAllPages();
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
String getLocalizedName(); String getLocalizedName();
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
String getLocalizedNameWithFormatting(); String getLocalizedNameWithFormatting();
IBookletEntry getEntry(); IBookletEntry getEntry();

View file

@ -10,10 +10,10 @@
package de.ellpeck.actuallyadditions.api.booklet; package de.ellpeck.actuallyadditions.api.booklet;
import java.util.List; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.relauncher.Side; import java.util.List;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IBookletEntry { public interface IBookletEntry {
@ -21,19 +21,19 @@ public interface IBookletEntry {
String getIdentifier(); String getIdentifier();
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
String getLocalizedName(); String getLocalizedName();
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
String getLocalizedNameWithFormatting(); String getLocalizedNameWithFormatting();
void addChapter(IBookletChapter chapter); void addChapter(IBookletChapter chapter);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
List<IBookletChapter> getChaptersForDisplay(String searchBarText); List<IBookletChapter> getChaptersForDisplay(String searchBarText);
int getSortingPriority(); int getSortingPriority();
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
boolean visibleOnFrontPage(); boolean visibleOnFrontPage();
} }

View file

@ -10,14 +10,14 @@
package de.ellpeck.actuallyadditions.api.booklet; package de.ellpeck.actuallyadditions.api.booklet;
import java.util.List;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import java.awt.*;
import java.util.List;
public interface IBookletPage { public interface IBookletPage {
@ -29,31 +29,32 @@ public interface IBookletPage {
void setChapter(IBookletChapter chapter); void setChapter(IBookletChapter chapter);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
String getInfoText(); String getInfoText();
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton); void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state); void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick); void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
@SideOnly(Side.CLIENT) // todo: this won't be needed anymore
void actionPerformed(GuiBookletBase gui, GuiButton button); @OnlyIn(Dist.CLIENT)
void actionPerformed(GuiBookletBase gui, Button button);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
void initGui(GuiBookletBase gui, int startX, int startY); void initGui(GuiBookletBase gui, int startX, int startY);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer); void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks); void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
@SideOnly(Side.CLIENT) @OnlyIn(Dist.CLIENT)
void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks); void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
boolean shouldBeOnLeftSide(); boolean shouldBeOnLeftSide();

View file

@ -10,19 +10,25 @@
package de.ellpeck.actuallyadditions.api.booklet.internal; package de.ellpeck.actuallyadditions.api.booklet.internal;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import java.util.List; import java.util.List;
import net.minecraft.client.gui.GuiButton; public abstract class GuiBookletBase extends Screen {
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
public abstract class GuiBookletBase extends GuiScreen { protected GuiBookletBase(ITextComponent titleIn) {
super(new StringTextComponent(""));
}
public abstract void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale); public abstract void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale);
public abstract void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length); public abstract void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length);
public abstract List<GuiButton> getButtonList(); public abstract List<Button> getButtonList();
public abstract int getGuiLeft(); public abstract int getGuiLeft();

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.api.internal; package de.ellpeck.actuallyadditions.api.internal;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import net.minecraft.util.EnumFacing; import net.minecraft.util.Direction;
/** /**
* This is a helper interface for Lens' invoke() method. * This is a helper interface for Lens' invoke() method.
@ -23,5 +23,5 @@ public interface IAtomicReconstructor extends IEnergyTile {
Lens getLens(); Lens getLens();
EnumFacing getOrientation(); Direction getOrientation();
} }

View file

@ -27,9 +27,14 @@ public interface IEnergyTile {
int getZ(); int getZ();
//TODO: Rename to getWorld /**
* @deprecated use {@link #getWorld()}
*/
@Deprecated
World getWorldObject(); World getWorldObject();
World getWorld();
void extractEnergy(int amount); void extractEnergy(int amount);
int getEnergy(); int getEnergy();

View file

@ -10,10 +10,10 @@
package de.ellpeck.actuallyadditions.api.internal; package de.ellpeck.actuallyadditions.api.internal;
import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.util.Direction;
import java.util.List;
/** /**
* This is a helper interface for IFarmerBehavior. * This is a helper interface for IFarmerBehavior.
@ -23,7 +23,7 @@ import net.minecraft.util.EnumFacing;
*/ */
public interface IFarmer extends IEnergyTile { public interface IFarmer extends IEnergyTile {
EnumFacing getOrientation(); Direction getOrientation();
boolean canAddToSeeds(List<ItemStack> stacks); boolean canAddToSeeds(List<ItemStack> stacks);

View file

@ -10,19 +10,19 @@
package de.ellpeck.actuallyadditions.api.internal; package de.ellpeck.actuallyadditions.api.internal;
import java.util.List;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.EffectInstance;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import java.util.List;
/** /**
* This is the internal method handler. * This is the internal method handler.
* Use ActuallyAdditionsAPI.methodHandler for calling * Use ActuallyAdditionsAPI.methodHandler for calling
@ -32,15 +32,15 @@ public interface IMethodHandler {
boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient); boolean addEffectToStack(ItemStack stack, CoffeeIngredient ingredient);
PotionEffect getSameEffectFromStack(ItemStack stack, PotionEffect effect); EffectInstance getSameEffectFromStack(ItemStack stack, EffectInstance effect);
void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp); void addEffectProperties(ItemStack stack, EffectInstance effect, boolean addDur, boolean addAmp);
void addEffectToStack(ItemStack stack, PotionEffect effect); void addEffectToStack(ItemStack stack, EffectInstance effect);
PotionEffect[] getEffectsFromStack(ItemStack stack); EffectInstance[] getEffectsFromStack(ItemStack stack);
boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); boolean invokeConversionLens(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
boolean invokeReconstructor(IAtomicReconstructor tile); boolean invokeReconstructor(IAtomicReconstructor tile);

View file

@ -10,14 +10,14 @@
package de.ellpeck.actuallyadditions.api.laser; package de.ellpeck.actuallyadditions.api.laser;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public interface IConnectionPair { public interface IConnectionPair {
void writeToNBT(NBTTagCompound compound); void writeToNBT(CompoundNBT compound);
void readFromNBT(NBTTagCompound compound); void readFromNBT(CompoundNBT compound);
BlockPos[] getPositions(); BlockPos[] getPositions();

View file

@ -11,8 +11,8 @@
package de.ellpeck.actuallyadditions.api.lens; package de.ellpeck.actuallyadditions.api.lens;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.EnumFacing; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
/** /**
@ -27,7 +27,7 @@ public abstract class Lens {
* @param tile The tile the lens was invoked from * @param tile The tile the lens was invoked from
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks) * @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
*/ */
public abstract boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); public abstract boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
/** /**
* Returns the color in an array of 3 float values that are r, g, b * Returns the color in an array of 3 float values that are r, g, b
@ -42,7 +42,7 @@ public abstract class Lens {
/** /**
* @return If the lens can be invoked at the current time * @return If the lens can be invoked at the current time
*/ */
public boolean canInvoke(IAtomicReconstructor tile, EnumFacing sideToShootTo, int energyUsePerShot) { public boolean canInvoke(IAtomicReconstructor tile, Direction sideToShootTo, int energyUsePerShot) {
return true; return true;
} }
} }

View file

@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.api.lens;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
/** /**
@ -25,7 +25,7 @@ import net.minecraft.util.math.BlockPos;
public class LensConversion extends Lens { public class LensConversion extends Lens {
@Override @Override
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) { public boolean invoke(BlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile) {
return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile); return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile);
} }

View file

@ -7,6 +7,5 @@ public interface IDisableableItem {
* If this returns true, assume the item is not registered with the game, but may still be instantiated. * If this returns true, assume the item is not registered with the game, but may still be instantiated.
* @return If the item has not been registered with the Forge Registry. * @return If the item has not been registered with the Forge Registry.
*/ */
public boolean isDisabled(); boolean isDisabled();
} }

View file

@ -8,7 +8,7 @@
* © 2015-2017 Ellpeck * © 2015-2017 Ellpeck
*/ */
@API(owner = ActuallyAdditionsAPI.MOD_ID, apiVersion = ActuallyAdditionsAPI.API_VERSION, provides = ActuallyAdditionsAPI.API_ID) // todo: not sure how to denote this anymore
//@API(owner = ActuallyAdditionsAPI.MOD_ID, apiVersion = ActuallyAdditionsAPI.API_VERSION, provides = ActuallyAdditionsAPI.API_ID)
package de.ellpeck.actuallyadditions.api; package de.ellpeck.actuallyadditions.api;
import net.minecraftforge.fml.common.API;

View file

@ -13,34 +13,34 @@ package de.ellpeck.actuallyadditions.api.recipe;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.EffectInstance;
public class CoffeeIngredient { public class CoffeeIngredient {
protected final Ingredient input; protected final Ingredient input;
protected final int maxAmplifier; protected final int maxAmplifier;
protected PotionEffect[] effects; protected EffectInstance[] effects;
@Deprecated @Deprecated
public CoffeeIngredient(ItemStack input, PotionEffect[] effects, int maxAmplifier) { public CoffeeIngredient(ItemStack input, EffectInstance[] effects, int maxAmplifier) {
this(Ingredient.fromStacks(input), maxAmplifier, effects); this(Ingredient.fromStacks(input), maxAmplifier, effects);
} }
public CoffeeIngredient(Ingredient input, int maxAmplifier, PotionEffect... effects) { public CoffeeIngredient(Ingredient input, int maxAmplifier, EffectInstance... effects) {
this.input = input; this.input = input;
this.effects = effects; this.effects = effects;
this.maxAmplifier = maxAmplifier; this.maxAmplifier = maxAmplifier;
} }
public boolean matches(ItemStack stack) { public boolean matches(ItemStack stack) {
return this.input.apply(stack); return this.input.test(stack);
} }
public Ingredient getInput() { public Ingredient getInput() {
return this.input; return this.input;
} }
public PotionEffect[] getEffects() { public EffectInstance[] getEffects() {
return this.effects; return this.effects;
} }

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.api.recipe; package de.ellpeck.actuallyadditions.api.recipe;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -21,11 +21,14 @@ import net.minecraft.util.math.BlockPos;
*/ */
public class ColorLensChangerByDyeMeta implements IColorLensChanger { public class ColorLensChangerByDyeMeta implements IColorLensChanger {
/**
* @todo: this is very very likely to no longer work...
*/
@Override @Override
public ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) { public ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile) {
ItemStack newStack = stack.copy(); ItemStack newStack = stack.copy();
int meta = newStack.getItemDamage(); int meta = newStack.getDamage();
newStack.setItemDamage((meta + 1) % 16); newStack.setDamage((meta + 1) % 16);
return newStack; return newStack;
} }
} }

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.api.recipe; package de.ellpeck.actuallyadditions.api.recipe;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -19,15 +19,15 @@ public class CompostRecipe {
protected final Ingredient input; protected final Ingredient input;
protected final ItemStack output; protected final ItemStack output;
protected final IBlockState inputDisplay; protected final BlockState inputDisplay;
protected final IBlockState outputDisplay; protected final BlockState outputDisplay;
@Deprecated @Deprecated
public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) { public CompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) {
this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState()); this(Ingredient.fromStacks(input), inputDisplay.getDefaultState(), output, outputDisplay.getDefaultState());
} }
public CompostRecipe(Ingredient input, IBlockState inputDisplay, ItemStack output, IBlockState outputDisplay) { public CompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) {
this.input = input; this.input = input;
this.output = output; this.output = output;
this.inputDisplay = inputDisplay; this.inputDisplay = inputDisplay;
@ -35,7 +35,7 @@ public class CompostRecipe {
} }
public boolean matches(ItemStack stack) { public boolean matches(ItemStack stack) {
return this.input.apply(stack); return this.input.test(stack);
} }
public Ingredient getInput() { public Ingredient getInput() {
@ -46,11 +46,11 @@ public class CompostRecipe {
return this.output; return this.output;
} }
public IBlockState getInputDisplay() { public BlockState getInputDisplay() {
return this.inputDisplay; return this.inputDisplay;
} }
public IBlockState getOutputDisplay() { public BlockState getOutputDisplay() {
return this.outputDisplay; return this.outputDisplay;
} }

View file

@ -33,7 +33,7 @@ public class CrusherRecipe {
} }
public boolean matches(ItemStack stack) { public boolean matches(ItemStack stack) {
return this.input.apply(stack); return this.input.test(stack);
} }
public ItemStack getOutputOne() { public ItemStack getOutputOne() {

View file

@ -10,12 +10,12 @@
package de.ellpeck.actuallyadditions.api.recipe; package de.ellpeck.actuallyadditions.api.recipe;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import java.util.ArrayList;
import java.util.List;
public class EmpowererRecipe { public class EmpowererRecipe {
protected final Ingredient input; protected final Ingredient input;
@ -48,21 +48,21 @@ public class EmpowererRecipe {
} }
public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) { public boolean matches(ItemStack base, ItemStack stand1, ItemStack stand2, ItemStack stand3, ItemStack stand4) {
if (!this.input.apply(base)) return false; if (!this.input.test(base)) return false;
List<Ingredient> matches = new ArrayList<>(); List<Ingredient> matches = new ArrayList<>();
ItemStack[] stacks = { stand1, stand2, stand3, stand4 }; ItemStack[] stacks = { stand1, stand2, stand3, stand4 };
boolean[] unused = { true, true, true, true }; boolean[] unused = { true, true, true, true };
for (ItemStack s : stacks) { for (ItemStack s : stacks) {
if (unused[0] && this.modifier1.apply(s)) { if (unused[0] && this.modifier1.test(s)) {
matches.add(this.modifier1); matches.add(this.modifier1);
unused[0] = false; unused[0] = false;
} else if (unused[1] && this.modifier2.apply(s)) { } else if (unused[1] && this.modifier2.test(s)) {
matches.add(this.modifier2); matches.add(this.modifier2);
unused[1] = false; unused[1] = false;
} else if (unused[2] && this.modifier3.apply(s)) { } else if (unused[2] && this.modifier3.test(s)) {
matches.add(this.modifier3); matches.add(this.modifier3);
unused[2] = false; unused[2] = false;
} else if (unused[3] && this.modifier4.apply(s)) { } else if (unused[3] && this.modifier4.test(s)) {
matches.add(this.modifier4); matches.add(this.modifier4);
unused[3] = false; unused[3] = false;
} }

View file

@ -11,7 +11,7 @@
package de.ellpeck.actuallyadditions.api.recipe; package de.ellpeck.actuallyadditions.api.recipe;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -35,6 +35,6 @@ public interface IColorLensChanger {
* @param tile the Reconstructor doing the color conversion * @param tile the Reconstructor doing the color conversion
* @return the modified stack. Please make sure to return a modified COPY of the input stack. * @return the modified stack. Please make sure to return a modified COPY of the input stack.
*/ */
ItemStack modifyItem(ItemStack stack, IBlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile); ItemStack modifyItem(ItemStack stack, BlockState hitBlockState, BlockPos hitBlock, IAtomicReconstructor tile);
} }

View file

@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.api.recipe;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -37,7 +37,7 @@ public class LensConversionRecipe {
} }
public boolean matches(ItemStack input, Lens lens) { public boolean matches(ItemStack input, Lens lens) {
return this.input.apply(input) && this.type == lens; return this.input.test(input) && this.type == lens;
} }
public Ingredient getInput() { public Ingredient getInput() {
@ -56,6 +56,6 @@ public class LensConversionRecipe {
return this.type; return this.type;
} }
public void transformHook(ItemStack stack, IBlockState state, BlockPos pos, IAtomicReconstructor tile) { public void transformHook(ItemStack stack, BlockState state, BlockPos pos, IAtomicReconstructor tile) {
} }
} }