mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-04 03:16:24 +01:00
fix pressing recipe inconsistency (closes #1296)
This commit is contained in:
parent
b18993ed26
commit
8c79174904
2 changed files with 37 additions and 29 deletions
|
@ -1,18 +1,16 @@
|
||||||
package com.simibubi.create.content.contraptions.components.press;
|
package com.simibubi.create.content.contraptions.components.press;
|
||||||
|
|
||||||
import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.HOLD;
|
|
||||||
import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.PASS;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity.Mode;
|
import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity.Mode;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.HOLD;
|
||||||
|
import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.PASS;
|
||||||
|
|
||||||
public class BeltPressingCallbacks {
|
public class BeltPressingCallbacks {
|
||||||
|
|
||||||
|
@ -45,13 +43,25 @@ public class BeltPressingCallbacks {
|
||||||
if (!recipe.isPresent())
|
if (!recipe.isPresent())
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
ItemStack out = recipe.get()
|
List<TransportedItemStack> collect = InWorldProcessing.applyRecipeOn(transported.stack, recipe.get())
|
||||||
|
.stream()
|
||||||
|
.map(stack -> {
|
||||||
|
TransportedItemStack copy = transported.copy();
|
||||||
|
copy.stack = stack;
|
||||||
|
return copy;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (collect.isEmpty())
|
||||||
|
handler.handleProcessingOnItem(transported, TransportedItemStackHandlerBehaviour.TransportedResult.removeItem());
|
||||||
|
else
|
||||||
|
handler.handleProcessingOnItem(transported, TransportedItemStackHandlerBehaviour.TransportedResult.convertTo(collect));
|
||||||
|
/*ItemStack out = recipe.get()
|
||||||
.getRecipeOutput()
|
.getRecipeOutput()
|
||||||
.copy();
|
.copy();
|
||||||
List<ItemStack> multipliedOutput = ItemHelper.multipliedOutput(transported.stack, out);
|
List<ItemStack> multipliedOutput = ItemHelper.multipliedOutput(transported.stack, out);
|
||||||
if (multipliedOutput.isEmpty())
|
if (multipliedOutput.isEmpty())
|
||||||
transported.stack = ItemStack.EMPTY;
|
transported.stack = ItemStack.EMPTY;
|
||||||
transported.stack = multipliedOutput.get(0);
|
transported.stack = multipliedOutput.get(0);*/
|
||||||
pressTe.sendData();
|
pressTe.sendData();
|
||||||
return HOLD;
|
return HOLD;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,5 @@
|
||||||
package com.simibubi.create.content.logistics;
|
package com.simibubi.create.content.logistics;
|
||||||
|
|
||||||
import static com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.getHeatLevelOf;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
|
||||||
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
|
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
|
||||||
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
@ -47,6 +27,24 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import com.simibubi.create.AllBlocks;
|
||||||
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
|
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
|
||||||
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||||
|
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock;
|
||||||
|
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||||
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
||||||
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
|
|
||||||
|
import static com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.getHeatLevelOf;
|
||||||
|
|
||||||
public class InWorldProcessing {
|
public class InWorldProcessing {
|
||||||
|
|
||||||
public static class SplashingInv extends RecipeWrapper {
|
public static class SplashingInv extends RecipeWrapper {
|
||||||
|
@ -265,7 +263,7 @@ public class InWorldProcessing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ItemStack> applyRecipeOn(ItemStack stackIn, IRecipe<?> recipe) {
|
public static List<ItemStack> applyRecipeOn(ItemStack stackIn, IRecipe<?> recipe) {
|
||||||
List<ItemStack> stacks;
|
List<ItemStack> stacks;
|
||||||
|
|
||||||
if (recipe instanceof ProcessingRecipe) {
|
if (recipe instanceof ProcessingRecipe) {
|
||||||
|
|
Loading…
Reference in a new issue