Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
made TierCircuits a function instead of a map so it changes based off…
Browse files Browse the repository at this point in the history
… the config
  • Loading branch information
Trinsdar committed Oct 26, 2023
1 parent cf20122 commit 1f07610
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 21 deletions.
35 changes: 33 additions & 2 deletions common/src/main/java/muramasa/gregtech/data/TierMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import muramasa.antimatter.recipe.ingredient.RecipeIngredient;
import muramasa.antimatter.util.TagUtils;
import muramasa.gregtech.GTIRef;
import muramasa.gregtech.GregTechConfig;
import muramasa.gregtech.items.ItemIntCircuit;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
Expand All @@ -35,7 +36,7 @@ public class TierMaps {
public static final ImmutableMap<Tier, Material> TIER_PIPE_MATERIAL;
public static ImmutableMap<Tier, PipeItemBlock> TIER_WIRES;
//public static ImmutableMap<Tier, Item> TIER_CABLES;
public static ImmutableMap<Tier, TagKey<Item>> TIER_CIRCUITS;
public static Function<Tier, TagKey<Item>> TIER_CIRCUITS;
public static ImmutableMap<Tier, ItemBasic<?>> TIER_BOARDS;

public static ImmutableMap<Tier, Material> EMITTER_RODS;
Expand Down Expand Up @@ -199,7 +200,37 @@ public static void providerInit() {
builder.put(Tier.IV, GTCoreTags.CIRCUITS_MASTER);
builder.put(Tier.LUV, GTCoreTags.CIRCUITS_DATA_ORB);
builder.put(Tier.ZPM, GTCoreTags.CIRCUITS_DATA_ORB);
TIER_CIRCUITS = builder.build();
TIER_CIRCUITS = t ->{
boolean hardMode = GregTechConfig.GAMEPLAY.HARDER_CIRCUITS;
if (t == LV){
return GTCoreTags.CIRCUITS_BASIC;
}
if (t == MV){
return GTCoreTags.CIRCUITS_GOOD;
}
if (t == HV){
return GTCoreTags.CIRCUITS_ADVANCED;
}
if (t == EV){
return hardMode ? GTCoreTags.CIRCUITS_ELITE : GTCoreTags.CIRCUITS_ELITE;
}
if (t == IV){
return hardMode ? GTCoreTags.CIRCUITS_ELITE : GTCoreTags.CIRCUITS_MASTER;
}
if (t == LUV){
return hardMode ? GTCoreTags.CIRCUITS_DATA_ORB : GTCoreTags.CIRCUITS_DATA_ORB;
}
if (t == ZPM){
return hardMode ? GTCoreTags.CIRCUITS_DATA_ORB : GTCoreTags.CIRCUITS_DATA_ORB;
}
if (t == UV){
return hardMode ? GTCoreTags.CIRCUITS_DATA_ORB : GTCoreTags.CIRCUITS_DATA_ORB;
}
if (t == UHV){
return hardMode ? GTCoreTags.CIRCUITS_DATA_ORB : GTCoreTags.CIRCUITS_DATA_ORB;
}
return GTCoreTags.CIRCUITS_BASIC;
};
}
{
ImmutableMap.Builder<Tier, ItemBasic<?>> builder = ImmutableMap.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void loadRecipes(Consumer<FinishedRecipe> output, AntimatterRecipe
if (emitter == null) return;
Item field = GregTech.get(ItemBasic.class, "field_gen_"+tier.getId());
if (field == null) return;
TagKey<Item> circuit = TIER_CIRCUITS.getOrDefault(tier, GTCoreTags.CIRCUITS_BASIC);
TagKey<Item> circuit = TIER_CIRCUITS.apply(tier);
if (circuit == null) return;
Object cable = CABLE_GETTER.apply(PipeSize.VTINY, tier, true);
if (cable == null) return;
Expand Down Expand Up @@ -324,7 +324,7 @@ public static void loadRecipes(Consumer<FinishedRecipe> output, AntimatterRecipe
Tier tier2 = tier == LV ? tier : Tier.getTier(tier.getVoltage() * 4);
add(AMP_FABRICATOR, tier, (m, item) -> provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(MotorLV), item,
ImmutableMap.<Character, Object>builder()
.put('C', TIER_CIRCUITS.get(tier2))
.put('C', TIER_CIRCUITS.apply(tier2))
.put('W', CABLE_GETTER.apply(PipeSize.SMALL, tier, true))
.put('H', hull)
.put('P', pump).build(), "WPW", "PHP", "CPC"));
Expand Down Expand Up @@ -478,19 +478,19 @@ public static void loadRecipes(Consumer<FinishedRecipe> output, AntimatterRecipe
.put('D', ForgeCTags.CHESTS_WOODEN)
.put('M', hull)
.put('C', conveyor)
.put('c', TIER_CIRCUITS.get(LV)).build(), "DMC", " c "));
.put('c', TIER_CIRCUITS.apply(LV)).build(), "DMC", " c "));

