Skip to content

Commit

Permalink
Queezer (#23)
Browse files Browse the repository at this point in the history
* init

* Queeze deez nu-
  • Loading branch information
Zorbatron authored Sep 12, 2024
1 parent 9737c65 commit 36059fc
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand Down Expand Up @@ -105,5 +110,7 @@ public static void init() {

QUAD_EBF = registerMetaTileEntity(18057,
new MetaTileEntityQuadEBF(zbgtId("quad_ebf")));
QUEEZER = registerMetaTileEntity(18058,
new MetaTileEntityQueezer(zbgtId("queezer")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
18 changes: 18 additions & 0 deletions src/main/java/com/zorbatron/zbgt/recipe/MultiblockRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 36059fc

Please sign in to comment.