mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 04:03:42 +01:00
Merge pull request #1659 from PepperCode1/mc1.16/fan-processing-cleanup
Clean Up In-World Processing
This commit is contained in:
commit
66f2e00c78
11 changed files with 53 additions and 53 deletions
|
@ -9,10 +9,10 @@ import com.simibubi.create.AllSoundEvents;
|
|||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
|
||||
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.State;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe;
|
||||
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.TransportedItemStackHandlerBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
|
||||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.content.contraptions.particle.AirFlowParticleData;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing.Type;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing.Type;
|
||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
|
|
|
@ -3,22 +3,22 @@ package com.simibubi.create.content.contraptions.components.fan;
|
|||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing.SplashingWrapper;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder.ProcessingRecipeParams;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing.SplashingInv;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public class SplashingRecipe extends ProcessingRecipe<InWorldProcessing.SplashingInv> {
|
||||
public class SplashingRecipe extends ProcessingRecipe<InWorldProcessing.SplashingWrapper> {
|
||||
|
||||
public SplashingRecipe(ProcessingRecipeParams params) {
|
||||
super(AllRecipeTypes.SPLASHING, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(SplashingInv inv, World worldIn) {
|
||||
public boolean matches(SplashingWrapper inv, World worldIn) {
|
||||
if (inv.isEmpty())
|
||||
return false;
|
||||
return ingredients.get(0)
|
||||
|
|
|
@ -9,9 +9,9 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity.Mode;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||
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.TransportedItemStackHandlerBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult;
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.simibubi.create.AllSoundEvents;
|
|||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.processing.BasinOperatingTileEntity;
|
||||
import com.simibubi.create.content.contraptions.processing.BasinTileEntity;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||
import com.simibubi.create.foundation.advancement.ITriggerable;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
|
|
|
@ -4,7 +4,7 @@ import javax.annotation.Nonnull;
|
|||
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.fan.IAirCurrentSource;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.content.logistics;
|
||||
package com.simibubi.create.content.contraptions.processing;
|
||||
|
||||
import static com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.getHeatLevelOf;
|
||||
|
||||
|
@ -12,7 +12,6 @@ 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;
|
||||
|
@ -37,9 +36,6 @@ import net.minecraft.nbt.CompoundNBT;
|
|||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.particles.RedstoneParticleData;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tileentity.BlastFurnaceTileEntity;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
import net.minecraft.tileentity.SmokerTileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
@ -50,13 +46,8 @@ import net.minecraftforge.items.wrapper.RecipeWrapper;
|
|||
|
||||
public class InWorldProcessing {
|
||||
|
||||
public static class SplashingInv extends RecipeWrapper {
|
||||
public SplashingInv() {
|
||||
super(new ItemStackHandler(1));
|
||||
}
|
||||
}
|
||||
|
||||
public static SplashingInv splashingInv = new SplashingInv();
|
||||
private static final RecipeWrapper WRAPPER = new RecipeWrapper(new ItemStackHandler(1));
|
||||
private static final SplashingWrapper SPLASHING_WRAPPER = new SplashingWrapper();
|
||||
|
||||
public enum Type {
|
||||
SMOKING, BLASTING, SPLASHING, NONE
|
||||
|
@ -104,16 +95,27 @@ public class InWorldProcessing {
|
|||
|
||||
private static boolean canProcess(ItemStack stack, Type type, World world) {
|
||||
if (type == Type.BLASTING) {
|
||||
return true;
|
||||
WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<FurnaceRecipe> smeltingRecipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.SMELTING, WRAPPER, world);
|
||||
|
||||
if (smeltingRecipe.isPresent())
|
||||
return true;
|
||||
|
||||
WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<BlastingRecipe> blastingRecipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.BLASTING, WRAPPER, world);
|
||||
|
||||
if (blastingRecipe.isPresent())
|
||||
return true;
|
||||
|
||||
return !stack.getItem().isFireproof();
|
||||
}
|
||||
|
||||
if (type == Type.SMOKING) {
|
||||
// FIXME this does not need to be a TE
|
||||
SmokerTileEntity smoker = new SmokerTileEntity();
|
||||
smoker.setLocation(world, BlockPos.ZERO);
|
||||
smoker.setInventorySlotContents(0, stack);
|
||||
WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<SmokingRecipe> recipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.SMOKING, smoker, world);
|
||||
.getRecipe(IRecipeType.SMOKING, WRAPPER, world);
|
||||
return recipe.isPresent();
|
||||
}
|
||||
|
||||
|
@ -124,8 +126,8 @@ public class InWorldProcessing {
|
|||
}
|
||||
|
||||
public static boolean isWashable(ItemStack stack, World world) {
|
||||
splashingInv.setInventorySlotContents(0, stack);
|
||||
Optional<SplashingRecipe> recipe = AllRecipeTypes.SPLASHING.find(splashingInv, world);
|
||||
SPLASHING_WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<SplashingRecipe> recipe = AllRecipeTypes.SPLASHING.find(SPLASHING_WRAPPER, world);
|
||||
return recipe.isPresent();
|
||||
}
|
||||
|
||||
|
@ -179,38 +181,29 @@ public class InWorldProcessing {
|
|||
|
||||
private static List<ItemStack> process(ItemStack stack, Type type, World world) {
|
||||
if (type == Type.SPLASHING) {
|
||||
splashingInv.setInventorySlotContents(0, stack);
|
||||
Optional<SplashingRecipe> recipe = AllRecipeTypes.SPLASHING.find(splashingInv, world);
|
||||
SPLASHING_WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<SplashingRecipe> recipe = AllRecipeTypes.SPLASHING.find(SPLASHING_WRAPPER, world);
|
||||
if (recipe.isPresent())
|
||||
return applyRecipeOn(stack, recipe.get());
|
||||
return null;
|
||||
}
|
||||
|
||||
// FIXME this does not need to be a TE
|
||||
SmokerTileEntity smoker = new SmokerTileEntity();
|
||||
smoker.setLocation(world, BlockPos.ZERO);
|
||||
smoker.setInventorySlotContents(0, stack);
|
||||
WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<SmokingRecipe> smokingRecipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.SMOKING, smoker, world);
|
||||
.getRecipe(IRecipeType.SMOKING, WRAPPER, world);
|
||||
|
||||
if (type == Type.BLASTING) {
|
||||
// FIXME this does not need to be a TE
|
||||
FurnaceTileEntity furnace = new FurnaceTileEntity();
|
||||
furnace.setLocation(world, BlockPos.ZERO);
|
||||
furnace.setInventorySlotContents(0, stack);
|
||||
Optional<FurnaceRecipe> smeltingRecipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.SMELTING, furnace, world);
|
||||
|
||||
if (!smokingRecipe.isPresent()) {
|
||||
WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<FurnaceRecipe> smeltingRecipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.SMELTING, WRAPPER, world);
|
||||
|
||||
if (smeltingRecipe.isPresent())
|
||||
return applyRecipeOn(stack, smeltingRecipe.get());
|
||||
|
||||
// FIXME this does not need to be a TE
|
||||
BlastFurnaceTileEntity blastFurnace = new BlastFurnaceTileEntity();
|
||||
blastFurnace.setLocation(world, BlockPos.ZERO);
|
||||
blastFurnace.setInventorySlotContents(0, stack);
|
||||
WRAPPER.setInventorySlotContents(0, stack);
|
||||
Optional<BlastingRecipe> blastingRecipe = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.BLASTING, blastFurnace, world);
|
||||
.getRecipe(IRecipeType.BLASTING, WRAPPER, world);
|
||||
|
||||
if (blastingRecipe.isPresent())
|
||||
return applyRecipeOn(stack, blastingRecipe.get());
|
||||
|
@ -299,6 +292,7 @@ public class InWorldProcessing {
|
|||
|
||||
return stacks;
|
||||
}
|
||||
|
||||
public static void spawnParticlesForProcessing(@Nullable World world, Vector3d vec, Type type) {
|
||||
if (world == null || !world.isRemote)
|
||||
return;
|
||||
|
@ -325,4 +319,10 @@ public class InWorldProcessing {
|
|||
}
|
||||
}
|
||||
|
||||
public static class SplashingWrapper extends RecipeWrapper {
|
||||
public SplashingWrapper() {
|
||||
super(new ItemStackHandler(1));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.relays.belt.transport;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.stream.Collectors;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
import com.simibubi.create.content.logistics.item.filter.attribute.BookAuthorAttribute;
|
||||
import com.simibubi.create.content.logistics.item.filter.attribute.BookCopyAttribute;
|
||||
import com.simibubi.create.content.logistics.item.filter.attribute.ColorAttribute;
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.simibubi.create.AllBlocks;
|
|||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.Advancement.Builder;
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.block.Block;
|
||||
|
|
Loading…
Reference in a new issue