diff --git a/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 b/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 index ba8aa929..b844328a 100644 --- a/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 +++ b/src/generated/resources/.cache/2d06ea55ee27bcb1f7f87fa8ec3e037afa7e1ad9 @@ -1,4 +1,4 @@ -// 1.19.2 2023-11-02T15:43:25.647238 Registrate Provider for createindustry [Recipes, Advancements, Loot tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] +// 1.19.2 2023-11-04T19:54:14.366805 Registrate Provider for createindustry [Recipes, Advancements, Loot tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] 50db526af77cf0ead08cadfd3f7daa8b84a40312 assets/createindustry/blockstates/air_intake.json 429437419b2ec98bd716e7ba15583b84da7488d5 assets/createindustry/blockstates/aluminum_bars.json 9e2417e479011e42ebf00685068e6b6f515f0b11 assets/createindustry/blockstates/aluminum_block.json @@ -177,7 +177,7 @@ cfeffb79459e870bcbc689066a5dc5796a6740c3 assets/createindustry/blockstates/small b920367311493b09d04aece60b7bb31ef8dbe725 assets/createindustry/blockstates/steel_bars.json 971aaeeb9224b9530cc94e60004c7d662e2ee33a assets/createindustry/blockstates/steel_block.json f6758defb35319cd27e9ebef307f23d58d79505a assets/createindustry/blockstates/steel_casing.json -563a92e24896c24260745f9f6693538418ca4bce assets/createindustry/blockstates/steel_distillation_controller.json +f1fcbc33836ee794684dc715131e184f588515e9 assets/createindustry/blockstates/steel_distillation_controller.json 0d9f0847a584e7aaa111a50aa44ca471ec58f524 assets/createindustry/blockstates/steel_distillation_output.json e67bfac13d06829552862e60ddc8ba8bfc129228 assets/createindustry/blockstates/steel_door.json 5886babd046ad3259f77a7a3a4e641e702ffcd6b assets/createindustry/blockstates/steel_fluid_tank.json @@ -811,7 +811,7 @@ c956bf54de0bb6510991596af1370831bbbbbd5a assets/createindustry/models/item/spark f1ccc71e7bec0435a40c062f9fd2b5decdf46d2f assets/createindustry/models/item/steel_bars.json 67bdc15214f58b2dab1cf71fbb1db48e917881ce assets/createindustry/models/item/steel_block.json 0bc0db3c9e33b0fabdbbf36af1bb06eff1a97022 assets/createindustry/models/item/steel_casing.json -17c49574c61baf3b122ae018d3aefc4c204c7824 assets/createindustry/models/item/steel_distillation_controller.json +5f831c7585810fe28aeb8939ee01a725bfbac7c6 assets/createindustry/models/item/steel_distillation_controller.json b2e00aeba06f4dc6ef642668a71558c809a05216 assets/createindustry/models/item/steel_distillation_output.json 3ced9a065e2c9c21ed7dfbfc8ca5d2feabcc43d9 assets/createindustry/models/item/steel_door.json 75e956841c1ae5d1e7787f2921f625d44693635c assets/createindustry/models/item/steel_fluid_tank.json diff --git a/src/generated/resources/.cache/9047e4e94996e73e9dfde3738763637fb609e07e b/src/generated/resources/.cache/9047e4e94996e73e9dfde3738763637fb609e07e index 907024f6..86c22d11 100644 --- a/src/generated/resources/.cache/9047e4e94996e73e9dfde3738763637fb609e07e +++ b/src/generated/resources/.cache/9047e4e94996e73e9dfde3738763637fb609e07e @@ -1,2 +1,2 @@ -// 1.19.2 2023-11-04T17:59:14.3408431 Create: The Factory Must Grow's lang merger -d1ce4ba37e273babae91e01f54aba93f4014b80b assets/createindustry/lang/en_us.json +// 1.19.2 2023-11-04T19:54:14.3638039 Create: The Factory Must Grow's lang merger +4089e842003f7935fe1976dc81e85c9841c7de24 assets/createindustry/lang/en_us.json diff --git a/src/generated/resources/assets/createindustry/blockstates/steel_distillation_controller.json b/src/generated/resources/assets/createindustry/blockstates/steel_distillation_controller.json index 60336caf..5d5dec04 100644 --- a/src/generated/resources/assets/createindustry/blockstates/steel_distillation_controller.json +++ b/src/generated/resources/assets/createindustry/blockstates/steel_distillation_controller.json @@ -1,7 +1,57 @@ { "variants": { - "": { + "face=ceiling,facing=east": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 180, + "y": 270 + }, + "face=ceiling,facing=north": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 180, + "y": 180 + }, + "face=ceiling,facing=south": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 180 + }, + "face=ceiling,facing=west": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 180, + "y": 90 + }, + "face=floor,facing=east": { + "model": "createindustry:block/steel_distillation_controller/block", + "y": 90 + }, + "face=floor,facing=north": { "model": "createindustry:block/steel_distillation_controller/block" + }, + "face=floor,facing=south": { + "model": "createindustry:block/steel_distillation_controller/block", + "y": 180 + }, + "face=floor,facing=west": { + "model": "createindustry:block/steel_distillation_controller/block", + "y": 270 + }, + "face=wall,facing=east": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 90, + "y": 90 + }, + "face=wall,facing=north": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 90 + }, + "face=wall,facing=south": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 90, + "y": 180 + }, + "face=wall,facing=west": { + "model": "createindustry:block/steel_distillation_controller/block", + "x": 90, + "y": 270 } } } \ No newline at end of file diff --git a/src/generated/resources/assets/createindustry/lang/en_us.json b/src/generated/resources/assets/createindustry/lang/en_us.json index abf63fdb..9285b288 100644 --- a/src/generated/resources/assets/createindustry/lang/en_us.json +++ b/src/generated/resources/assets/createindustry/lang/en_us.json @@ -353,7 +353,7 @@ "create.goggles.machine_input.no_rot": "No Rotation Provided!", "create.goggles.machine_input.power_level": "Power Level: ", - "createindustry.ponder.small_engines.text_1": "To create a small engine, place front part and back part next to each other", + "createindustry.ponder.small_engines.text_1": "To create a small engine, place a front part and a back part behind it", "createindustry.ponder.small_engines.text_2": "Fuel is inputted to the front part and exhaust is removed from the back part using pipes and an exhaust block", "createindustry.ponder.small_engines.text_3": "Engine will start when redstone signal is applied to the front part", "createindustry.ponder.small_engines.text_4": "There are engines with Gasoline, LPG and Kerosene as a fuel", @@ -361,23 +361,23 @@ "createindustry.ponder.diesel_engine_small.text_2": "Carbon Dioxide has to be outputted by pipes and exhaust block", "createindustry.ponder.diesel_engine_big.text_1": "Diesel engines can be placed next to each other to form bigger ones", "createindustry.ponder.diesel_engine_big.text_2": "This way, Diesel Engines can have very big output", - "createindustry.ponder.surface_scanner.text_1": "Surface Scanner is use for finding crude oil deposits", - "createindustry.ponder.surface_scanner.text_2": "When rotation is applied, the machine starts to find a nearest oil deposit", - "createindustry.ponder.surface_scanner.text_3": "When a deposit is found, it will write coordinates of it in a goggle tooltip", + "createindustry.ponder.surface_scanner.text_1": "Surface Scanner is used for finding crude oil deposits", + "createindustry.ponder.surface_scanner.text_2": "When rotation is applied, the machine starts to find the nearest oil deposit", + "createindustry.ponder.surface_scanner.text_3": "When a deposit is found, compass at the top will show the direction", "createindustry.ponder.surface_scanner.text_4": "X: 47 Z: 68", "createindustry.ponder.pumpjack.text_1": "First step of mining oil is building industrial pipes from deposit to surface", - "createindustry.ponder.pumpjack.text_2": "Then pumpjack has to be built on the top of the pipe", + "createindustry.ponder.pumpjack.text_2": "Pumpjack base has to be placed on the top of the pipe", "createindustry.ponder.distillation_tower.text_1": "Base of a distillation tower are steel tanks", "createindustry.ponder.distillation_tower.text_2": "Tower is assembled by placing Steel Distillation Controller next to the tanks", - "createindustry.ponder.distillation_tower.text_3": "Placing 5 Distillation outputs and 5 Industrial Pipes finishes the structure", + "createindustry.ponder.distillation_tower.text_3": "To finish the multiblock place up to 6 Distillation outputs and Industrial Pipes between them", "createindustry.ponder.distillation_tower.text_4": "Place Blaze Burners under the tanks to power it, dial on the tower shows the power level of the structure", - "createindustry.ponder.distillation_tower.text_5": "Oil is inputted into the controller block", + "createindustry.ponder.distillation_tower.text_5": "Oil is inserted into the controller block", "createindustry.ponder.distillation_tower.text_6": "Every output block outputs one of the oil products", "createindustry.ponder.distillation_tower.text_7": "LPG", - "createindustry.ponder.distillation_tower.text_8": "Kerosene", - "createindustry.ponder.distillation_tower.text_9": "Gasoline", - "createindustry.ponder.distillation_tower.text_10": "Diesel", - "createindustry.ponder.distillation_tower.text_11": "Heavy Oil", + "createindustry.ponder.distillation_tower.text_8": "Gasoline", + "createindustry.ponder.distillation_tower.text_9": "Naphtha", + "createindustry.ponder.distillation_tower.text_10": "Kerosene", + "createindustry.ponder.distillation_tower.text_11": "Diesel", "createindustry.ponder.distillation_tower.header": "Distillation Tower Setup", @@ -392,6 +392,35 @@ "createindustry.ponder.small_engines.header": "Building Small Engines", "createindustry.ponder.tag.oil": "Oil Related Machines", "createindustry.ponder.tag.oil.description": "Machines that mine, process or use crude oil and fluids created from it", + "createindustry.ponder.diesel_engine.text_1": "Diesel Engine is assembled by placing a shaft in the front of a diesel engine block", + "createindustry.ponder.diesel_engine.text_2": "Carbon Dioxide has to be outputted by pipes and exhaust block", + "createindustry.ponder.diesel_engine.text_3": "Diesel engines need air that can be collected with air intakes", + "createindustry.ponder.diesel_engine_expansion.text_1": "Diesel engine expansions give diesel engines 2 new fluid slots, for cooling and lubrication", + "createindustry.ponder.pumpjack.text_3": "Pumpjack hammer needs to be placed behind it", + "createindustry.ponder.pumpjack.text_4": "The last step is placing a machine input (which is a power input for the pumpjack) with a pumpjack crank above it", + "createindustry.ponder.distillation_tower.text_12": "Heavy Oil", + "createindustry.ponder.blast_furnace.text_1": "Main part of a blast furnace is a blast furnace output", + "createindustry.ponder.blast_furnace.text_2": "To make a blast furnace, make a cylinder of fireproof bricks around it", + "createindustry.ponder.blast_furnace.text_3": "Blast furnaces need reinforcements that are at least half the total height", + "createindustry.ponder.blast_furnace.text_4": "Everything is inserted through a hole at the top", + "createindustry.ponder.coke_oven.text_1": "Coke Oven is created by placing coke oven block as shown and clicking the front block with a wrench", + "createindustry.ponder.coke_oven.text_2": "Coke Ovens are slow so it is beneficial to have long arrays of them", + "createindustry.ponder.coke_oven.text_3": "Coal can be inserted from anywhere", + "createindustry.ponder.coke_oven.text_4": "Creosote and Carbon Dioxide have to be pumped out of the machine", + "createindustry.ponder.coke_oven.text_5": "After some time, coal coke will fall out of the machine at the front", + "createindustry.ponder.casting.text_1": "Casting is done by pouring liquid metal into a casting basin with a casting spout", + "createindustry.ponder.casting.text_2": "Casting basin needs a mold to function", + + "createindustry.ponder.diesel_engine.header": "Building Diesel Engine", + + "createindustry.ponder.diesel_engine_expansion.header": "Expanding Diesel Engines", + + "createindustry.ponder.coke_oven.header": "Building Coke Oven", + "createindustry.ponder.blast_furnace": "Building Blast Furnace", + + "createindustry.ponder.casting.header": "Casting Metal", + "createindustry.ponder.tag.metallurgy": "Metal Processing Related Machines", + "createindustry.ponder.tag.metallurgy.description": "Machines that mine, process or use crude oil and fluids created from it", "_": "->------------------------] UI & Messages [------------------------<-", diff --git a/src/generated/resources/assets/createindustry/models/item/steel_distillation_controller.json b/src/generated/resources/assets/createindustry/models/item/steel_distillation_controller.json index bc635ded..6c1af0a9 100644 --- a/src/generated/resources/assets/createindustry/models/item/steel_distillation_controller.json +++ b/src/generated/resources/assets/createindustry/models/item/steel_distillation_controller.json @@ -1,3 +1,3 @@ { - "parent": "createindustry:block/steel_distillation_controller/block" + "parent": "createindustry:block/steel_distillation_controller" } \ No newline at end of file diff --git a/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/FluidProcessingBlockEntity.java b/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/FluidProcessingBlockEntity.java index 4f14b88d..03fb080e 100644 --- a/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/FluidProcessingBlockEntity.java +++ b/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/FluidProcessingBlockEntity.java @@ -2,7 +2,7 @@ package com.drmangotea.createindustry.blocks.machines.oil_processing.distillatio import com.drmangotea.createindustry.blocks.machines.oil_processing.distillation.distillery.DistilleryControllerBlockEntity; -import com.drmangotea.createindustry.recipes.distillation.ItemlessRecipe; +import com.drmangotea.createindustry.recipes.distillation.AbstractDistillationRecipe; import com.simibubi.create.content.kinetics.base.KineticBlockEntity; import com.simibubi.create.foundation.advancement.CreateAdvancement; import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour; @@ -23,7 +23,7 @@ public abstract class FluidProcessingBlockEntity extends KineticBlockEntity { public DeferralBehaviour basinChecker; public boolean basinRemoved; - protected Recipe currentRecipe; + protected AbstractDistillationRecipe recipe; public FluidProcessingBlockEntity(BlockEntityType typeIn, BlockPos pos, BlockState state) { super(typeIn, pos, state); @@ -41,7 +41,7 @@ public abstract class FluidProcessingBlockEntity extends KineticBlockEntity { public void tick() { if (basinRemoved) { basinRemoved = false; - onBasinRemoved(); + onControllerRemoved(); sendData(); return; } @@ -50,26 +50,7 @@ public abstract class FluidProcessingBlockEntity extends KineticBlockEntity { } protected boolean updateController() { - - - if (isRunning()) - return true; - if (level == null || level.isClientSide) - return true; - - - List> recipes = getMatchingRecipes(); - if (recipes.isEmpty()) - return true; - currentRecipe = recipes.get(0); - // if(currentRecipe instanceof DistillationRecipe) { - // if (((DistillationRecipe) currentRecipe).getInputFluid().getMatchingFluidStacks().get(0).getFluid() != TFMGFluids.HEAVY_OIL.get()) { - // return true; - // } - // } - startProcessing(); - sendData(); - return true; + return false; } protected abstract boolean isRunning(); @@ -87,24 +68,13 @@ public abstract class FluidProcessingBlockEntity extends KineticBlockEntity { if (!controller.isPresent()) return false; - return ItemlessRecipe.match(controller.get(), recipe); + return AbstractDistillationRecipe.match(controller.get(), recipe); } - protected List> getMatchingRecipes() { - List> list = RecipeFinder.get(getRecipeCacheKey(), level, this::matchStaticFilters); - return list.stream() - .filter(this::matchItemlessRecipe) - .sorted((r1, r2) -> r2.getIngredients() - .size() - - r1.getIngredients() - .size()) - .collect(Collectors.toList()); - } - - protected abstract void onBasinRemoved(); + protected abstract void onControllerRemoved(); public Optional getController() { if (level == null) diff --git a/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillation_tower/DistillationOutputBlockEntity.java b/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillation_tower/DistillationOutputBlockEntity.java index a65fcf83..079257e8 100644 --- a/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillation_tower/DistillationOutputBlockEntity.java +++ b/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillation_tower/DistillationOutputBlockEntity.java @@ -2,15 +2,16 @@ package com.drmangotea.createindustry.blocks.machines.oil_processing.distillatio -import com.drmangotea.createindustry.CreateTFMG; import com.drmangotea.createindustry.blocks.machines.oil_processing.distillation.distillery.DistilleryOutputBlockEntity; -import com.drmangotea.createindustry.recipes.distillation.ItemlessRecipe; +import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe; +import com.drmangotea.createindustry.recipes.distillation.AbstractDistillationRecipe; import com.drmangotea.createindustry.recipes.distillation.AdvancedDistillationRecipe; import com.drmangotea.createindustry.registry.TFMGBlocks; import com.drmangotea.createindustry.registry.TFMGRecipeTypes; import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation; import com.simibubi.create.content.kinetics.press.MechanicalPressBlockEntity; +import com.simibubi.create.foundation.fluid.CombinedTankWrapper; import com.simibubi.create.foundation.recipe.RecipeFinder; import net.minecraft.core.BlockPos; import net.minecraft.world.Container; @@ -26,7 +27,6 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; public class DistillationOutputBlockEntity extends DistilleryOutputBlockEntity implements IHaveGoggleInformation { @@ -48,7 +48,7 @@ public class DistillationOutputBlockEntity extends DistilleryOutputBlockEntity i Optional controller = getDistillationController(); if (!controller.isPresent()) return false; - return ItemlessRecipe.match2(controller.get(), recipe); + return AbstractDistillationRecipe.match2(controller.get(), recipe); } @Override @@ -58,10 +58,23 @@ public class DistillationOutputBlockEntity extends DistilleryOutputBlockEntity i if (level == null || level.isClientSide) return true; - List> recipes = getMatchingRecipes(); - if (recipes.isEmpty()) + DistillationControllerBlockEntity be=null; + + if(level.getBlockEntity(getBlockPos().below())instanceof DistillationControllerBlockEntity) + be = (DistillationControllerBlockEntity) level.getBlockEntity(getBlockPos().below()); + + if(be==null) return true; - currentRecipe = recipes.get(0); + + recipe = getMatchingRecipes(be); + + //List> recipes = getMatchingRecipes(); + //if (recipes.isEmpty()) + // return true; + //currentRecipe = recipes.get(0); + + + startProcessing(); sendData(); return true; @@ -89,8 +102,7 @@ public class DistillationOutputBlockEntity extends DistilleryOutputBlockEntity i protected void process() { updateController(); - if (currentRecipe == null) - return; + @@ -140,10 +152,11 @@ public class DistillationOutputBlockEntity extends DistilleryOutputBlockEntity i }else foundOutputs = 4; } + if (recipe == null) + return; - - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe)currentRecipe)>foundOutputs) + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>foundOutputs) return; FluidStack fluidInRecipe1=null; FluidStack fluidInRecipe2=null; @@ -152,17 +165,17 @@ public class DistillationOutputBlockEntity extends DistilleryOutputBlockEntity i FluidStack fluidInRecipe5=null; FluidStack fluidInRecipe6=null; - fluidInRecipe1 = ((AdvancedDistillationRecipe) currentRecipe).getFirstFluidResult(); - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=2) - fluidInRecipe2 = ((AdvancedDistillationRecipe) currentRecipe).getSecondFluidResult(); - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=3) - fluidInRecipe3 = ((AdvancedDistillationRecipe) currentRecipe).getThirdFluidResult(); - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=4) - fluidInRecipe4 = ((AdvancedDistillationRecipe) currentRecipe).getFourthFluidResult(); - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=5) - fluidInRecipe5 = ((AdvancedDistillationRecipe) currentRecipe).getFifthFluidResult(); - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=6) - fluidInRecipe6 = ((AdvancedDistillationRecipe) currentRecipe).getSixthFluidResult(); + fluidInRecipe1 = ((AdvancedDistillationRecipe) recipe).getFirstFluidResult(); + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=2) + fluidInRecipe2 = ((AdvancedDistillationRecipe) recipe).getSecondFluidResult(); + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=3) + fluidInRecipe3 = ((AdvancedDistillationRecipe) recipe).getThirdFluidResult(); + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=4) + fluidInRecipe4 = ((AdvancedDistillationRecipe) recipe).getFourthFluidResult(); + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=5) + fluidInRecipe5 = ((AdvancedDistillationRecipe) recipe).getFifthFluidResult(); + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=6) + fluidInRecipe6 = ((AdvancedDistillationRecipe) recipe).getSixthFluidResult(); @@ -211,26 +224,26 @@ if(fluidInRecipe2!=null) ) return; // - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=1) - if(tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) currentRecipe).getFirstFluidResult().getAmount()>8000) + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=1) + if(tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) recipe).getFirstFluidResult().getAmount()>8000) return; - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=2) - if(((DistillationOutputBlockEntity)above1).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) currentRecipe).getSecondFluidResult().getAmount()>8000) + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=2) + if(((DistillationOutputBlockEntity)above1).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) recipe).getSecondFluidResult().getAmount()>8000) return; - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=3) - if(((DistillationOutputBlockEntity)above2).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) currentRecipe).getThirdFluidResult().getAmount()>8000) + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=3) + if(((DistillationOutputBlockEntity)above2).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) recipe).getThirdFluidResult().getAmount()>8000) return; - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=4) - if(((DistillationOutputBlockEntity)above3).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) currentRecipe).getFourthFluidResult().getAmount()>8000) + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=4) + if(((DistillationOutputBlockEntity)above3).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) recipe).getFourthFluidResult().getAmount()>8000) return; - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=5) - if(((DistillationOutputBlockEntity)above4).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) currentRecipe).getFifthFluidResult().getAmount()>8000) + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=5) + if(((DistillationOutputBlockEntity)above4).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) recipe).getFifthFluidResult().getAmount()>8000) return; - if(((AdvancedDistillationRecipe) currentRecipe).getOutputCount((AdvancedDistillationRecipe) currentRecipe)>=6) - if(((DistillationOutputBlockEntity)above5).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) currentRecipe).getSixthFluidResult().getAmount()>8000) + if(((AdvancedDistillationRecipe) recipe).getOutputCount((AdvancedDistillationRecipe) recipe)>=6) + if(((DistillationOutputBlockEntity)above5).tankInventory.getFluidAmount()+((AdvancedDistillationRecipe) recipe).getSixthFluidResult().getAmount()>8000) return; - if(getDistillationController().get().getTanks().get(true).getPrimaryHandler().getFluid().getFluid() != ((AdvancedDistillationRecipe) currentRecipe).getInputFluid().getMatchingFluidStacks().get(0).getFluid()) + if(getDistillationController().get().getTanks().get(true).getPrimaryHandler().getFluid().getFluid() != ((AdvancedDistillationRecipe) recipe).getInputFluid().getMatchingFluidStacks().get(0).getFluid()) return; DistillationControllerBlockEntity controller = optionalController.get(); @@ -262,30 +275,30 @@ if(fluidInRecipe2!=null) return; - controller.getTanks().get(true).getPrimaryHandler().drain(((AdvancedDistillationRecipe) currentRecipe).getFluidIngredients().get(0).getRequiredAmount(), IFluidHandler.FluidAction.EXECUTE); + controller.getTanks().get(true).getPrimaryHandler().drain(((AdvancedDistillationRecipe) recipe).getFluidIngredients().get(0).getRequiredAmount(), IFluidHandler.FluidAction.EXECUTE); - tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) currentRecipe).getFirstFluidResult().getFluid(), ((AdvancedDistillationRecipe) currentRecipe).getFirstFluidResult().getAmount() + this.tankInventory.getFluidAmount())); + tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) recipe).getFirstFluidResult().getFluid(), ((AdvancedDistillationRecipe) recipe).getFirstFluidResult().getAmount() + this.tankInventory.getFluidAmount())); if(above1 instanceof DistillationOutputBlockEntity) if(foundOutputs>=2) - if (((AdvancedDistillationRecipe) currentRecipe).getResults().toArray().length>1) - ((DistillationOutputBlockEntity) above1).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) currentRecipe).getSecondFluidResult().getFluid(), ((AdvancedDistillationRecipe) currentRecipe).getSecondFluidResult().getAmount() + ((DistillationOutputBlockEntity) above1).tankInventory.getFluidAmount())); + if (((AdvancedDistillationRecipe) recipe).getResults().toArray().length>1) + ((DistillationOutputBlockEntity) above1).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) recipe).getSecondFluidResult().getFluid(), ((AdvancedDistillationRecipe) recipe).getSecondFluidResult().getAmount() + ((DistillationOutputBlockEntity) above1).tankInventory.getFluidAmount())); if(above2 instanceof DistillationOutputBlockEntity) if(foundOutputs>=3) - if (((AdvancedDistillationRecipe) currentRecipe).getResults().toArray().length>2) - ((DistillationOutputBlockEntity) above2).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) currentRecipe).getThirdFluidResult().getFluid(), ((AdvancedDistillationRecipe) currentRecipe).getThirdFluidResult().getAmount() + ((DistillationOutputBlockEntity) above2).tankInventory.getFluidAmount())); + if (((AdvancedDistillationRecipe) recipe).getResults().toArray().length>2) + ((DistillationOutputBlockEntity) above2).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) recipe).getThirdFluidResult().getFluid(), ((AdvancedDistillationRecipe) recipe).getThirdFluidResult().getAmount() + ((DistillationOutputBlockEntity) above2).tankInventory.getFluidAmount())); if(above3 instanceof DistillationOutputBlockEntity) if(foundOutputs>=4) - if (((AdvancedDistillationRecipe) currentRecipe).getResults().toArray().length>3) - ((DistillationOutputBlockEntity) above3).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) currentRecipe).getFourthFluidResult().getFluid(), ((AdvancedDistillationRecipe) currentRecipe).getFourthFluidResult().getAmount() + ((DistillationOutputBlockEntity) above3).tankInventory.getFluidAmount())); + if (((AdvancedDistillationRecipe) recipe).getResults().toArray().length>3) + ((DistillationOutputBlockEntity) above3).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) recipe).getFourthFluidResult().getFluid(), ((AdvancedDistillationRecipe) recipe).getFourthFluidResult().getAmount() + ((DistillationOutputBlockEntity) above3).tankInventory.getFluidAmount())); if(above4 instanceof DistillationOutputBlockEntity) if(foundOutputs>=5) - if (((AdvancedDistillationRecipe) currentRecipe).getResults().toArray().length>4) - ((DistillationOutputBlockEntity) above4).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) currentRecipe).getFifthFluidResult().getFluid(), ((AdvancedDistillationRecipe) currentRecipe).getFifthFluidResult().getAmount() + ((DistillationOutputBlockEntity) above4).tankInventory.getFluidAmount())); + if (((AdvancedDistillationRecipe) recipe).getResults().toArray().length>4) + ((DistillationOutputBlockEntity) above4).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) recipe).getFifthFluidResult().getFluid(), ((AdvancedDistillationRecipe) recipe).getFifthFluidResult().getAmount() + ((DistillationOutputBlockEntity) above4).tankInventory.getFluidAmount())); if(above5 instanceof DistillationOutputBlockEntity) if(foundOutputs>=6) - if (((AdvancedDistillationRecipe) currentRecipe).getResults().toArray().length>5) - ((DistillationOutputBlockEntity) above5).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) currentRecipe).getSixthFluidResult().getFluid(), ((AdvancedDistillationRecipe) currentRecipe).getSixthFluidResult().getAmount() + ((DistillationOutputBlockEntity) above5).tankInventory.getFluidAmount())); + if (((AdvancedDistillationRecipe) recipe).getResults().toArray().length>5) + ((DistillationOutputBlockEntity) above5).tankInventory.setFluid(new FluidStack(((AdvancedDistillationRecipe) recipe).getSixthFluidResult().getFluid(), ((AdvancedDistillationRecipe) recipe).getSixthFluidResult().getAmount() + ((DistillationOutputBlockEntity) above5).tankInventory.getFluidAmount())); } /* @@ -302,27 +315,43 @@ if(!(((AdvancedDistillationRecipe) currentRecipe).getThirdItemResult().isEmpty() } - @Override - protected List> getMatchingRecipes() { + // @Override + // protected List> getMatchingRecipes() { +// +// + // List> list = RecipeFinder.get(getRecipeCacheKey(), level, this::matchStaticFilters); + // return list.stream() + // .filter(this::matchItemlessRecipe) + // .sorted((r1, r2) -> r2.getIngredients() + // .size() + // - r1.getIngredients() + // .size()) + // .collect(Collectors.toList()); + // } + + protected AdvancedDistillationRecipe getMatchingRecipes(DistillationControllerBlockEntity be) { List> list = RecipeFinder.get(getRecipeCacheKey(), level, this::matchStaticFilters); - return list.stream() - .filter(this::matchItemlessRecipe) - .sorted((r1, r2) -> r2.getIngredients() - .size() - - r1.getIngredients() - .size()) - .collect(Collectors.toList()); + + + for(int i = 0; i < list.toArray().length;i++){ + AdvancedDistillationRecipe recipe = (AdvancedDistillationRecipe) list.get(i); + + if(recipe.getOutputCount(recipe)!=foundOutputs) + continue; + + for(int y = 0; y < recipe.getFluidIngredients().get(0).getMatchingFluidStacks().toArray().length;y++) + if(be.inputTank.getPrimaryHandler().getFluid().getFluid()==recipe.getFluidIngredients().get(0).getMatchingFluidStacks().get(y).getFluid()) + if(be.inputTank.getPrimaryHandler().getFluidAmount()>=recipe.getFluidIngredients().get(0).getRequiredAmount()) + return recipe; + } + + return null; } - @Override protected boolean matchStaticFilters(Recipe r) { - return ((r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) - && r.getIngredients() - .size() > 1 - && !MechanicalPressBlockEntity.canCompress(r)) && !AllRecipeTypes.shouldIgnoreInAutomation(r) - || r.getType() == TFMGRecipeTypes.ADVANCED_DISTILLATION.getType()); + return r instanceof AdvancedDistillationRecipe; } @Override @@ -340,7 +369,7 @@ if(!(((AdvancedDistillationRecipe) currentRecipe).getThirdItemResult().isEmpty() } @Override - protected void onBasinRemoved() { + protected void onControllerRemoved() { if (!running) return; diff --git a/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillery/DistilleryOutputBlockEntity.java b/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillery/DistilleryOutputBlockEntity.java index d90223de..dab35d2c 100644 --- a/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillery/DistilleryOutputBlockEntity.java +++ b/src/main/java/com/drmangotea/createindustry/blocks/machines/oil_processing/distillation/distillery/DistilleryOutputBlockEntity.java @@ -2,7 +2,9 @@ package com.drmangotea.createindustry.blocks.machines.oil_processing.distillatio import com.drmangotea.createindustry.blocks.machines.oil_processing.distillation.FluidProcessingBlockEntity; +import com.drmangotea.createindustry.blocks.machines.oil_processing.distillation.distillation_tower.DistillationControllerBlockEntity; import com.drmangotea.createindustry.blocks.machines.oil_processing.distillation.distillation_tower.DistillationOutputBlockEntity; +import com.drmangotea.createindustry.recipes.distillation.AbstractDistillationRecipe; import com.drmangotea.createindustry.recipes.distillation.DistillationRecipe; import com.drmangotea.createindustry.registry.TFMGRecipeTypes; import com.simibubi.create.AllRecipeTypes; @@ -78,10 +80,8 @@ public class DistilleryOutputBlockEntity extends FluidProcessingBlockEntity impl if (level == null || level.isClientSide) return true; - List> recipes = getMatchingRecipes(); - if (recipes.isEmpty()) - return true; - currentRecipe = recipes.get(0); + + recipe = getMatchingRecipes(); startProcessing(); sendData(); return true; @@ -150,7 +150,7 @@ public class DistilleryOutputBlockEntity extends FluidProcessingBlockEntity impl protected void process() { updateController(); - if (currentRecipe == null) + if (recipe == null) return; // if((currentRecipe instanceof ShapelessRecipe)) @@ -192,9 +192,9 @@ if(above1 !=null&& above2 !=null return; - FluidStack fluidInRecipe1 = ((DistillationRecipe) currentRecipe).getFirstFluidResult(); - FluidStack fluidInRecipe2 = ((DistillationRecipe) currentRecipe).getSecondFluidResult(); - FluidStack fluidInRecipe3 = ((DistillationRecipe) currentRecipe).getThirdFluidResult(); + FluidStack fluidInRecipe1 = ((DistillationRecipe) recipe).getFirstFluidResult(); + FluidStack fluidInRecipe2 = ((DistillationRecipe) recipe).getSecondFluidResult(); + FluidStack fluidInRecipe3 = ((DistillationRecipe) recipe).getThirdFluidResult(); @@ -214,14 +214,14 @@ if(above1 !=null&& above2 !=null return; if( - tankInventory.getFluidAmount()+((DistillationRecipe) currentRecipe).getFirstFluidResult().getAmount()>8000|| - ((DistilleryOutputBlockEntity)above1).tankInventory.getFluidAmount()+((DistillationRecipe) currentRecipe).getFirstFluidResult().getAmount()>8000|| - ((DistilleryOutputBlockEntity)above2).tankInventory.getFluidAmount()+((DistillationRecipe) currentRecipe).getFirstFluidResult().getAmount()>8000 + tankInventory.getFluidAmount()+((DistillationRecipe) recipe).getFirstFluidResult().getAmount()>8000|| + ((DistilleryOutputBlockEntity)above1).tankInventory.getFluidAmount()+((DistillationRecipe) recipe).getFirstFluidResult().getAmount()>8000|| + ((DistilleryOutputBlockEntity)above2).tankInventory.getFluidAmount()+((DistillationRecipe) recipe).getFirstFluidResult().getAmount()>8000 ) return; - if(getController().get().getTanks().get(true).getPrimaryHandler().getFluid().getFluid() != ((DistillationRecipe) currentRecipe).getInputFluid().getMatchingFluidStacks().get(0).getFluid()) + if(getController().get().getTanks().get(true).getPrimaryHandler().getFluid().getFluid() != ((DistillationRecipe) recipe).getInputFluid().getMatchingFluidStacks().get(0).getFluid()) return; DistilleryControllerBlockEntity controller = optionalController.get(); @@ -237,21 +237,21 @@ if(above1 !=null&& above2 !=null // if(((DistillationRecipe)currentRecipe).getInputFluid().getMatchingFluidStacks().get(0).getFluid() != TFMGFluids.HEAVY_OIL.get()) // return; - controller.getTanks().get(true).getPrimaryHandler().drain(((DistillationRecipe) currentRecipe).getFluidIngredients().get(0).getRequiredAmount(), IFluidHandler.FluidAction.EXECUTE); + controller.getTanks().get(true).getPrimaryHandler().drain(((DistillationRecipe) recipe).getFluidIngredients().get(0).getRequiredAmount(), IFluidHandler.FluidAction.EXECUTE); - if (!(((DistillationRecipe) currentRecipe).getFluidResults().get(0).isEmpty())) - tankInventory.setFluid(new FluidStack(((DistillationRecipe) currentRecipe).getFluidResults().get(0).getFluid(), ((DistillationRecipe) currentRecipe).getFluidResults().get(0).getAmount() + this.tankInventory.getFluidAmount())); - if (!(((DistillationRecipe) currentRecipe).getFluidResults().get(1).isEmpty())) - ((DistilleryOutputBlockEntity) above1).tankInventory.setFluid(new FluidStack(((DistillationRecipe) currentRecipe).getFluidResults().get(1).getFluid(), ((DistillationRecipe) currentRecipe).getFluidResults().get(1).getAmount() + ((DistilleryOutputBlockEntity) above1).tankInventory.getFluidAmount())); - if (!(((DistillationRecipe) currentRecipe).getFluidResults().get(2).isEmpty())) - ((DistilleryOutputBlockEntity) above2).tankInventory.setFluid(new FluidStack(((DistillationRecipe) currentRecipe).getFluidResults().get(2).getFluid(), ((DistillationRecipe) currentRecipe).getFluidResults().get(2).getAmount() + ((DistilleryOutputBlockEntity) above2).tankInventory.getFluidAmount())); + if (!(((DistillationRecipe) recipe).getFluidResults().get(0).isEmpty())) + tankInventory.setFluid(new FluidStack(((DistillationRecipe) recipe).getFluidResults().get(0).getFluid(), ((DistillationRecipe) recipe).getFluidResults().get(0).getAmount() + this.tankInventory.getFluidAmount())); + if (!(((DistillationRecipe) recipe).getFluidResults().get(1).isEmpty())) + ((DistilleryOutputBlockEntity) above1).tankInventory.setFluid(new FluidStack(((DistillationRecipe) recipe).getFluidResults().get(1).getFluid(), ((DistillationRecipe) recipe).getFluidResults().get(1).getAmount() + ((DistilleryOutputBlockEntity) above1).tankInventory.getFluidAmount())); + if (!(((DistillationRecipe) recipe).getFluidResults().get(2).isEmpty())) + ((DistilleryOutputBlockEntity) above2).tankInventory.setFluid(new FluidStack(((DistillationRecipe) recipe).getFluidResults().get(2).getFluid(), ((DistillationRecipe) recipe).getFluidResults().get(2).getAmount() + ((DistilleryOutputBlockEntity) above2).tankInventory.getFluidAmount())); - if (!(((DistillationRecipe) currentRecipe).getFirstItemResult().isEmpty())) - controller.outputInventory.setItem(0, ((DistillationRecipe) currentRecipe).getFirstItemResult()); + if (!(((DistillationRecipe) recipe).getFirstItemResult().isEmpty())) + controller.outputInventory.setItem(0, ((DistillationRecipe) recipe).getFirstItemResult()); - if (!(((DistillationRecipe) currentRecipe).getSecondItemResult().isEmpty())) - controller.outputInventory.setItem(1, ((DistillationRecipe) currentRecipe).getSecondItemResult()); + if (!(((DistillationRecipe) recipe).getSecondItemResult().isEmpty())) + controller.outputInventory.setItem(1, ((DistillationRecipe) recipe).getSecondItemResult()); } /* if(!(((DistillationRecipe) currentRecipe).getThirdItemResult().isEmpty())) @@ -267,27 +267,33 @@ if(!(((DistillationRecipe) currentRecipe).getThirdItemResult().isEmpty())) } - @Override - protected List> getMatchingRecipes() { + protected DistillationRecipe getMatchingRecipes() { + + DistilleryControllerBlockEntity be=null; + + if(level.getBlockEntity(getBlockPos().below())instanceof DistilleryControllerBlockEntity) + be = (DistilleryControllerBlockEntity) level.getBlockEntity(getBlockPos().below()); + + if(be==null) + return null; List> list = RecipeFinder.get(getRecipeCacheKey(), level, this::matchStaticFilters); - return list.stream() - .filter(this::matchItemlessRecipe) - .sorted((r1, r2) -> r2.getIngredients() - .size() - - r1.getIngredients() - .size()) - .collect(Collectors.toList()); + + + for(int i = 0; i < list.toArray().length;i++){ + DistillationRecipe recipe = (DistillationRecipe) list.get(i); + for(int y = 0; y < recipe.getFluidIngredients().get(0).getMatchingFluidStacks().toArray().length;y++) + if(be.inputTank.getPrimaryHandler().getFluid().getFluid()==recipe.getFluidIngredients().get(0).getMatchingFluidStacks().get(y).getFluid()) + if(be.inputTank.getPrimaryHandler().getFluidAmount()>=recipe.getFluidIngredients().get(0).getRequiredAmount()) + return recipe; + } + + return null; } - @Override protected boolean matchStaticFilters(Recipe r) { - return ((r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) - && r.getIngredients() - .size() > 1 - && !MechanicalPressBlockEntity.canCompress(r)) && !AllRecipeTypes.shouldIgnoreInAutomation(r) - || r.getType() == TFMGRecipeTypes.DISTILLATION.getType()); + return r instanceof DistillationRecipe; } @Override @@ -305,7 +311,7 @@ if(!(((DistillationRecipe) currentRecipe).getThirdItemResult().isEmpty())) } @Override - protected void onBasinRemoved() { + protected void onControllerRemoved() { if (!running) return; @@ -367,7 +373,7 @@ if(!(((DistillationRecipe) currentRecipe).getThirdItemResult().isEmpty())) - + @SuppressWarnings("removal") public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { return containedFluidTooltip(tooltip, isPlayerSneaking, @@ -375,6 +381,7 @@ if(!(((DistillationRecipe) currentRecipe).getThirdItemResult().isEmpty())) } @Nonnull + @SuppressWarnings("removal") @Override public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { if (!fluidCapability.isPresent()) diff --git a/src/main/java/com/drmangotea/createindustry/recipes/distillation/ItemlessRecipe.java b/src/main/java/com/drmangotea/createindustry/recipes/distillation/AbstractDistillationRecipe.java similarity index 89% rename from src/main/java/com/drmangotea/createindustry/recipes/distillation/ItemlessRecipe.java rename to src/main/java/com/drmangotea/createindustry/recipes/distillation/AbstractDistillationRecipe.java index 332d6a7e..4e9cbc18 100644 --- a/src/main/java/com/drmangotea/createindustry/recipes/distillation/ItemlessRecipe.java +++ b/src/main/java/com/drmangotea/createindustry/recipes/distillation/AbstractDistillationRecipe.java @@ -23,15 +23,15 @@ import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; import java.util.List; - -public class ItemlessRecipe extends ProcessingRecipe { +@SuppressWarnings("removal") +public class AbstractDistillationRecipe extends ProcessingRecipe { public static boolean match(DistilleryControllerBlockEntity controller, Recipe recipe) { - if(recipe instanceof ItemlessRecipe) { + if(recipe instanceof AbstractDistillationRecipe) { return apply(controller, recipe, true); } @@ -45,7 +45,7 @@ public class ItemlessRecipe extends ProcessingRecipe { } private static boolean apply(DistilleryControllerBlockEntity controller, Recipe recipe, boolean test) { - boolean isItemlessRecipe = recipe instanceof ItemlessRecipe; + boolean isItemlessRecipe = recipe instanceof AbstractDistillationRecipe; IItemHandler availableItems = controller.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) .orElse(null); IFluidHandler availableFluids = controller.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) @@ -57,7 +57,7 @@ public class ItemlessRecipe extends ProcessingRecipe { BlazeBurnerBlock.HeatLevel heat = DistilleryControllerBlockEntity.getHeatLevelOf(controller.getLevel() .getBlockState(controller.getBlockPos() .below(1))); - if (isItemlessRecipe && !((ItemlessRecipe) recipe).getRequiredHeat() + if (isItemlessRecipe && !((AbstractDistillationRecipe) recipe).getRequiredHeat() .testBlazeBurner(heat)) return false; @@ -66,7 +66,7 @@ public class ItemlessRecipe extends ProcessingRecipe { List fluidIngredients = - isItemlessRecipe ? ((ItemlessRecipe) recipe).getFluidIngredients() : Collections.emptyList(); + isItemlessRecipe ? ((AbstractDistillationRecipe) recipe).getFluidIngredients() : Collections.emptyList(); if(!fluidIngredients.isEmpty()) @@ -116,7 +116,7 @@ public class ItemlessRecipe extends ProcessingRecipe { } if (simulate) { - if (recipe instanceof ItemlessRecipe ItemlessRecipe) { + if (recipe instanceof AbstractDistillationRecipe ItemlessRecipe) { recipeOutputItems.addAll(ItemlessRecipe.rollResults()); recipeOutputFluids.addAll(ItemlessRecipe.getFluidResults()); @@ -132,7 +132,7 @@ public class ItemlessRecipe extends ProcessingRecipe { public static boolean match2(DistillationControllerBlockEntity controller, Recipe recipe) { - if(recipe instanceof ItemlessRecipe) { + if(recipe instanceof AbstractDistillationRecipe) { return apply(controller, recipe, true); } @@ -141,7 +141,7 @@ public class ItemlessRecipe extends ProcessingRecipe { } private static boolean apply2(DistillationControllerBlockEntity controller, Recipe recipe, boolean test) { - boolean isItemlessRecipe = recipe instanceof ItemlessRecipe; + boolean isItemlessRecipe = recipe instanceof AbstractDistillationRecipe; IItemHandler availableItems = controller.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) .orElse(null); IFluidHandler availableFluids = controller.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) @@ -153,7 +153,7 @@ public class ItemlessRecipe extends ProcessingRecipe { BlazeBurnerBlock.HeatLevel heat = DistilleryControllerBlockEntity.getHeatLevelOf(controller.getLevel() .getBlockState(controller.getBlockPos() .below(1))); - if (isItemlessRecipe && !((ItemlessRecipe) recipe).getRequiredHeat() + if (isItemlessRecipe && !((AbstractDistillationRecipe) recipe).getRequiredHeat() .testBlazeBurner(heat)) return false; @@ -162,7 +162,7 @@ public class ItemlessRecipe extends ProcessingRecipe { List fluidIngredients = - isItemlessRecipe ? ((ItemlessRecipe) recipe).getFluidIngredients() : Collections.emptyList(); + isItemlessRecipe ? ((AbstractDistillationRecipe) recipe).getFluidIngredients() : Collections.emptyList(); if(!fluidIngredients.isEmpty()) @@ -212,7 +212,7 @@ public class ItemlessRecipe extends ProcessingRecipe { } if (simulate) { - if (recipe instanceof ItemlessRecipe ItemlessRecipe) { + if (recipe instanceof AbstractDistillationRecipe ItemlessRecipe) { recipeOutputItems.addAll(ItemlessRecipe.rollResults()); recipeOutputFluids.addAll(ItemlessRecipe.getFluidResults()); @@ -226,7 +226,7 @@ public class ItemlessRecipe extends ProcessingRecipe { return true; } - protected ItemlessRecipe(IRecipeTypeInfo type, ProcessingRecipeBuilder.ProcessingRecipeParams params) { + protected AbstractDistillationRecipe(IRecipeTypeInfo type, ProcessingRecipeBuilder.ProcessingRecipeParams params) { super(type, params); } diff --git a/src/main/java/com/drmangotea/createindustry/recipes/distillation/AdvancedDistillationRecipe.java b/src/main/java/com/drmangotea/createindustry/recipes/distillation/AdvancedDistillationRecipe.java index ba78d588..dfe806b0 100644 --- a/src/main/java/com/drmangotea/createindustry/recipes/distillation/AdvancedDistillationRecipe.java +++ b/src/main/java/com/drmangotea/createindustry/recipes/distillation/AdvancedDistillationRecipe.java @@ -4,12 +4,12 @@ package com.drmangotea.createindustry.recipes.distillation; import com.drmangotea.createindustry.registry.TFMGRecipeTypes; import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder; +import com.simibubi.create.foundation.fluid.CombinedTankWrapper; import com.simibubi.create.foundation.fluid.FluidIngredient; import net.minecraft.core.NonNullList; -import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public class AdvancedDistillationRecipe extends ItemlessRecipe { +public class AdvancedDistillationRecipe extends AbstractDistillationRecipe { public AdvancedDistillationRecipe(ProcessingRecipeBuilder.ProcessingRecipeParams params) { super(TFMGRecipeTypes.ADVANCED_DISTILLATION, params); @@ -56,4 +56,11 @@ public class AdvancedDistillationRecipe extends ItemlessRecipe { protected int getMaxOutputCount() { return 0; } + + public boolean matches(CombinedTankWrapper inv) { + if (inv.getFluidInTank(0).getAmount()==0) + return false; + return fluidIngredients.get(0) + .test(inv.getFluidInTank(0)); + } } diff --git a/src/main/java/com/drmangotea/createindustry/recipes/distillation/DistillationRecipe.java b/src/main/java/com/drmangotea/createindustry/recipes/distillation/DistillationRecipe.java index c7a732c6..f1dc4d9f 100644 --- a/src/main/java/com/drmangotea/createindustry/recipes/distillation/DistillationRecipe.java +++ b/src/main/java/com/drmangotea/createindustry/recipes/distillation/DistillationRecipe.java @@ -5,11 +5,10 @@ package com.drmangotea.createindustry.recipes.distillation; import com.drmangotea.createindustry.registry.TFMGRecipeTypes; import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder; import com.simibubi.create.foundation.fluid.FluidIngredient; -import mezz.jei.api.constants.RecipeTypes; import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public class DistillationRecipe extends ItemlessRecipe { +public class DistillationRecipe extends AbstractDistillationRecipe { public DistillationRecipe(ProcessingRecipeBuilder.ProcessingRecipeParams params) { super(TFMGRecipeTypes.DISTILLATION, params); diff --git a/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java b/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java index 62382bd2..b1361613 100644 --- a/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java +++ b/src/main/java/com/drmangotea/createindustry/registry/TFMGBlocks.java @@ -500,7 +500,7 @@ public static final BlockEntry STEEL_DISTILLATION_OUTPU public static final BlockEntry STEEL_DISTILLATION_CONTROLLER = REGISTRATE.block("steel_distillation_controller", DistillationControllerBlock::new) .initialProperties(SharedProperties::copperMetal) - .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov))) + .blockstate((c, p) -> p.horizontalFaceBlock(c.get(), AssetLookup.partialBaseModel(c, p))) .transform(pickaxeOnly()) .item() .build() diff --git a/src/main/resources/assets/createindustry/models/block/air_intake/block_empty.json b/src/main/resources/assets/createindustry/models/block/air_intake/block_empty.json index 0716da87..863b88f5 100644 --- a/src/main/resources/assets/createindustry/models/block/air_intake/block_empty.json +++ b/src/main/resources/assets/createindustry/models/block/air_intake/block_empty.json @@ -1,3 +1,6 @@ { - "parent": "block/air" + "parent": "block/air", + "textures": { + "particle": "createindustry:block/air_intake/air_intake_small" + } } \ No newline at end of file diff --git a/src/main/resources/assets/createindustry/models/block/steel_distillation_controller.json b/src/main/resources/assets/createindustry/models/block/steel_distillation_controller.json new file mode 100644 index 00000000..87ed6932 --- /dev/null +++ b/src/main/resources/assets/createindustry/models/block/steel_distillation_controller.json @@ -0,0 +1,24 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "createindustry:block/distillation_controller", + "1": "createindustry:block/distillation_controller_front", + "2": "createindustry:block/distillation_controller_top", + "particle": "createindustry:block/distillation_controller" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#2"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/createindustry/models/block/steel_distillation_controller/block.json b/src/main/resources/assets/createindustry/models/block/steel_distillation_controller/block.json index 87ed6932..e25b4f73 100644 --- a/src/main/resources/assets/createindustry/models/block/steel_distillation_controller/block.json +++ b/src/main/resources/assets/createindustry/models/block/steel_distillation_controller/block.json @@ -12,12 +12,12 @@ "from": [0, 0, 0], "to": [16, 16, 16], "faces": { - "north": {"uv": [0, 0, 16, 16], "texture": "#1"}, - "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, - "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, - "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, - "up": {"uv": [0, 0, 16, 16], "texture": "#2"}, - "down": {"uv": [0, 0, 16, 16], "texture": "#2"} + "north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#2"}, + "east": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "west": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} } } ] diff --git a/src/main/resources/data/createindustry/recipes/fractional_distillation/crude_oil_sus.json b/src/main/resources/data/createindustry/recipes/fractional_distillation/crude_oil_sus.json index 1800a0de..4e0ec6f5 100644 --- a/src/main/resources/data/createindustry/recipes/fractional_distillation/crude_oil_sus.json +++ b/src/main/resources/data/createindustry/recipes/fractional_distillation/crude_oil_sus.json @@ -21,10 +21,6 @@ "fluid": "createindustry:kerosene", "amount": 1 }, - { - "fluid": "createindustry:naphtha", - "amount": 1 - }, { "fluid": "createindustry:gasoline", "amount": 3