Skip to content

Commit

Permalink
Merge branch 'GTNewHorizons:master' into fix-cover-onPlayerAttach-on-…
Browse files Browse the repository at this point in the history
…pipe
  • Loading branch information
reobf committed Sep 27, 2024
2 parents ee8f3a6 + e9fe2d8 commit 962b976
Show file tree
Hide file tree
Showing 26 changed files with 205 additions and 194 deletions.
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
api("com.github.GTNewHorizons:ModularUI:1.2.8:dev")
api("com.github.GTNewHorizons:ModularUI2:2.1.11-1.7.10:dev")
api("com.github.GTNewHorizons:waila:1.8.1:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-463-GTNH:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-464-GTNH:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.36-gtnh:dev")
api('com.github.GTNewHorizons:Yamcl:0.6.0:dev')
api("com.github.GTNewHorizons:Postea:1.0.13:dev")
Expand Down Expand Up @@ -95,7 +95,7 @@ dependencies {
compileOnly rfg.deobf("curse.maven:biomes-o-plenty-220318:2499612")

compileOnly('com.github.GTNewHorizons:SC2:2.2.0:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Binnie:2.4.2:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Binnie:2.4.3:dev') {transitive = false}
compileOnly('curse.maven:PlayerAPI-228969:2248928') {transitive=false}
compileOnly('com.github.GTNewHorizons:BlockRenderer6343:1.2.14:dev'){transitive=false}

Expand All @@ -108,7 +108,7 @@ dependencies {
// runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForestryMC:4.9.16:dev")
// runtimeOnlyNonPublishable('com.github.GTNewHorizons:neiaddons:1.16.0:dev')
// runtimeOnlyNonPublishable('com.github.GTNewHorizons:MagicBees:2.8.5-GTNH:dev')
// runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.4.2:dev')
// runtimeOnlyNonPublishable('com.github.GTNewHorizons:Binnie:2.4.3:dev')

testImplementation(platform('org.junit:junit-bom:5.9.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@

package bartworks.system.material.CircuitGeneration;

import static gregtech.api.enums.ItemList.Circuit_Board_Advanced;
import static gregtech.api.enums.ItemList.Circuit_Board_Basic;
import static gregtech.api.enums.ItemList.Circuit_Board_Bio;
import static gregtech.api.enums.ItemList.Circuit_Board_Bio_Ultra;
import static gregtech.api.enums.ItemList.Circuit_Board_Coated;
import static gregtech.api.enums.ItemList.Circuit_Board_Coated_Basic;
import static gregtech.api.enums.ItemList.Circuit_Board_Elite;
import static gregtech.api.enums.ItemList.Circuit_Board_Epoxy;
import static gregtech.api.enums.ItemList.Circuit_Board_Epoxy_Advanced;
import static gregtech.api.enums.ItemList.Circuit_Board_Fiberglass;
Expand Down Expand Up @@ -149,6 +146,12 @@ public static void makeCircuitParts() {
}

for (ItemList single : CIRCUIT_PARTS) {
// Skip placeholder values and maintain the ids
if (single == null) {
CircuitImprintLoader.reverseIDs--;
continue;
}

if (!single.hasBeenSet()) continue;
ItemStack itemStack = single.get(1);
if (!GTUtility.isStackValid(itemStack)) continue;
Expand Down Expand Up @@ -194,9 +197,9 @@ public static void makeCircuitParts() {
*/
private static final List<ItemList> CIRCUIT_PARTS = Collections.unmodifiableList(
Arrays.asList(
Circuit_Board_Basic,
Circuit_Board_Advanced,
Circuit_Board_Elite,
null,
null,
null,
Circuit_Parts_Crystal_Chip_Elite,
Circuit_Parts_Crystal_Chip_Master,
Circuit_Board_Coated,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
import gregtech.api.util.GTUtility;
import gregtech.api.util.IGTHatchAdder;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.common.tileentities.machines.IRecipeProcessingAwareHatch;
import gregtech.common.tileentities.machines.MTEHatchInputME;

public class MTEExtremeHeatExchanger extends MTETooltipMultiBlockBaseEM
implements IConstructable, ISurvivalConstructable {
Expand Down Expand Up @@ -223,18 +225,26 @@ protected MultiblockTooltipBuilder createTooltip() {
@Override
public @NotNull CheckRecipeResult checkProcessing_EM() {
tRunningRecipe = null;
if (mHotFluidHatch.getFluid() == null) return CheckRecipeResultRegistry.SUCCESSFUL;
FluidStack hotFluid = null;
if (mHotFluidHatch instanceof MTEHatchInputME inputME) {
FluidStack[] fluids = inputME.getStoredFluids();
if (fluids.length > 0) {
hotFluid = fluids[0];
}
} else {
hotFluid = mHotFluidHatch.getFluid();
}
if (hotFluid == null) return CheckRecipeResultRegistry.SUCCESSFUL;
ExtremeHeatExchangerRecipe tRecipe = (ExtremeHeatExchangerRecipe) GoodGeneratorRecipeMaps.extremeHeatExchangerFuels
.getBackend()
.findFuel(mHotFluidHatch.getFluid());
.findFuel(hotFluid);
if (tRecipe == null) return CheckRecipeResultRegistry.NO_RECIPE;
tRunningRecipe = tRecipe;
this.hotName = mHotFluidHatch.getFluid()
.getFluid()
this.hotName = hotFluid.getFluid()
.getName();
int tMaxConsume = tRecipe.getMaxHotFluidConsume();
int transformed_threshold = tRecipe.mSpecialValue;
int tRealConsume = Math.min(tMaxConsume, mHotFluidHatch.getFluid().amount);
int tRealConsume = Math.min(tMaxConsume, hotFluid.amount);
double penalty = 0.0d;
double efficiency = 1d;
int shs_reduction_per_config = 150;
Expand All @@ -255,7 +265,8 @@ protected MultiblockTooltipBuilder createTooltip() {

this.mMaxProgresstime = 20;
this.mEUt = (int) (tRecipe.getEUt() * efficiency * ((double) tRealConsume / (double) tMaxConsume));
mHotFluidHatch.drain(tRealConsume, true);
// the 3-arg drain will work on both normal hatch and ME hatch
mHotFluidHatch.drain(ForgeDirection.UNKNOWN, new FluidStack(hotFluid.getFluid(), tRealConsume), true);
mCooledFluidHatch.fill(new FluidStack(tRecipe.getCooledFluid(), tRealConsume), true);
this.mEfficiencyIncrease = 160;

Expand All @@ -269,7 +280,10 @@ public boolean onRunningTick(ItemStack aStack) {
int waterAmount = (int) (this.mEUt / getUnitSteamPower(tReadySteam.getName())) / 160;
if (waterAmount < 0) return false;
int steamToOutput;
if (depleteInput(GTModHandler.getDistilledWater(waterAmount))) {
startRecipeProcessing();
boolean isDepleteSuccess = depleteInput(GTModHandler.getDistilledWater(waterAmount));
endRecipeProcessing();
if (isDepleteSuccess) {
if (tRunningRecipe.mFluidInputs[0].getUnlocalizedName()
.contains("plasma")) {
steamToOutput = waterAmount * 160 / 1000;
Expand Down Expand Up @@ -421,4 +435,20 @@ public IGTHatchAdder<? super MTEExtremeHeatExchanger> adder() {
return adder;
}
}

@Override
public void startRecipeProcessing() {
super.startRecipeProcessing();
if (mHotFluidHatch instanceof IRecipeProcessingAwareHatch aware && mHotFluidHatch.isValid()) {
aware.startRecipeProcessing();
}
}

@Override
public void endRecipeProcessing() {
super.endRecipeProcessing();
if (mHotFluidHatch instanceof IRecipeProcessingAwareHatch aware && mHotFluidHatch.isValid()) {
aware.endRecipeProcessing(this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,6 @@ public static void RecipeLoad() {
.noOptimize()
.addTo(neutronActivatorRecipes);

// Fix shit
GTValues.RA.stdBuilder()
.itemInputs(lowQualityNaquadriaSolution.get(OrePrefixes.cell, 1))
.itemOutputs(Materials.Tin.getDust(2))
.duration(16 * SECONDS + 14 * TICKS)
.eut(4)
.addTo(maceratorRecipes);

// Naquadah Rework Line
GTValues.RA.stdBuilder()
.itemInputs(naquadahEarth.get(OrePrefixes.dust, 2), GTUtility.getIntegratedCircuit(1))
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/goodgenerator/util/CrackRecipeAdder.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,6 @@ public static void registerWire(int ID, Werkstoff material, int aAmperage, int a
true,
false).getStackForm(1L));
}
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.ingot, 1), GTUtility.getIntegratedCircuit(1))
.itemOutputs(material.get(OrePrefixes.wireGt01, 2))
.duration(5 * SECONDS)
.eut(4)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.ingot, 1), GTUtility.getIntegratedCircuit(2))
.itemOutputs(material.get(OrePrefixes.wireGt02, 1))
Expand Down Expand Up @@ -556,12 +550,6 @@ public static void registerWire(int ID, Werkstoff material, int aAmperage, int a
.duration(17 * SECONDS + 10 * TICKS)
.eut(4)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.stick, 1), GTUtility.getIntegratedCircuit(1))
.itemOutputs(material.get(OrePrefixes.wireGt01, 1))
.duration(2 * SECONDS + 10 * TICKS)
.eut(4)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.stick, 2), GTUtility.getIntegratedCircuit(2))
.itemOutputs(material.get(OrePrefixes.wireGt02, 1))
Expand All @@ -586,38 +574,11 @@ public static void registerWire(int ID, Werkstoff material, int aAmperage, int a
.duration(12 * SECONDS + 10 * TICKS)
.eut(4)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.stick, 16), GTUtility.getIntegratedCircuit(16))
.itemOutputs(material.get(OrePrefixes.wireGt16, 1))
.duration(15 * SECONDS)
.eut(4)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.ingot, 1), GTUtility.getIntegratedCircuit(3))
.itemOutputs(material.get(OrePrefixes.wireFine, 8))
.duration(5 * SECONDS)
.eut(4)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.stick, 1), GTUtility.getIntegratedCircuit(3))
.itemOutputs(material.get(OrePrefixes.wireFine, 4))
.duration(2 * SECONDS + 10 * TICKS)
.eut(4)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.wireGt01, 1), GTUtility.getIntegratedCircuit(1))
.itemOutputs(material.get(OrePrefixes.wireFine, 4))
.duration(10 * SECONDS)
.eut(8)
.addTo(wiremillRecipes);
GTValues.RA.stdBuilder()
.itemInputs(material.get(OrePrefixes.ingot, 1), ItemList.Shape_Extruder_Wire.get(0))
.itemOutputs(material.get(OrePrefixes.wireGt01, 2))
.duration(
material.getStats()
.getMass() * 8
* TICKS)
.eut(TierEU.RECIPE_HV)
.addTo(extruderRecipes);
}
}
23 changes: 18 additions & 5 deletions src/main/java/gregtech/api/enums/OrePrefixes.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static gregtech.api.enums.GTValues.B;
import static gregtech.api.enums.GTValues.D2;
import static gregtech.api.enums.GTValues.M;
import static gregtech.api.util.GTRecipeBuilder.DEBUG_MODE_COLLISION;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -1309,20 +1310,32 @@ public void processOre(Materials aMaterial, String aOreDictName, String aModName
return;
}

if (aMaterial != Materials._NULL && !used.add(aMaterial)) {
GTLog.out.println("Duplicate material registry attempted by " + aModName + " for " + aOreDictName);
if (aMaterial.contains(SubTag.NO_RECIPES)) {
return;
}

if (aMaterial.contains(SubTag.NO_RECIPES)) {
if (aMaterial == Materials._NULL && !mIsSelfReferencing && mIsMaterialBased) {
return;
}

if (!((aMaterial != Materials._NULL || mIsSelfReferencing || !mIsMaterialBased)
&& GTUtility.isStackValid(aStack))) {
if (!GTUtility.isStackValid(aStack)) {
return;
}

if (aMaterial != Materials._NULL) {
if (!used.add(aMaterial)) {
if (DEBUG_MODE_COLLISION) {
GTLog.out
.println("Attempted duplicate recipe registration by " + aModName + " for " + aOreDictName);
}
return;
} else {
if (DEBUG_MODE_COLLISION) {
GTLog.out.println("New recipe registration by " + aModName + " for " + aOreDictName);
}
}
}

for (IOreRecipeRegistrator tRegistrator : mOreProcessing) {
if (D2) GTLog.ore.println(
"Processing '" + aOreDictName
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/util/GTRecipeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class GTRecipeBuilder {
private static final boolean DEBUG_MODE_FULL_ENERGY;
// Any stable release should be tested at least once with this: -Dgt.recipebuilder.panic.invalid=true
private static final boolean PANIC_MODE_INVALID;
private static final boolean DEBUG_MODE_COLLISION;
public static final boolean DEBUG_MODE_COLLISION;

// Any stable release should be tested at least once with this: -Dgt.recipebuilder.panic.collision=true
private static final boolean PANIC_MODE_COLLISION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import gregtech.api.util.GTModHandler;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.common.tileentities.machines.IRecipeProcessingAwareHatch;
import gregtech.common.tileentities.machines.MTEHatchInputME;

public class MTEHeatExchanger extends MTEEnhancedMultiBlockBase<MTEHeatExchanger> implements ISurvivalConstructable {

Expand Down Expand Up @@ -179,9 +181,19 @@ protected IAlignmentLimits getInitialAlignmentLimits() {
@Override
@Nonnull
public CheckRecipeResult checkProcessing() {
if (mInputHotFluidHatch.getFluid() == null) return CheckRecipeResultRegistry.NO_RECIPE;
FluidStack hotFluid = null;
if (mInputHotFluidHatch instanceof MTEHatchInputME inputME) {
FluidStack[] fluids = inputME.getStoredFluids();
if (fluids.length > 0) {
hotFluid = fluids[0];
}
} else {
hotFluid = mInputHotFluidHatch.getFluid();
}

if (hotFluid == null) return CheckRecipeResultRegistry.NO_RECIPE;

int fluidAmountToConsume = mInputHotFluidHatch.getFluidAmount(); // how much fluid is in hatch
int fluidAmountToConsume = hotFluid.amount; // how much fluid is in hatch

superheated_threshold = 4000; // default: must have 4000L per second to generate superheated steam
float efficiency = 1f; // default: operate at 100% efficiency with no integrated circuitry
Expand All @@ -202,9 +214,7 @@ public CheckRecipeResult checkProcessing() {

efficiency -= penalty;

var coolant = LHECoolantRegistry.getCoolant(
mInputHotFluidHatch.getFluid()
.getFluid());
var coolant = LHECoolantRegistry.getCoolant(hotFluid.getFluid());

if (coolant == null) {
superheated_threshold = 0;
Expand All @@ -220,8 +230,9 @@ public CheckRecipeResult checkProcessing() {

// Don't consume too much hot fluid per second
fluidAmountToConsume = Math.min(fluidAmountToConsume, superheated_threshold * 2);

mInputHotFluidHatch.drain(fluidAmountToConsume, true);
// the 3-arg drain will work on both normal hatch and ME hatch
mInputHotFluidHatch
.drain(ForgeDirection.UNKNOWN, new FluidStack(hotFluid.getFluid(), fluidAmountToConsume), true);
mOutputColdFluidHatch.fill(coolant.getColdFluid(fluidAmountToConsume), true);

this.mMaxProgresstime = 20;
Expand Down Expand Up @@ -393,4 +404,20 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu
if (mMachine) return -1;
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 3, 0, elementBudget, env, false, true);
}

@Override
public void startRecipeProcessing() {
super.startRecipeProcessing();
if (mInputHotFluidHatch instanceof IRecipeProcessingAwareHatch aware && mInputHotFluidHatch.isValid()) {
aware.startRecipeProcessing();
}
}

@Override
public void endRecipeProcessing() {
super.endRecipeProcessing();
if (mInputHotFluidHatch instanceof IRecipeProcessingAwareHatch aware && mInputHotFluidHatch.isValid()) {
aware.endRecipeProcessing(this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDic
} else if (!aMaterial.contains(SubTag.NO_WORKING)) {
if ((!OrePrefixes.block.isIgnored(aMaterial))
&& (null == GTOreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L))
&& GTOreDictUnificator.get(OrePrefixes.block, aMaterial, 1L) != null) {
&& GTOreDictUnificator.get(OrePrefixes.block, aMaterial, 1L) != null
&& (aMaterial != Materials.Clay)) {

GTValues.RA.stdBuilder()
.itemInputs(GTOreDictUnificator.get(OrePrefixes.dust, aMaterial, 9))
Expand All @@ -133,7 +134,8 @@ public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDic
&& (aMaterial != Materials.Paper)
&& (aMaterial != MaterialsUEVplus.TranscendentMetal)
&& (aMaterial != Materials.Clay)
&& (aMaterial != Materials.Wood)) {
&& (aMaterial != Materials.Wood)
&& (aMaterial != Materials.Carbon)) {
// compressor recipe
{
if (GTOreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public ProcessingFoil() {
@Override
public void registerOre(OrePrefixes prefix, Materials material, String oreDictName, String modName,
ItemStack stack) {
// Blacklist materials which are handled by Werkstoff loader
if (material == Materials.Calcium || material == Materials.Magnesia) return;

registerBenderRecipe(material);
registerCover(stack, material);
}
Expand Down
Loading

0 comments on commit 962b976

Please sign in to comment.