Skip to content

Commit

Permalink
Merge branch 'master' into mixins-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
boubou19 authored Sep 28, 2024
2 parents 556a933 + 6b1f145 commit 167eac2
Show file tree
Hide file tree
Showing 57 changed files with 279 additions and 312 deletions.
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ dependencies {
api("com.github.GTNewHorizons:NotEnoughIds:2.1.6:dev")
api("com.github.GTNewHorizons:GTNHLib:0.5.11:dev")
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:ModularUI2:2.1.12-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 @@ -36,7 +36,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -435,7 +434,7 @@ public boolean supportsVoidProtection() {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MEGA_BLAST_FURNACE_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MEGA_BLAST_FURNACE_LOOP;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -537,7 +536,7 @@ public boolean supportsVoidProtection() {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_MEGA_VACUUM_FREEZER_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_MEGA_VACUUM_FREEZER_LOOP;
}
}
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 @@ -41,6 +41,7 @@
import gregtech.api.recipe.check.SimpleCheckRecipeResult;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
import tectech.thing.metaTileEntity.hatch.MTEHatchEnergyMulti;
import tectech.thing.metaTileEntity.multi.base.TTMultiblockBase;
import thaumcraft.api.aspects.Aspect;
Expand Down Expand Up @@ -363,14 +364,18 @@ protected void runMachine(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
this.drainNodePower(WORLD, x, y, z);
this.nodePower -= expectedPower();

calculatePerfectOverclockedNessMulti(
RECIPE_EUT,
(int) Math.ceil(this.mOutputAspects.visSize() * RECIPE_DURATION * (1 - this.nodeIncrease * 0.005)),
1,
Math.min(Integer.MAX_VALUE, getMaxInputEnergy_EM()));
OverclockCalculator calculator = new OverclockCalculator().setRecipeEUt(RECIPE_EUT)
.setEUt(getMaxInputEu())
.setDuration(
(int) Math.ceil(this.mOutputAspects.visSize() * RECIPE_DURATION * (1 - this.nodeIncrease * 0.005)))
.setDurationDecreasePerOC(4)
.calculate();

useLongPower = true;
lEUt = -calculator.getConsumption();
mMaxProgresstime = calculator.getDuration();

this.updateSlots();
if (this.mEUt > 0) this.mEUt = -this.mEUt;
return CheckRecipeResultRegistry.SUCCESSFUL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -534,8 +533,8 @@ public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDat

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_PRECISE_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_PRECISE_LOOP;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.util.ForgeDirection;
Expand Down Expand Up @@ -358,7 +357,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mMachine ? 0 : 64));
aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
} else {
soundMagic(getActivitySoundLoop());
doActivitySound(getActivitySoundLoop());
}
}

Expand Down Expand Up @@ -570,8 +569,8 @@ public boolean explodesOnComponentBreak(ItemStack aStack) {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_FUSION_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_FUSION_LOOP;
}

@Override
Expand Down
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
16 changes: 15 additions & 1 deletion src/main/java/gregtech/api/enums/SoundResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static gregtech.api.enums.Mods.GregTech;
import static gregtech.api.enums.Mods.IndustrialCraft2;
import static gregtech.api.enums.Mods.TecTech;

import java.util.EnumSet;
import java.util.Locale;
Expand Down Expand Up @@ -100,6 +101,10 @@ public enum SoundResource {
GT_MACHINES_QUANTUM_FORCE_TRANSFORMER_LOOP(264, GregTech.ID, "machines.MTEQuantumForceTransformer"),
GT_MACHINES_ADV_EBF_LOOP(265, GregTech.ID, "machines.MTEAdvEBF"),
GT_MACHINES_LARGE_TURBINES_LOOP(266, GregTech.ID, "machines.MTELargeTurbine"),
TECTECH_MACHINES_FX_LOW_FREQ(267, TecTech.ID, "fx_lo_freq"),
TECTECH_MACHINES_FX_HIGH_FREQ(268, TecTech.ID, "fx_hi_freq"),
TECTECH_MACHINES_NOISE(269, TecTech.ID, "fx_noise"),
TECTECH_MACHINES_FX_WHOOUM(270, TecTech.ID, "fx_whooum"),

GUI_BUTTON_DOWN(-1, GregTech.ID, "gui.buttonDown"),
GUI_BUTTON_UP(-1, GregTech.ID, "gui.buttonUp"),
Expand Down Expand Up @@ -346,7 +351,16 @@ public enum SoundResource {

static {
EnumSet.allOf(SoundResource.class)
.forEach(sound -> { if (sound.id >= 0) ID_SOUND_MAP.put(sound.id, sound); });
.forEach(sound -> {
if (sound.id < 0) {
return;
}

if (ID_SOUND_MAP.containsKey(sound.id)) {
throw new IllegalStateException(String.format("Sound ID %s is already occupied!", sound.id));
}
ID_SOUND_MAP.put(sound.id, sound);
});
EnumSet.allOf(SoundResource.class)
.forEach(sound -> RESOURCE_STR_SOUND_MAP.put(sound.resourceLocation.toString(), sound));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ public boolean onRightclick(EntityPlayer aPlayer, ForgeDirection side, float aX,
&& mMetaTileEntity.allowCoverOnSide(coverSide, new GTItemStack(tCurrentItem))) {

setCoverItemAtSide(coverSide, tCurrentItem);
coverBehavior.onPlayerAttach(aPlayer, tCurrentItem, this, side);
coverBehavior.onPlayerAttach(aPlayer, tCurrentItem, this, coverSide);

mMetaTileEntity.markDirty();
if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
Expand Down Expand Up @@ -677,10 +676,14 @@ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
}

@SideOnly(Side.CLIENT)
protected void doActivitySound(ResourceLocation activitySound) {
protected void doActivitySound(SoundResource activitySound) {
if (getBaseMetaTileEntity().isActive() && activitySound != null) {
if (activitySoundLoop == null) {
activitySoundLoop = new GTSoundLoop(activitySound, getBaseMetaTileEntity(), false, true);
activitySoundLoop = new GTSoundLoop(
activitySound.resourceLocation,
getBaseMetaTileEntity(),
false,
true);
Minecraft.getMinecraft()
.getSoundHandler()
.playSound(activitySoundLoop);
Expand Down Expand Up @@ -710,7 +713,7 @@ protected SoundResource getProcessStartSound() {
* @return Sound that will be looped for as long as the machine is doing a recipe
*/
@SideOnly(Side.CLIENT)
protected ResourceLocation getActivitySoundLoop() {
protected SoundResource getActivitySoundLoop() {
return null;
}

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 @@ -30,7 +30,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -402,7 +401,7 @@ public boolean supportsBatchMode() {

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_EBF_LOOP.resourceLocation;
protected SoundResource getActivitySoundLoop() {
return SoundResource.GT_MACHINES_EBF_LOOP;
}
}
Loading

0 comments on commit 167eac2

Please sign in to comment.