Skip to content

Commit

Permalink
More multiblock previews + fix qEBF only allowing 1 to 2 energy hatch…
Browse files Browse the repository at this point in the history
…es (#19)

* Make the quad ebf's preview better (also fix it only allowing 8 energy hatches)

* Move xD

* spotless :clueless:

* I should do that

* Yippe also fix tooltip xD
  • Loading branch information
Zorbatron authored Sep 10, 2024
1 parent 6df4632 commit c5fdf90
Show file tree
Hide file tree
Showing 9 changed files with 314 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
import java.util.Collections;
import java.util.List;

import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import org.jetbrains.annotations.Nullable;

import com.zorbatron.zbgt.ZBGTConfig;

Expand All @@ -14,6 +19,7 @@
import gregtech.api.metatileentity.multiblock.MultiblockAbility;
import gregtech.api.pattern.TraceabilityPredicate;
import gregtech.api.recipes.RecipeMap;
import gregtech.client.utils.TooltipHelper;

public abstract class LaserCapableMultiMapMultiblockController extends MultiMapMultiblockController {

Expand Down Expand Up @@ -79,4 +85,12 @@ public TraceabilityPredicate autoEnergyInputs(int min, int max) {
public TraceabilityPredicate autoEnergyInputs() {
return autoEnergyInputs(1, 3);
}

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format(I18n.format("zbgt.laser_enabled.1") +
TooltipHelper.RAINBOW + I18n.format("zbgt.laser_enabled.2")) +
(allowsSubstationHatches() ? I18n.format("zbgt.substation_enabled") : ""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
import java.util.Collections;
import java.util.List;

import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import org.jetbrains.annotations.Nullable;

import com.zorbatron.zbgt.ZBGTConfig;

Expand All @@ -14,6 +19,7 @@
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.pattern.TraceabilityPredicate;
import gregtech.api.recipes.RecipeMap;
import gregtech.client.utils.TooltipHelper;

public abstract class LaserCapableRecipeMapMultiblockController extends RecipeMapMultiblockController {

Expand Down Expand Up @@ -80,4 +86,12 @@ public TraceabilityPredicate autoEnergyInputs(int min, int max) {
public TraceabilityPredicate autoEnergyInputs() {
return autoEnergyInputs(1, 3);
}

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format(I18n.format("zbgt.laser_enabled.1") +
TooltipHelper.RAINBOW + I18n.format("zbgt.laser_enabled.2")) +
(allowsSubstationHatches() ? I18n.format("zbgt.substation_enabled") : ""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
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 {

Expand Down Expand Up @@ -162,4 +166,22 @@ public static TraceabilityPredicate maintenanceHatch(MultiblockControllerBase co

return predicate;
}

public static TraceabilityPredicate autoEnergyInputs(int min, int max, int previewCount) {
return new TraceabilityPredicate(abilities(MultiblockAbility.INPUT_ENERGY, MultiblockAbility.INPUT_LASER)
.setMinGlobalLimited(min).setMaxGlobalLimited(max).setPreviewCount(previewCount));
}

public static TraceabilityPredicate autoEnergyInputs(int min, int max) {
return autoEnergyInputs(min, max, 2);
}

public static TraceabilityPredicate autoEnergyInputs() {
return autoEnergyInputs(1, 3);
}

public static Supplier<?> getMaintenanceHatchMTE() {
return () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH :
MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.INVAR_HEATPROOF);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ protected void addDisplayText(List<ITextComponent> textList) {

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);

tooltip.add(I18n.format("zbgt.machine.coal.description.1"));
tooltip.add(I18n.format("zbgt.machine.coal.description.2"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.zorbatron.zbgt.common.metatileentities.multi.electric;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.text.ITextComponent;
Expand All @@ -18,7 +22,11 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import com.zorbatron.zbgt.api.pattern.TraceabilityPredicates;
import com.zorbatron.zbgt.common.ZBGTMetaTileEntities;

import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.block.IHeatingCoilBlockStats;
import gregtech.api.capability.IHeatingCoil;
import gregtech.api.metatileentity.MetaTileEntity;
Expand All @@ -29,6 +37,7 @@
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.pattern.BlockPattern;
import gregtech.api.pattern.FactoryBlockPattern;
import gregtech.api.pattern.MultiblockShapeInfo;
import gregtech.api.pattern.PatternMatchContext;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeMaps;
Expand All @@ -41,6 +50,7 @@
import gregtech.common.blocks.BlockMetalCasing;
import gregtech.common.blocks.BlockWireCoil;
import gregtech.common.blocks.MetaBlocks;
import gregtech.common.metatileentities.MetaTileEntities;
import gregtech.core.sound.GTSoundEvents;

public class MetaTileEntityQuadEBF extends RecipeMapMultiblockController implements IHeatingCoil {
Expand Down Expand Up @@ -68,7 +78,8 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
.where('S', selfPredicate())
.where('C', heatingCoils())
.where('X', states(getCasingState())
.or(autoAbilities(true, true, true, true, true, true, false)))
.or(autoAbilities(false, true, true, true, true, true, false))
.or(TraceabilityPredicates.autoEnergyInputs(1, 8)))
.where('M', abilities(MultiblockAbility.MUFFLER_HATCH))
.where('#', air())
.build();
Expand All @@ -78,6 +89,33 @@ protected IBlockState getCasingState() {
return MetaBlocks.METAL_CASING.getState(BlockMetalCasing.MetalCasingType.INVAR_HEATPROOF);
}

@Override
public List<MultiblockShapeInfo> getMatchingShapes() {
ArrayList<MultiblockShapeInfo> shapeInfo = new ArrayList<>();

MultiblockShapeInfo.Builder builder = MultiblockShapeInfo.builder()
.aisle("EEXEE", "CCCCC", "CCCCC", "EEXEE")
.aisle("XXXXX", "C#C#C", "C#C#C", "XMXMX")
.aisle("XXXXX", "CCCCC", "CCCCC", "XXFXX")
.aisle("XXXXX", "C#C#C", "C#C#C", "XMXMX")
.aisle("XISOX", "CCCCC", "CCCCC", "XXZXX")
.where('S', ZBGTMetaTileEntities.QUAD_EBF, EnumFacing.SOUTH)
.where('X', getCasingState())
.where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(), 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)
.where('E', MetaTileEntities.ENERGY_INPUT_HATCH[1], EnumFacing.NORTH)
.where('F', MetaTileEntities.FLUID_IMPORT_HATCH[1], EnumFacing.UP)
.where('#', Blocks.AIR.getDefaultState());

GregTechAPI.HEATING_COILS.entrySet().stream()
.sorted(Comparator.comparingInt(entry -> entry.getValue().getTier()))
.forEach(entry -> shapeInfo.add(builder.where('C', entry.getKey()).build()));

return shapeInfo;
}

@Override
public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
return Textures.HEAT_PROOF_CASING;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.zorbatron.zbgt.common.metatileentities.multi.electric.megamultis;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
Expand All @@ -19,14 +23,17 @@
import com.zorbatron.zbgt.api.metatileentity.LaserCapableGCYMRecipeMapMultiblockController;
import com.zorbatron.zbgt.api.pattern.TraceabilityPredicates;
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;
import gregicality.multiblocks.common.block.blocks.BlockLargeMultiblockCasing;
import gregicality.multiblocks.common.block.blocks.BlockUniqueCasing;
import gregicality.multiblocks.common.metatileentities.GCYMMetaTileEntities;
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.block.IHeatingCoilBlockStats;
import gregtech.api.capability.IHeatingCoil;
import gregtech.api.metatileentity.MetaTileEntity;
Expand All @@ -36,6 +43,7 @@
import gregtech.api.metatileentity.multiblock.MultiblockDisplayText;
import gregtech.api.pattern.BlockPattern;
import gregtech.api.pattern.FactoryBlockPattern;
import gregtech.api.pattern.MultiblockShapeInfo;
import gregtech.api.pattern.PatternMatchContext;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.recipeproperties.TemperatureProperty;
Expand All @@ -46,6 +54,7 @@
import gregtech.common.blocks.BlockGlassCasing;
import gregtech.common.blocks.BlockWireCoil;
import gregtech.common.blocks.MetaBlocks;
import gregtech.common.metatileentities.MetaTileEntities;

public class MetaTileEntityMegaABS extends LaserCapableGCYMRecipeMapMultiblockController implements IHeatingCoil {

Expand Down Expand Up @@ -138,6 +147,78 @@ protected IBlockState getGlassState() {
return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.TEMPERED_GLASS);
}

@Override
public List<MultiblockShapeInfo> getMatchingShapes() {
ArrayList<MultiblockShapeInfo> shapeInfo = new ArrayList<>();

MultiblockShapeInfo.Builder builder = MultiblockShapeInfo.builder()
.aisle("###XXXXX###", "###VVVVV###", "###GGGGG###", "###GGGGG###", "###GGGGG###", "###VVVVV###",
"###XXXXX###", "###########", "###########", "###########", "###########", "###########",
"###########", "###########", "###########", "###########", "###########", "###########",
"###########", "###########")
.aisle("##XXXXXXX##", "##V#####V##", "##G#####G##", "##G#####G##", "##G#####G##", "##V#####V##",
"##X#####X##", "###XXXXX###", "###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###",
"###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###",
"###GGGGG###", "###XXXXX###")
.aisle("#XXXXXXXXX#", "#V#CCCCC#V#", "#G#CCCCC#G#", "#G#CCCCC#G#", "#G#CCCCC#G#", "#V#CCCCC#V#",
"#X#CCCCC#X#", "##XCCCCCX##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##",
"##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##",
"##GCCCCCG##", "##XXXXXXX##")
.aisle("DXXXXXXXXXE", "V#C#####C#V", "G#C#####C#G", "G#C#####C#G", "G#C#####C#G", "V#C#####C#V",
"X#C#####C#X", "#XC#####CX#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#XXXXXXXXX#")
.aisle("DXXXXXXXXXE", "V#C#####C#V", "G#C#####C#G", "G#C#####C#G", "G#C#####C#G", "V#C#####C#V",
"X#C#####C#X", "#XC#####CX#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#XXXXXXXXX#")
.aisle("XXXXXXXXXXX", "V#C#####C#V", "G#C#####C#G", "G#C#####C#G", "G#C#####C#G", "V#C#####C#V",
"X#C#####C#X", "#XC#####CX#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#XXXXMXXXX#")
.aisle("DXXXXXXXXXE", "V#C#####C#V", "G#C#####C#G", "G#C#####C#G", "G#C#####C#G", "V#C#####C#V",
"X#C#####C#X", "#XC#####CX#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#XXXXXXXXX#")
.aisle("DXXXXXXXXXE", "V#C#####C#V", "G#C#####C#G", "G#C#####C#G", "G#C#####C#G", "V#C#####C#V",
"X#C#####C#X", "#XC#####CX#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#", "#GC#####CG#",
"#GC#####CG#", "#XXXXXXXXX#")
.aisle("#XXXXXXXXX#", "#V#CCCCC#V#", "#G#CCCCC#G#", "#G#CCCCC#G#", "#G#CCCCC#G#", "#V#CCCCC#V#",
"#X#CCCCC#X#", "##XCCCCCX##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##",
"##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##", "##GCCCCCG##",
"##GCCCCCG##", "##XXXXXXX##")
.aisle("##XXXXXXX##", "##V#####V##", "##G#####G##", "##G#####G##", "##G#####G##", "##V#####V##",
"##X#####X##", "###XXXXX###", "###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###",
"###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###", "###GGGGG###",
"###GGGGG###", "###XXXXX###")
.aisle("###IFXXO###", "###VVVVV###", "###GWPWG###", "###GWSWG###", "###GWZWG###", "###VVVVV###",
"###XXXXX###", "###########", "###########", "###########", "###########", "###########",
"###########", "###########", "###########", "###########", "###########", "###########",
"###########", "###########")
.where('S', ZBGTMetaTileEntities.MEGA_ABS, EnumFacing.SOUTH)
.where('Z', TraceabilityPredicates.getMaintenanceHatchMTE(), EnumFacing.SOUTH)
.where('P', GCYMMetaTileEntities.PARALLEL_HATCH[0], EnumFacing.SOUTH)
.where('X', getCasingState())
.where('V', getVentState())
.where('G', getGlassState())
.where('M', MetaTileEntities.MUFFLER_HATCH[1], EnumFacing.UP)
.where('W', getCasingState())
.where('X', getCasingState())
.where('I', MetaTileEntities.ITEM_IMPORT_BUS[1], EnumFacing.SOUTH)
.where('F', MetaTileEntities.FLUID_IMPORT_HATCH[1], EnumFacing.SOUTH)
.where('O', MetaTileEntities.FLUID_EXPORT_HATCH[1], EnumFacing.SOUTH)
.where('E', MetaTileEntities.ENERGY_INPUT_HATCH[1], EnumFacing.EAST)
.where('D', MetaTileEntities.ENERGY_INPUT_HATCH[1], EnumFacing.WEST)
.where('#', Blocks.AIR.getDefaultState());

GregTechAPI.HEATING_COILS.entrySet().stream()
.sorted(Comparator.comparingInt(entry -> entry.getValue().getTier()))
.forEach(entry -> shapeInfo.add(builder.where('C', entry.getKey()).build()));

return shapeInfo;
}

@Override
protected void addDisplayText(List<ITextComponent> textList) {
MultiblockDisplayText.builder(textList, isStructureFormed())
Expand Down
Loading

0 comments on commit c5fdf90

Please sign in to comment.