diff --git a/src/main/java/com/zorbatron/zbgt/ZBGTCore.java b/src/main/java/com/zorbatron/zbgt/ZBGTCore.java index 74fe924b..0401be5c 100644 --- a/src/main/java/com/zorbatron/zbgt/ZBGTCore.java +++ b/src/main/java/com/zorbatron/zbgt/ZBGTCore.java @@ -18,6 +18,8 @@ import com.zorbatron.zbgt.common.block.blocks.PreciseCasing; import gregtech.GTInternalTags; +import gregtech.api.GTValues; +import gregtech.api.GregTechAPI; import gregtech.common.blocks.BlockMachineCasing; import gregtech.common.blocks.MetaBlocks; @@ -60,6 +62,8 @@ public void preInit(FMLPreInitializationEvent event) { } for (BlockMachineCasing.MachineCasingType type : BlockMachineCasing.MachineCasingType.values()) { + if (type.ordinal() > (GregTechAPI.isHighTier() ? GTValues.MAX : GTValues.UHV)) continue; + MACHINE_CASINGS.put(MetaBlocks.MACHINE_CASING.getState(type), type); } 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 75a6fbe4..da4ed9d1 100644 --- a/src/main/java/com/zorbatron/zbgt/api/pattern/TraceabilityPredicates.java +++ b/src/main/java/com/zorbatron/zbgt/api/pattern/TraceabilityPredicates.java @@ -12,18 +12,13 @@ import com.zorbatron.zbgt.common.block.blocks.CoALCasing; import com.zorbatron.zbgt.common.block.blocks.PreciseCasing; -import gregicality.multiblocks.api.capability.IParallelMultiblock; -import gregicality.multiblocks.api.metatileentity.GCYMMultiblockAbility; import gregtech.api.metatileentity.multiblock.MultiblockAbility; -import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; import gregtech.api.pattern.PatternStringError; import gregtech.api.pattern.TraceabilityPredicate; import gregtech.api.recipes.RecipeMap; import gregtech.api.util.BlockInfo; import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockMachineCasing; -import gregtech.common.blocks.BlockMetalCasing; -import gregtech.common.blocks.MetaBlocks; import gregtech.common.metatileentities.MetaTileEntities; public class TraceabilityPredicates { @@ -131,6 +126,7 @@ public static TraceabilityPredicate machineCasings() { return false; }); + @SuppressWarnings("unused") public static TraceabilityPredicate airBlockWithCount() { return AIR_BLOCKS_COUNTED; } @@ -169,24 +165,12 @@ public static TraceabilityPredicate autoBusesAndHatches(RecipeMap[] recipeMap return predicate; } + @SuppressWarnings("unused") public static TraceabilityPredicate autoBusesAndHatches(RecipeMap recipeMap) { return autoBusesAndHatches(new RecipeMap[] { recipeMap }); } - 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)); - } - - return predicate; - } - - public static Supplier getMaintenanceHatchMTE() { - return () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : - MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.INVAR_HEATPROOF); + public static Supplier getMaintenanceHatchMTE(IBlockState defaultCasing) { + return () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : defaultCasing; } } 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 16d298a0..a4cd357a 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 @@ -143,11 +143,8 @@ protected BlockPattern createStructurePattern() { .where('B', states(getAssemblyControlState())) .where('P', states(getPipeCasingState())) .where('C', states(getCasingState()).setMinGlobalLimited(630) - .or(autoEnergyInputs()) - .or(maintenanceOrParallel(this)) - .or(autoBusesAndHatches(getRecipeMap())) - .or(abilities(MultiblockAbility.COMPUTATION_DATA_RECEPTION) - .setExactLimit(1))) + .or(abilities(MultiblockAbility.COMPUTATION_DATA_RECEPTION).setExactLimit(1)) + .or(autoAbilities(true, true, true, true, true, true, false))) .where('#', air()) .build(); } 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 c6b59764..21a41604 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 @@ -127,7 +127,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { .where('M', abilities(MultiblockAbility.MUFFLER_HATCH)) .where('C', heatingCoils()) .where('W', states(getCasingState()) - .or(TraceabilityPredicates.maintenanceOrParallel(this))) + .or(autoAbilities(false, true, false, false, false, false, false))) .where('#', air()) .build(); } @@ -195,7 +195,7 @@ public List getMatchingShapes() { "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########") .where('S', ZBGTMetaTileEntities.MEGA_ABS, EnumFacing.SOUTH) - .where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(), EnumFacing.SOUTH) + .where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(getCasingState()), EnumFacing.SOUTH) .where('P', GCYMMetaTileEntities.PARALLEL_HATCH[0], EnumFacing.SOUTH) .where('X', getCasingState()) .where('V', getVentState()) diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaEBF.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaEBF.java index 9e298bf7..4048a6a8 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaEBF.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaEBF.java @@ -221,7 +221,7 @@ public List getMatchingShapes() { .where('X', getCasingState()) .where('G', getGlassState()) .where('M', MetaTileEntities.MUFFLER_HATCH[1], EnumFacing.UP) - .where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(), EnumFacing.SOUTH) + .where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(getCasingState()), EnumFacing.SOUTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[1], EnumFacing.NORTH) .where('I', MetaTileEntities.ITEM_IMPORT_BUS[1], EnumFacing.SOUTH) .where('O', MetaTileEntities.ITEM_EXPORT_BUS[1], EnumFacing.SOUTH) diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaLCR.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaLCR.java index d6f7c182..4ae2af17 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaLCR.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaLCR.java @@ -20,7 +20,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; import gregtech.api.metatileentity.multiblock.IMultiblockPart; -import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.pattern.BlockPattern; import gregtech.api.pattern.FactoryBlockPattern; import gregtech.api.recipes.RecipeMaps; @@ -59,7 +58,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { .where('#', air()) .where('G', states(getGlassState())) .where('F', states(getCoilState())) - .where('M', abilities(MultiblockAbility.MAINTENANCE_HATCH)) + .where('M', maintenancePredicate()) .where('E', states(getCasingState()) .or(autoEnergyInputs(1, 8))) .where('H', states(getCasingState()) diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaOCU.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaOCU.java index 277b2d65..4201c47a 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaOCU.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityMegaOCU.java @@ -133,7 +133,7 @@ public List getMatchingShapes() { .where('S', ZBGTMetaTileEntities.MEGA_OCU, EnumFacing.SOUTH) .where('G', getGlassState()) .where('X', getCasingState()) - .where('M', TraceabilityPredicates.getMaintenanceHatchMTE(), EnumFacing.SOUTH) + .where('M', TraceabilityPredicates.getMaintenanceHatchMTE(getCasingState()), EnumFacing.SOUTH) .where('P', GCYMMetaTileEntities.PARALLEL_HATCH[0], EnumFacing.SOUTH) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[1], EnumFacing.NORTH) .where('I', MetaTileEntities.FLUID_IMPORT_HATCH[1], EnumFacing.WEST) diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityPreciseAssembler.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityPreciseAssembler.java index 13abd63a..6295e8a4 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityPreciseAssembler.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/megamultis/MetaTileEntityPreciseAssembler.java @@ -101,18 +101,20 @@ public List getMatchingShapes() { .where('G', MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.TEMPERED_GLASS)) .where('F', MetaBlocks.FRAMES.get(Materials.TungstenSteel).getBlock(Materials.TungstenSteel)) .where('E', MetaTileEntities.ENERGY_INPUT_HATCH[GTValues.LV], EnumFacing.SOUTH) - .where('M', TraceabilityPredicates.getMaintenanceHatchMTE(), - EnumFacing.SOUTH) .where('#', Blocks.AIR.getDefaultState()); ZBGTAPI.MACHINE_CASINGS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getValue().ordinal())) - .forEach(entry -> shapeInfo.add(builder - .where('H', entry.getKey()) - .where('X', - ZBGTMetaBlocks.PRECISE_CASING.getState( - PreciseCasing.CasingType.getCasingByTier(entry.getValue().ordinal()))) - .build())); + .forEach(entry -> { + IBlockState preciseCasingState = ZBGTMetaBlocks.PRECISE_CASING + .getState(PreciseCasing.CasingType.getCasingByTier(entry.getValue().ordinal())); + shapeInfo.add(builder + .where('H', entry.getKey()) + .where('X', preciseCasingState) + .where('M', TraceabilityPredicates.getMaintenanceHatchMTE(preciseCasingState), + EnumFacing.SOUTH) + .build()); + }); return shapeInfo; } diff --git a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQuadEBF.java b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQuadEBF.java index 413cb5fb..b9d1c347 100644 --- a/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQuadEBF.java +++ b/src/main/java/com/zorbatron/zbgt/common/metatileentities/multi/electric/quads/MetaTileEntityQuadEBF.java @@ -104,7 +104,7 @@ public List getMatchingShapes() { .aisle("XISOX", "CCCCC", "CCCCC", "XXZXX") .where('S', ZBGTMetaTileEntities.QUAD_EBF, EnumFacing.SOUTH) .where('X', getCasingState()) - .where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(), EnumFacing.SOUTH) + .where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(getCasingState()), EnumFacing.SOUTH) .where('M', MetaTileEntities.MUFFLER_HATCH[GTValues.LV], EnumFacing.UP) .where('I', MetaTileEntities.ITEM_IMPORT_BUS[1], EnumFacing.SOUTH) .where('O', MetaTileEntities.ITEM_EXPORT_BUS[1], EnumFacing.SOUTH) 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 index e3b0d71f..01a9b9e2 100644 --- 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 @@ -10,8 +10,6 @@ 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; @@ -46,8 +44,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { .aisle("XXXXX", "XXXXX", "XXXXX", "XXXXX", "XXXXX") .where('S', selfPredicate()) .where('X', states(getCasingState()) - .or(TraceabilityPredicates.autoBusesAndHatches(getRecipeMap())) - .or(TraceabilityPredicates.maintenanceOrParallel(this)) + .or(autoAbilities(false, true, true, true, true, true, false)) .or(abilities(MultiblockAbility.INPUT_ENERGY) .setMinGlobalLimited(1) .setMaxGlobalLimited(8) diff --git a/src/main/resources/assets/zbgt/lang/en_us.lang b/src/main/resources/assets/zbgt/lang/en_us.lang index e203ff4c..41af8764 100644 --- a/src/main/resources/assets/zbgt/lang/en_us.lang +++ b/src/main/resources/assets/zbgt/lang/en_us.lang @@ -198,6 +198,8 @@ zbgt.multiblock.pattern.coal_tier=§cAll casings must be the same tier§r zbgt.multiblock.pattern.error.casings=§cAll casings must be the same tier§r +zbgt.multiblock.pattern.error.machine_casings=§cAll machine casings must be the same tier§r + # Random zbgt.laser_enabled.1=Can use zbgt.laser_enabled.2= Laser Hatches