diff --git a/src/main/java/com/zorbatron/zbgt/api/pattern/TraceabilityPredicates.java b/src/main/java/com/zorbatron/zbgt/api/pattern/TraceabilityPredicates.java index 03f4e555..f79be00e 100644 --- a/src/main/java/com/zorbatron/zbgt/api/pattern/TraceabilityPredicates.java +++ b/src/main/java/com/zorbatron/zbgt/api/pattern/TraceabilityPredicates.java @@ -9,6 +9,7 @@ import net.minecraft.block.state.IBlockState; import com.zorbatron.zbgt.api.ZBGTAPI; +import com.zorbatron.zbgt.api.util.ZBGTMods; import com.zorbatron.zbgt.common.block.blocks.CoALCasing; import com.zorbatron.zbgt.common.block.blocks.PreciseCasing; @@ -117,6 +118,24 @@ public static TraceabilityPredicate machineCasings() { return MACHINE_CASING_PREDICATE.get(); } + public static TraceabilityPredicate AIR_BLOCKS_COUNTED = new TraceabilityPredicate( + blockWorldState -> { + boolean isAirBlock = blockWorldState.getBlockState().getBlock().isAir(blockWorldState.getBlockState(), + blockWorldState.getWorld(), blockWorldState.getPos()); + + if (isAirBlock) { + blockWorldState.getMatchContext().getOrPut("AirBlocks", new LinkedList<>()) + .add(blockWorldState.getPos()); + return true; + } + + return false; + }); + + public static TraceabilityPredicate airBlockWithCount() { + return AIR_BLOCKS_COUNTED; + } + public static TraceabilityPredicate autoBusesAndHatches(RecipeMap[] recipeMaps) { boolean checkedItemIn = false, checkedItemOut = false, checkedFluidIn = false, checkedFluidOut = false; TraceabilityPredicate predicate = new TraceabilityPredicate(); @@ -155,13 +174,17 @@ public static TraceabilityPredicate autoBusesAndHatches(RecipeMap recipeMap) return autoBusesAndHatches(new RecipeMap[] { recipeMap }); } - public static TraceabilityPredicate maintenanceHatch(MultiblockControllerBase controller) { + public static TraceabilityPredicate maintenanceOrParallel(MultiblockControllerBase controller) { TraceabilityPredicate predicate = new TraceabilityPredicate( abilities(MultiblockAbility.MAINTENANCE_HATCH).setExactLimit(1)); - if (controller instanceof IParallelMultiblock) { - predicate = predicate - .or(abilities(GCYMMultiblockAbility.PARALLEL_HATCH).setMaxGlobalLimited(1).setPreviewCount(1)); + // Check if GYCM is loaded before checking if the controller is an IParallelMultiblock because if it isn't bad + // stuff will happen + if (ZBGTMods.GCYM.isModLoaded()) { + if (controller instanceof IParallelMultiblock) { + predicate = predicate + .or(abilities(GCYMMultiblockAbility.PARALLEL_HATCH).setMaxGlobalLimited(1).setPreviewCount(1)); + } } return predicate; diff --git a/src/main/java/com/zorbatron/zbgt/common/ZBGTMetaTileEntities.java b/src/main/java/com/zorbatron/zbgt/common/ZBGTMetaTileEntities.java index 8f3edd14..205b1de4 100644 --- a/src/main/java/com/zorbatron/zbgt/common/ZBGTMetaTileEntities.java +++ b/src/main/java/com/zorbatron/zbgt/common/ZBGTMetaTileEntities.java @@ -6,6 +6,8 @@ import com.zorbatron.zbgt.api.util.ZBGTMods; import com.zorbatron.zbgt.common.metatileentities.multi.electric.*; import com.zorbatron.zbgt.common.metatileentities.multi.electric.megamultis.*; +import com.zorbatron.zbgt.common.metatileentities.multi.electric.quads.MetaTileEntityQuadEBF; +import com.zorbatron.zbgt.common.metatileentities.multi.electric.quads.MetaTileEntityQueezer; import com.zorbatron.zbgt.common.metatileentities.multi.multiblockpart.*; import com.zorbatron.zbgt.common.metatileentities.storage.MetaTileEntityCreativeComputationProvider; @@ -30,9 +32,12 @@ public class ZBGTMetaTileEntities { public static MetaTileEntityMegaOCU MEGA_OCU; public static MetaTileEntityMegaABS MEGA_ABS; public static MetaTileEntityPreciseAssembler PRASS; - public static MetaTileEntityQuadEBF QUAD_EBF; + public static MetaTileEntityCoAL CoAL; + public static MetaTileEntityQuadEBF QUAD_EBF; + public static MetaTileEntityQueezer QUEEZER; + public static void init() { // 18000-18049 (50) reserved for multiblock parts CREATIVE_ENERGY_SOURCE = registerMetaTileEntity(18000, @@ -105,5 +110,7 @@ public static void init() { QUAD_EBF = registerMetaTileEntity(18057, new MetaTileEntityQuadEBF(zbgtId("quad_ebf"))); + QUEEZER = registerMetaTileEntity(18058, + new MetaTileEntityQueezer(zbgtId("queezer"))); } } diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/MetaTileEntityCoAL.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/MetaTileEntityCoAL.java index feb1410a..16d298a0 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/MetaTileEntityCoAL.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/MetaTileEntityCoAL.java @@ -144,7 +144,7 @@ protected BlockPattern createStructurePattern() { .where('P', states(getPipeCasingState())) .where('C', states(getCasingState()).setMinGlobalLimited(630) .or(autoEnergyInputs()) - .or(maintenanceHatch(this)) + .or(maintenanceOrParallel(this)) .or(autoBusesAndHatches(getRecipeMap())) .or(abilities(MultiblockAbility.COMPUTATION_DATA_RECEPTION) .setExactLimit(1))) diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaABS.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaABS.java index f4bf2c0a..c6b59764 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaABS.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaABS.java @@ -25,7 +25,6 @@ import com.zorbatron.zbgt.api.render.ZBGTTextures; import com.zorbatron.zbgt.common.ZBGTMetaTileEntities; -import gregicality.multiblocks.api.metatileentity.GCYMMultiblockAbility; import gregicality.multiblocks.api.recipes.GCYMRecipeMaps; import gregicality.multiblocks.api.render.GCYMTextures; import gregicality.multiblocks.common.block.GCYMMetaBlocks; @@ -127,9 +126,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { .where('G', states(getGlassState())) .where('M', abilities(MultiblockAbility.MUFFLER_HATCH)) .where('C', heatingCoils()) - .where('W', abilities(MultiblockAbility.MAINTENANCE_HATCH).setMinGlobalLimited(1).setMaxGlobalLimited(1) - .or(abilities(GCYMMultiblockAbility.PARALLEL_HATCH).setMaxGlobalLimited(1).setPreviewCount(1)) - .or(states(getCasingState()))) + .where('W', states(getCasingState()) + .or(TraceabilityPredicates.maintenanceOrParallel(this))) .where('#', air()) .build(); } diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/MetaTileEntityQuadEBF.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQuadEBF.java similarity index 99% rename from src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/MetaTileEntityQuadEBF.java rename to src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQuadEBF.java index b67a2e1d..6e0af1f6 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/MetaTileEntityQuadEBF.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQuadEBF.java @@ -1,4 +1,4 @@ -package com.zorbatron.zbgt.common.metatileentities.multi.electric; +package com.zorbatron.zbgt.common.metatileentities.multi.electric.quads; import java.util.ArrayList; import java.util.Comparator; diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQueezer.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQueezer.java new file mode 100644 index 00000000..7cb91361 --- /dev/null +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQueezer.java @@ -0,0 +1,69 @@ +package com.zorbatron.zbgt.common.metatileentities.multi.electric.quads; + +import static gregtech.api.util.RelativeDirection.*; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import org.jetbrains.annotations.NotNull; + +import com.zorbatron.zbgt.api.pattern.TraceabilityPredicates; + +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.multiblock.IMultiblockPart; +import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; +import gregtech.api.pattern.BlockPattern; +import gregtech.api.pattern.FactoryBlockPattern; +import gregtech.api.recipes.RecipeMaps; +import gregtech.client.renderer.ICubeRenderer; +import gregtech.client.renderer.texture.Textures; +import gregtech.common.blocks.BlockMetalCasing; +import gregtech.common.blocks.MetaBlocks; +import gregtech.core.sound.GTSoundEvents; + +public class MetaTileEntityQueezer extends RecipeMapMultiblockController { + + public MetaTileEntityQueezer(ResourceLocation metaTileEntityId) { + super(metaTileEntityId, RecipeMaps.VACUUM_RECIPES); + this.recipeMapWorkable.setParallelLimit(4); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { + return new MetaTileEntityQueezer(metaTileEntityId); + } + + @Override + protected @NotNull BlockPattern createStructurePattern() { + return FactoryBlockPattern.start(RIGHT, FRONT, DOWN) + .aisle("XXXXX", "XXXXX", "XXXXX", "XXXXX", "XXXXX") + .aisle("XXSXX", "X#X#X", "XXXXX", "X#X#X", "XXXXX") + .aisle("XXXXX", "XXXXX", "XXXXX", "XXXXX", "XXXXX") + .where('S', selfPredicate()) + .where('X', states(getCasingState()) + .or(TraceabilityPredicates.autoBusesAndHatches(getRecipeMap())) + .or(TraceabilityPredicates.autoEnergyInputs(1, 8)) + .or(TraceabilityPredicates.maintenanceOrParallel(this))) + .where('#', air()) + .build(); + } + + protected IBlockState getCasingState() { + return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.ALUMINIUM_FROSTPROOF); + } + + @Override + public SoundEvent getBreakdownSound() { + return GTSoundEvents.BREAKDOWN_ELECTRICAL; + } + + @SideOnly(Side.CLIENT) + @Override + public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) { + return Textures.FROST_PROOF_CASING; + } +} diff --git a/src/main/java/com/zorbatron/zbgt/recipe/MultiblockRecipes.java b/src/main/java/com/zorbatron/zbgt/recipe/MultiblockRecipes.java index 48aeccc3..8a1afb50 100644 --- a/src/main/java/com/zorbatron/zbgt/recipe/MultiblockRecipes.java +++ b/src/main/java/com/zorbatron/zbgt/recipe/MultiblockRecipes.java @@ -35,6 +35,14 @@ private static void craftingTableRecipes() { 'P', new UnificationEntry(plateDouble, Invar), 'B', MetaTileEntities.ELECTRIC_BLAST_FURNACE.getStackForm(), 'C', new UnificationEntry(circuit, getMarkerMaterialByTier(HV))); + + ModHandler.addShapedRecipe("queezer", ZBGTMetaTileEntities.QUEEZER.getStackForm(), + "PBP", + "BCB", + "PBP", + 'P', new UnificationEntry(plateDouble, Aluminium), + 'B', MetaTileEntities.VACUUM_FREEZER.getStackForm(), + 'C', new UnificationEntry(circuit, getMarkerMaterialByTier(HV))); } private static void assemblerRecipes() { @@ -101,6 +109,16 @@ private static void assemblerRecipes() { .output(ZBGTMetaTileEntities.PRASS) .EUt(VA[IV]).duration(20 * 18) .buildAndRegister(); + + ASSEMBLER_RECIPES.recipeBuilder() + .input(MetaTileEntities.VACUUM_FREEZER, 4) + .input(plate, Aluminium, 4) + .input(circuit, getMarkerMaterialByTier(HV)) + .fluidInputs(SolderingAlloy.getFluid(L * 4)) + .circuitMeta(4) + .output(ZBGTMetaTileEntities.QUEEZER) + .duration(20 * 5).EUt(VA[HV]) + .buildAndRegister(); } private static void assemblyLineRecipes() {