Skip to content

Commit

Permalink
fix heating coil predicate (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 authored Jul 4, 2022
1 parent 841ba0a commit 943a873
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import gregtech.common.items.MetaItems;
import gregtech.common.metatileentities.MetaTileEntities;
import gregtech.common.worldgen.LootTableHelper;
import gregtech.integration.jei.recipe.primitive.OreByProduct;
import gregtech.integration.theoneprobe.TheOneProbeCompatibility;
import gregtech.loaders.dungeon.DungeonLootLoader;
import net.minecraft.block.state.IBlockState;
Expand Down Expand Up @@ -139,6 +138,7 @@ public void onPreInit(FMLPreInitializationEvent event) {
/* Start Heating Coil Registration */
for (BlockWireCoil.CoilType type : BlockWireCoil.CoilType.values()) {
HEATING_COILS.put(MetaBlocks.WIRE_COIL.getState(type), type);
HEATING_COILS.put(MetaBlocks.WIRE_COIL.getState(type, true), type);
}
/* End Heating Coil Registration */

Expand Down
14 changes: 13 additions & 1 deletion src/main/java/gregtech/api/pattern/TraceabilityPredicate.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import gregtech.api.GregTechAPI;
import gregtech.api.block.IHeatingCoilBlockStats;
import gregtech.api.block.VariantActiveBlock;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.metatileentity.multiblock.MultiblockControllerBase;
Expand Down Expand Up @@ -40,7 +41,18 @@ public class TraceabilityPredicate {
return true;
}
return false;
}, () -> GregTechAPI.HEATING_COILS.keySet().stream().map(key -> new BlockInfo(key, null)).toArray(BlockInfo[]::new))
}, () -> GregTechAPI.HEATING_COILS.entrySet().stream()
.filter(entry -> {
// do not include the active versions of blocks in jei to prevent "duplicates"
if (entry.getKey().getPropertyKeys().contains(VariantActiveBlock.ACTIVE)) {
return !entry.getKey().getValue(VariantActiveBlock.ACTIVE);
}
return true;
})
// sort to make autogenerated jei previews not pick random coils each game load
.sorted(Comparator.comparingInt(entry -> entry.getValue().getTier()))
.map(entry -> new BlockInfo(entry.getKey(), null))
.toArray(BlockInfo[]::new))
.addTooltips("gregtech.multiblock.pattern.error.coils");

public final List<SimplePredicate> common = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.block.IHeatingCoilBlockStats;
import gregtech.api.block.VariantActiveBlock;
import gregtech.api.capability.IHeatingCoil;
import gregtech.api.capability.impl.HeatingCoilRecipeLogic;
import gregtech.api.metatileentity.MetaTileEntity;
Expand Down Expand Up @@ -161,6 +162,12 @@ public List<MultiblockShapeInfo> getMatchingShapes() {
.where('H', MetaTileEntities.MUFFLER_HATCH[GTValues.LV], EnumFacing.UP)
.where('M', () -> ConfigHolder.machines.enableMaintenance ? MetaTileEntities.MAINTENANCE_HATCH : MetaBlocks.METAL_CASING.getState(MetalCasingType.INVAR_HEATPROOF), EnumFacing.NORTH);
GregTechAPI.HEATING_COILS.entrySet().stream()
.filter(entry -> {
if (entry.getKey().getPropertyKeys().contains(VariantActiveBlock.ACTIVE)) {
return !entry.getKey().getValue(VariantActiveBlock.ACTIVE);
}
return true;
})
.sorted(Comparator.comparingInt(entry -> entry.getValue().getTier()))
.forEach(entry -> shapeInfo.add(builder.where('C', entry.getKey()).build()));
return shapeInfo;
Expand Down

0 comments on commit 943a873

Please sign in to comment.