Skip to content

Commit

Permalink
Merge pull request #26 from JamiesWhiteShirt/recipe-remainders
Browse files Browse the repository at this point in the history
Fix recipe remainders for meals
  • Loading branch information
Meredith Espinosa authored Feb 10, 2020
2 parents fc8aea8 + 30d7d36 commit 497ca58
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.util.DefaultedList;

public class CookingResultSlot extends CraftingResultSlot {
Expand All @@ -24,7 +21,7 @@ public CookingResultSlot(PlayerEntity player, CraftingInventory craftInv, Invent
@Override
public ItemStack onTakeItem(PlayerEntity player, ItemStack result) {
this.onCrafted(result);
DefaultedList<ItemStack> remainders = player.world.getRecipeManager().getRemainingStacks(RecipeType.CRAFTING, this.craftingInv, player.world);
DefaultedList<ItemStack> remainders = player.world.getRecipeManager().getRemainingStacks(EpicureanRecipes.MEAL, this.craftingInv, player.world);

for(int i = 0; i < remainders.size(); ++i) {
ItemStack ingredient = this.craftingInv.getInvStack(i);
Expand All @@ -33,7 +30,7 @@ public ItemStack onTakeItem(PlayerEntity player, ItemStack result) {
this.craftingInv.takeInvStack(i, 1);
ingredient = this.craftingInv.getInvStack(i);
}
if (!ingredient.getItem().hasRecipeRemainder()) continue;

if (!remainder.isEmpty()) {
if (ingredient.isEmpty()) {
this.craftingInv.setInvStack(i, remainder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ public JellyItem(int hunger, float saturation) {
super(hunger, saturation, EpicureanItems.defaultSettings().recipeRemainder(Items.GLASS_BOTTLE));
}

@Override
public boolean hasRecipeRemainder() {
return true;
}

@Override
public boolean hasEnchantmentGlint(ItemStack stack) {
return stack.getItem() == EpicureanItems.SUPER_JELLY;
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/io/github/cottonmc/epicurean/item/MealItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ public MealItem(int hunger, float saturation) {
super(EpicureanItems.foodSettings(hunger, saturation));
}

@Override
public boolean hasRecipeRemainder() {
return false;
}


@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity entity) {
if (entity instanceof PlayerEntity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ public SeasoningItem(int hungerRestored, float saturationModifier, StatusEffect
this.effect = effect;
}

@Override
public boolean hasRecipeRemainder() {
return false;
}

public int getHungerRestored(ItemStack stack) {
return this.hungerRestored;
}
Expand Down

0 comments on commit 497ca58

Please sign in to comment.