Fix #1322 JEI missing most squeezer recipes

This commit is contained in:
mezz committed 2016-06-13 21:33:32 -07:00
1 parent 7aa840282f
commit af55bd86a2
6 files changed
+13 -14

No files matched your search

@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.recipes;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -24,6 +26,7 @@ public interface ISqueezerRecipe extends IForestryRecipe {
/**
* @return Item stack representing the possible remnants from this recipe. (i.e. tin left over from tin cans)
*/
@Nullable
ItemStack getRemnants();
/**
@@ -30,7 +30,7 @@ public class ForestryTooltipCallback implements ITooltipCallback<ItemStack> {
} else if (chance > 1.0) {
chance = 1.0f;
}
NumberFormat percentFormat = NumberFormat.getPercentInstance();
percentFormat.setMaximumFractionDigits(2);
String chanceString = String.valueOf(percentFormat.format(chance));
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.factory.recipes;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -21,10 +23,11 @@ public class SqueezerRecipe implements ISqueezerRecipe {
private final int processingTime;
private final ItemStack[] resources;
private final FluidStack fluidOutput;
@Nullable
private final ItemStack remnants;
private final float remnantsChance;
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, ItemStack remnants, float remnantsChance) {
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, @Nullable ItemStack remnants, float remnantsChance) {
this.processingTime = processingTime;
this.resources = resources;
this.fluidOutput = fluidOutput;
@@ -38,6 +41,7 @@ public class SqueezerRecipe implements ISqueezerRecipe {
}
@Override
@Nullable
public ItemStack getRemnants() {
return remnants;
}
@@ -51,16 +51,7 @@ public class SqueezerRecipeHandler<R extends ForestryRecipeWrapper> implements I
if (wrapper.getInputs() == null || wrapper.getInputs().isEmpty()) {
return false;
}
if (wrapper.getOutputs() == null || wrapper.getOutputs().isEmpty()) {
return false;
}
if (wrapper.getRecipe() instanceof ISqueezerContainerRecipe) {
ISqueezerContainerRecipe recipe = (ISqueezerContainerRecipe) wrapper.getRecipe();
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
} else {
ISqueezerRecipe recipe = (ISqueezerRecipe) wrapper.getRecipe();
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
}
return true;
}
}
@@ -34,7 +34,8 @@ public class SqueezerRecipeWrapper extends AbstractSqueezerRecipeWrapper<ISqueez
@Nonnull
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(getRecipe().getRemnants());
ItemStack remnants = getRecipe().getRemnants();
return remnants == null ? Collections.emptyList() : Collections.singletonList(remnants);
}
@Override