add(ELECTRIC_TYPE_FILTER, tier, (m,item) -> provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(MotorHV), item,
ImmutableMap.<Character, Object>builder()
.put('H', hull)
.put('C', TIER_CIRCUITS.get(HV))
.put('C', TIER_CIRCUITS.apply(HV))
.put('F', COVER_ITEM_FILTER.getItem())
.put('E', ForgeCTags.CHESTS)
.put('c', conveyor).build(), " F ", "EHc", " C "));
add(ELECTRIC_ITEM_FILTER, tier, (m,item) -> provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(motor), item,
ImmutableMap.<Character, Object>builder()
.put('H', hull)
.put('C', TIER_CIRCUITS.get(LV))
.put('C', TIER_CIRCUITS.apply(LV))
.put('F', COVER_ITEM_FILTER.getItem())
.put('E', ForgeCTags.CHESTS)
.put('c', conveyor).build(), " F ", "EHc", " C "));
Expand Down Expand Up @@ -671,7 +671,7 @@ private static void addMultiblockRecipes(Consumer<FinishedRecipe> output, Antima
ImmutableMap.<Character, Object>builder()
.put('L', CABLE_GETTER.apply(PipeSize.VTINY, LV, true))
.put('H', CASING_HEAT_PROOF)
.put('C', TIER_CIRCUITS.get(LV))
.put('C', TIER_CIRCUITS.apply(LV))
.put('F', Items.FURNACE)
.build(), "FFF", "CHC", "LCL"));
/*provider.addItemRecipe(output, "machines", "has_wrench", provider.hasSafeItem(WRENCH.getTag()), CHARCOAL_PIT.getItem(CHARCOAL_PIT.getFirstTier()),
Expand All @@ -686,7 +686,7 @@ private static void addMultiblockRecipes(Consumer<FinishedRecipe> output, Antima
ImmutableMap.<Character, Object>builder()
.put('L', CABLE_TUNGSTEN_STEEL.getBlockItem(PipeSize.VTINY))
.put('H', HULL_EV)
.put('C', TIER_CIRCUITS.get(EV))
.put('C', TIER_CIRCUITS.apply(EV))
.put('P', PistonEV)
.put('G', GEAR.getMaterialTag(Titanium))
.put('M', MotorEV)
Expand All @@ -696,21 +696,21 @@ private static void addMultiblockRecipes(Consumer<FinishedRecipe> output, Antima
.put('P', COVER_PUMP.getItem(HV).getItem())
.put('O', COIL_CUPRONICKEL)
.put('H', HULL_HV)
.put('C', TIER_CIRCUITS.get(HV))
.put('C', TIER_CIRCUITS.apply(HV))
.build(), "OPO", "CHC", "OPO"));
add(DISTLLATION_TOWER, HV, (m,item) -> provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(MotorHV), item,
ImmutableMap.<Character, Object>builder()
.put('P', COVER_PUMP.getItem(HV).getItem())
.put('I', FLUID_PIPE_STAINLESS_STEEL.getBlock(PipeSize.LARGE))
.put('H', HULL_HV)
.put('C', TIER_CIRCUITS.get(HV))
.put('C', TIER_CIRCUITS.apply(HV))
.build(), "CIC", "PHP", "CIC"));
add(CRYO_DISTLLATION_TOWER, HV, (m,item) -> provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(MotorHV), item,
ImmutableMap.<Character, Object>builder()
.put('P', COVER_PUMP.getItem(HV).getItem())
.put('I', FLUID_PIPE_COPPER.getBlock(PipeSize.LARGE))
.put('H', HULL_HV)
.put('C', TIER_CIRCUITS.get(HV))
.put('C', TIER_CIRCUITS.apply(HV))
.build(), "CIC", "PHP", "CIC"));
add(HEAT_EXCHANGER, EV, (m,item) -> provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(MotorEV), item,
ImmutableMap.<Character, Object>builder()
Expand All @@ -722,13 +722,13 @@ private static void addMultiblockRecipes(Consumer<FinishedRecipe> output, Antima
ImmutableMap.<Character, Object>builder()
.put('L', CABLE_GETTER.apply(PipeSize.VTINY, HV, true))
.put('O', Items.OBSIDIAN)
.put('C', TIER_CIRCUITS.get(HV))
.put('C', TIER_CIRCUITS.apply(HV))
.put('S', CASING_SOLID_STEEL)
.build(), "OOO", "CSC", "LCL"));
Arrays.stream(getStandard()).filter(t -> t !=IV).forEach(tier -> {
Block firebox = tier == LV ? CASING_FIREBOX_BRONZE : tier == MV ? CASING_FIREBOX_STEEL : tier == HV ? CASING_FIREBOX_TITANIUM : CASING_FIREBOX_TUNGSTENSTEEL;
TagKey<Item> circuit2 = tier == LV ? TIER_CIRCUITS.get(tier) : tier == MV ? CIRCUITS_ADVANCED : tier == HV ? CIRCUITS_ELITE : CIRCUITS_MASTER;
add(LARGE_BOILER, tier, (m,item) -> provider.addItemRecipe(output, "machines", "has_circuit", provider.hasSafeItem(TIER_CIRCUITS.get(tier)), item,
TagKey<Item> circuit2 = tier == LV ? TIER_CIRCUITS.apply(tier) : tier == MV ? CIRCUITS_ADVANCED : tier == HV ? CIRCUITS_ELITE : CIRCUITS_MASTER;
add(LARGE_BOILER, tier, (m,item) -> provider.addItemRecipe(output, "machines", "has_circuit", provider.hasSafeItem(TIER_CIRCUITS.apply(tier)), item,
ImmutableMap.<Character, Object>builder()
.put('L', CABLE_GETTER.apply(PipeSize.VTINY, tier, true))
.put('H', firebox)
Expand All @@ -743,15 +743,15 @@ private static void addMultiblockRecipes(Consumer<FinishedRecipe> output, Antima
provider.addItemRecipe(output, "machines", "has_gear", provider.hasSafeItem(GEAR.getMaterialTag(gear)), item,
ImmutableMap.of('G', GEAR.getMaterialTag(gear),
'H', GregTech.get(BlockCasing.class, "hull_" + tier.getId()),
'C', TIER_CIRCUITS.get(tier),
'C', TIER_CIRCUITS.apply(tier),
'P', TIER_PIPES.get(pipe).apply(PipeSize.LARGE)), "CGC", "GHG", "PGP");
});
});
add(MULTI_SMELTER, HV, (m,item) -> provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(MotorHV), item,
ImmutableMap.<Character, Object>builder()
.put('L', CABLE_GETTER.apply(PipeSize.VTINY, HV, false))
.put('F', Items.FURNACE)
.put('C', TIER_CIRCUITS.get(HV))
.put('C', TIER_CIRCUITS.apply(HV))
.put('H', CASING_HEAT_PROOF)
.build(), "FFF", "CHC", "LCL"));
add(NUCLEAR_REACTOR, EV, (m, item) -> provider.addItemRecipe(output, "machines", "has_wrench", provider.hasSafeItem(WRENCH.getTag()), item,
Expand All @@ -764,7 +764,7 @@ private static void addMultiblockRecipes(Consumer<FinishedRecipe> output, Antima
add(OIL_DRILLING_RIG, MV, (m, item) -> provider.addItemRecipe(output, "machines", "has_mortor", provider.hasSafeItem(MotorMV), item,
ImmutableMap.<Character, Object>builder()
.put('M', MotorMV)
.put('C', TIER_CIRCUITS.get(MV))
.put('C', TIER_CIRCUITS.apply(MV))
.put('H', HULL_MV)
.put('F', FRAME.getMaterialTag(Steel)).build(), "FFF", "CHC", "MMM"));
provider.addItemRecipe(output, "machines", "has_motor", provider.hasSafeItem(FireBrick), PRIMITIVE_BLAST_FURNACE.getItem(PRIMITIVE_BLAST_FURNACE.getFirstTier()),
Expand All @@ -782,7 +782,7 @@ private static void addMultiblockRecipes(Consumer<FinishedRecipe> output, Antima
ImmutableMap.<Character, Object>builder()
.put('L', CABLE_GETTER.apply(PipeSize.VTINY, HV, true))
.put('F', CASING_FROST_PROOF)
.put('C', TIER_CIRCUITS.get(HV))
.put('C', TIER_CIRCUITS.apply(HV))
.put('P', COVER_PUMP.getItem(HV).getItem())
.build(), "PPP", "CFC", "LCL"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static void tieredItems(Consumer<FinishedRecipe> output, AntimatterRecip
Item smallGear = GEAR.get(mat);
TagKey<Item> plate = PLATE.getMaterialTag(mat);
TagKey<Item> rod = ROD.getMaterialTag(mat);
TagKey<Item> circuit = TIER_CIRCUITS.getOrDefault(t, GTCoreTags.CIRCUITS_BASIC);
TagKey<Item> circuit = TIER_CIRCUITS.apply(t);

Item motor = GregTech.get(ItemBasic.class, "motor_" + t.getId());
Item piston = GregTech.get(ItemBasic.class, "piston_" + t.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private static void motors(){
ASSEMBLING.RB().ii(of(TIER_WIRES.get(t),4), of(ROD.get(TIER_MATERIALS.get(t)),2),
of(ROD.get(magnet),1)
, ofObject(CABLE_GETTER.apply(PipeSize.VTINY, t, false), 2)).io(new ItemStack(GregTech.get(ItemBasic.class,"motor_"+t.getId()))).add("motor_"+t.getId(),150,16);
ASSEMBLING.RB().ii(of(COVER_PUMP.getItem(t)), of(TIER_CIRCUITS.get(t), 2)).io(new ItemStack(GregTech.get(ItemBasic.class, "fluid_regulator_" + t.getId()))).add("fluid_regulator_" + t.getId(), 800, 8);
ASSEMBLING.RB().ii(of(COVER_PUMP.getItem(t)), of(TIER_CIRCUITS.apply(t), 2)).io(new ItemStack(GregTech.get(ItemBasic.class, "fluid_regulator_" + t.getId()))).add("fluid_regulator_" + t.getId(), 800, 8);
});
}

Expand Down

0 comments on commit 1f07610

Please sign in to comment.