Skip to content

Commit

Permalink
Merge branch 'master' into remove-duplicate-materials
Browse files Browse the repository at this point in the history
  • Loading branch information
boubou19 authored Sep 23, 2024
2 parents cd346db + 95d749f commit 8e7df47
Show file tree
Hide file tree
Showing 118 changed files with 858 additions and 335 deletions.
12 changes: 6 additions & 6 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.10-1.7.10: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-462-GTNH:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-463-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 All @@ -69,18 +69,18 @@ dependencies {
compileOnly("TGregworks:TGregworks:1.7.10-GTNH-1.0.27:deobf") {transitive = false}
compileOnly("com.github.GTNewHorizons:ThaumicBases:1.7.5:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:EnderCore:0.4.6:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:VisualProspecting:1.3.22:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:VisualProspecting:1.3.24:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Galaxy-Space-GTNH:1.1.94-GTNH:dev") { transitive = false }

compileOnlyApi("com.github.GTNewHorizons:Galacticraft:3.2.4-GTNH:dev") { transitive = false }
implementation("com.github.GTNewHorizons:TinkersConstruct:1.12.9-GTNH:dev")
compileOnlyApi("com.github.GTNewHorizons:Galacticraft:3.2.5-GTNH:dev") { transitive = false }
implementation("com.github.GTNewHorizons:TinkersConstruct:1.12.10-GTNH:dev")

compileOnly("com.github.GTNewHorizons:Chisel:2.15.2-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:Translocators:1.2.1:dev") { transitive = false }
compileOnly rfg.deobf("curse.maven:cofh-core-69162:2388751")
compileOnly("com.github.GTNewHorizons:Nuclear-Control:2.6.7:dev") { transitive = false }
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { transitive = false }
implementation("com.github.GTNewHorizons:Hodgepodge:2.5.69:dev")
implementation("com.github.GTNewHorizons:Hodgepodge:2.5.70:dev")
compileOnly('com.github.GTNewHorizons:Botania:1.11.5-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:HoloInventory:2.4.12-GTNH:dev') { transitive = false }
compileOnly rfg.deobf("curse.maven:extra-utilities-225561:2264384")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
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 All @@ -48,10 +49,13 @@
import bartworks.API.BorosilicateGlass;
import bartworks.common.configs.Configuration;
import bartworks.util.BWUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTechAPI;
import gregtech.api.enums.GTValues;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
import gregtech.api.enums.SoundResource;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
Expand Down Expand Up @@ -428,4 +432,10 @@ public boolean supportsBatchMode() {
public boolean supportsVoidProtection() {
return true;
}

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MEGA_BLAST_FURNACE_LOOP.resourceLocation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
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 All @@ -47,9 +48,12 @@
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import bartworks.common.configs.Configuration;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTechAPI;
import gregtech.api.enums.Materials;
import gregtech.api.enums.MaterialsUEVplus;
import gregtech.api.enums.SoundResource;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
Expand Down Expand Up @@ -530,4 +534,10 @@ public boolean supportsBatchMode() {
public boolean supportsVoidProtection() {
return true;
}

@SideOnly(Side.CLIENT)
@Override
protected ResourceLocation getActivitySoundLoop() {
return SoundResource.GT_MACHINES_MULTI_MEGA_VACUUM_FREEZER_LOOP.resourceLocation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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 All @@ -41,13 +42,16 @@
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import goodgenerator.api.recipe.GoodGeneratorRecipeMaps;
import goodgenerator.client.GUI.GGUITextures;
import goodgenerator.loader.Loaders;
import goodgenerator.util.DescTextLocalization;
import gregtech.api.GregTechAPI;
import gregtech.api.enums.GTValues;
import gregtech.api.enums.Materials;
import gregtech.api.enums.SoundResource;
import gregtech.api.enums.Textures;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IIconContainer;
Expand Down Expand Up @@ -528,4 +532,10 @@ public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDat
+ EnumChatFormatting.RESET);
}

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

}
2 changes: 1 addition & 1 deletion src/main/java/goodgenerator/loader/RecipeLoader2.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static void RecipeLoad() {
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.zircaloy2, 513, 480, 2800, false);
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.zircaloy4, 500, 480, 2800, true);
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.zircaloy4, 513, 480, 2800, false);
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.incoloy903, 2400, 1920, 3700, true);
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.incoloy903, 1200, 1920, 3700, true);
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.adamantiumAlloy, 2500, 1920, 5500, true);
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.marM200, 200, 7680, 5000, true);
CrackRecipeAdder.reAddBlastRecipe(GGMaterial.marM200, 220, 7680, 5000, false);
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/gregtech/api/enums/SoundResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,29 @@ public enum SoundResource {
GT_SPRAYCAN_LOCK(244, GregTech.ID, "items.spraycan_lock"),
GT_SPRAYCAN_UNLOCK(245, GregTech.ID, "items.spraycan_unlock"),

GT_MACHINES_BLACK_HOLE_COMPRESSOR(246, GregTech.ID, "machines.BlackHoleCompressorLoop"),

GT_MACHINES_MULTI_PRECISE_LOOP(247, GregTech.ID, "machines.MTEPreciseAssembler"),
GT_MACHINES_MULTI_ORE_WASHER_PLANT_LOOP(248, GregTech.ID, "machines.MTEIndustrialWashPlant"),
GT_MACHINES_MULTI_MEGA_VACUUM_FREEZER_LOOP(249, GregTech.ID, "machines.MTEMegaVacuumFreezer"),
GT_MACHINES_MULTI_VACUUM_FREEZER_LOOP(250, GregTech.ID, "machines.MTEVacuumFreezer"),
GT_MACHINES_EXTREME_ENTITY_CRUSHER_LOOP(251, GregTech.ID, "machines.MTEExtremeEntityCrusher"),
GT_MACHINES_CUTTING_MACHINE_LOOP(252, GregTech.ID, "machines.MTEIndustrialCuttingMachine"),
GT_MACHINES_ARC_FURNACE_LOOP(253, GregTech.ID, "machines.MTEIndustrialArcFurnace"),
GT_MACHINES_MEGA_INDUSTRIAL_APIARY_LOOP(254, GregTech.ID, "machines.MTEMegaIndustrialApiary"),
GT_MACHINES_ALGAE_LOOP(255, GregTech.ID, "machines.MTEAlgaePondBase"),
GT_MACHINES_THERMAL_CENTRIFUGE_LOOP(256, GregTech.ID, "machines.MTEIndustrialThermalCentrifuge"),
GT_MACHINES_SIFTER_LOOP(257, GregTech.ID, "machines.MTEIndustrialSifter"),
GT_MACHINES_EYE_OF_HARMONY_LOOP(258, GregTech.ID, "machines.MTEEyeOfHarmony"),
GT_MACHINES_EBF_LOOP(259, GregTech.ID, "machines.MTEElectricBlastFurnace"),
GT_MACHINES_ADV_FREEZER_LOOP(260, GregTech.ID, "machines.MTEIndustrialVacuumFreezer"),
GT_MACHINES_GOD_FORGE_LOOP(261, GregTech.ID, "machines.MTEForgeOfGods"),
GT_MACHINES_MEGA_BLAST_FURNACE_LOOP(262, GregTech.ID, "machines.MTEMegaBlastFurnace"),
GT_MACHINES_OIL_DRILL_LOOP(263, GregTech.ID, "machines.MTEOilDrillBase"),
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"),

GUI_BUTTON_DOWN(-1, GregTech.ID, "gui.buttonDown"),
GUI_BUTTON_UP(-1, GregTech.ID, "gui.buttonUp"),

Expand Down
15 changes: 12 additions & 3 deletions src/main/java/gregtech/api/recipe/RecipeMapBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static gregtech.api.util.GTRecipeBuilder.ENABLE_COLLISION_CHECK;
import static gregtech.api.util.GTRecipeBuilder.handleInvalidRecipe;
import static gregtech.api.util.GTRecipeBuilder.handleInvalidRecipeLowFluids;
import static gregtech.api.util.GTRecipeBuilder.handleInvalidRecipeLowItems;
import static gregtech.api.util.GTRecipeBuilder.handleRecipeCollision;
import static gregtech.api.util.GTUtility.areStacksEqualOrNull;

Expand Down Expand Up @@ -172,14 +174,21 @@ protected Collection<GTRecipe> doAdd(GTRecipeBuilder builder) {
Iterable<? extends GTRecipe> recipes = properties.recipeEmitter.apply(builder);
Collection<GTRecipe> ret = new ArrayList<>();
for (GTRecipe recipe : recipes) {
if (recipe.mFluidInputs.length < properties.minFluidInputs
|| recipe.mInputs.length < properties.minItemInputs) {
if (recipe.mInputs.length < properties.minItemInputs) {
handleInvalidRecipeLowItems();
return Collections.emptyList();
}
if (recipe.mFluidInputs.length < properties.minFluidInputs) {
handleInvalidRecipeLowFluids();
return Collections.emptyList();
}
if (properties.recipeTransformer != null) {
recipe = properties.recipeTransformer.apply(recipe);
}
if (recipe == null) continue;
if (recipe == null) {
handleInvalidRecipe();
continue;
}
if (builder.isCheckForCollision() && ENABLE_COLLISION_CHECK && checkCollision(recipe)) {
handleCollision(recipe);
continue;
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/gregtech/api/util/GTRecipeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,30 @@ public static void handleInvalidRecipe() {
}
}

public static void handleInvalidRecipeLowFluids() {
if (!DEBUG_MODE_INVALID && !PANIC_MODE_INVALID) {
return;
}
// place a breakpoint here to catch all these issues
GTLog.err.println("invalid recipe: not enough input fluids");
new IllegalArgumentException().printStackTrace(GTLog.err);
if (PANIC_MODE_INVALID) {
throw new IllegalArgumentException("invalid recipe");
}
}

public static void handleInvalidRecipeLowItems() {
if (!DEBUG_MODE_INVALID && !PANIC_MODE_INVALID) {
return;
}
// place a breakpoint here to catch all these issues
GTLog.err.println("invalid recipe: not enough input items");
new IllegalArgumentException().printStackTrace(GTLog.err);
if (PANIC_MODE_INVALID) {
throw new IllegalArgumentException("invalid recipe");
}
}

public static void handleRecipeCollision(String details) {
if (!DEBUG_MODE_COLLISION && !PANIC_MODE_COLLISION) {
return;
Expand Down
76 changes: 30 additions & 46 deletions src/main/java/gregtech/common/WirelessComputationPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import java.util.UUID;

import com.gtnewhorizon.structurelib.util.Vec3Impl;

import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.common.misc.spaceprojects.SpaceProjectManager;
import tectech.mechanics.dataTransport.QuantumDataPacket;
Expand All @@ -15,68 +13,69 @@ public class WirelessComputationPacket {
public boolean wirelessEnabled = false;

// The main idea: 'Clearing' the computation net advances the index and sets the computation stored
// for this index to zero. Uploading is always done to the current index, but data can be downloaded from
// both indices
// for this index to zero. Uploading is always done to the current index, downloading is always done from the
// other index. This is essentially just a double buffered computation storage. The reason for this is that
// every upload needs to be done before every download happens.
private final long[] computationStored = new long[] { 0, 0 };
private long computationDownloaded = 0;
private int currentIndex = 0;
private long lastUpdateTick = -1;

public Vec3Impl controllerPosition = null;
private int uploadIndex() {
return currentIndex;
}

public long getTotalComputationStored() {
return computationStored[0] + computationStored[1];
private int downloadIndex() {
return (currentIndex + 1) % 2;
}

private long getAvailableComputationStored() {
return getTotalComputationStored() - computationDownloaded;
public long getAvailableComputationStored() {
return computationStored[downloadIndex()];
}

private QuantumDataPacket download(long dataIn, long aTick) {
if (!wirelessEnabled || controllerPosition == null) return new QuantumDataPacket(0L);
if (!wirelessEnabled) return new QuantumDataPacket(0L);

// If the net hasn't been updated yet this tick, make sure to do so
if (lastUpdateTick < aTick) {
this.update();
lastUpdateTick = aTick;
}

// If we have enough computation 'stored', download it
// Note that this means that if you do not have enough computation to go to all
// destinations, it won't be distributed equally. This is fine.
// This also means that if you don't have enough computation for a hatch, it will not receive any computation
// at all. This is also fine.
if (getAvailableComputationStored() >= dataIn) {
computationDownloaded += dataIn;
computationStored[downloadIndex()] -= dataIn;
return new QuantumDataPacket(dataIn);
} else return new QuantumDataPacket(0L);
}

private void update(IGregTechTileEntity entity, long aTick) {
private void update() {
// The reason we want this complex index cycling system is because hatches may upload and download computation
// in the same tick as the currently stored computation is cleared. To avoid interruptions, we want to
// try to double buffer these updates. This means that we keep two computation values around, and every update
// we only clear one of them. Only the most recent entry can be used for uploading computation, but we allow
// downloading computation from both the current and the previous index.
// we only clear one of them.

// Remove downloaded computation previous index (which is also the next index since there are only two),
// then remove the leftover from current index.
int nextIndex = (currentIndex + 1) % 2;
long availableInPrevious = computationStored[nextIndex];
// Clear stored computation for the next index, since we don't want to allow players to accumulate
// computation in their wireless network indefinitely. This would allow for cheesing research by passively
// banking computation and then setting the input hatch to a high value when the computation is needed.
computationStored[nextIndex] = 0;
if (computationDownloaded > availableInPrevious) {
long toDrainFromCurrent = computationDownloaded - availableInPrevious;
computationStored[currentIndex] -= toDrainFromCurrent;
}
// Reset our current tally of downloaded computation
computationDownloaded = 0;
// Now advance the current index to the next index
currentIndex = nextIndex;
computationStored[downloadIndex()] = 0;
currentIndex = (currentIndex + 1) % 2;
}

private void setWirelessEnabled(boolean wirelessEnabled) {
this.wirelessEnabled = wirelessEnabled;
}

private void upload(long dataOut, long aTick) {
// If the net hasn't been updated yet this tick, make sure to do so
if (lastUpdateTick < aTick) {
this.update();
lastUpdateTick = aTick;
}
// Store computation that is uploaded internally
computationStored[currentIndex] += dataOut;
computationStored[uploadIndex()] += dataOut;
}

public static QuantumDataPacket downloadData(UUID userId, long dataIn, long aTick) {
Expand All @@ -87,26 +86,11 @@ public static void uploadData(UUID userId, long dataOut, long aTick) {
getPacketByUserId(userId).upload(dataOut, aTick);
}

public static void updatePacket(IGregTechTileEntity entity, long aTick) {
getPacketByUserId(entity.getOwnerUuid()).update(entity, aTick);
}

public static boolean enableWirelessNetWork(IGregTechTileEntity entity) {
var packet = getPacketByUserId(entity.getOwnerUuid());
Vec3Impl pos = new Vec3Impl(entity.getXCoord(), entity.getYCoord(), entity.getZCoord());
if (packet.wirelessEnabled && packet.controllerPosition != null
&& pos.compareTo(packet.controllerPosition) != 0) return false;
public static void enableWirelessNetWork(IGregTechTileEntity entity) {
getPacketByUserId(entity.getOwnerUuid()).setWirelessEnabled(true);
if (packet.controllerPosition == null) {
packet.controllerPosition = new Vec3Impl(entity.getXCoord(), entity.getYCoord(), entity.getZCoord());
}
return true;
}

public static void disableWirelessNetWork(IGregTechTileEntity entity) {
var packet = getPacketByUserId(entity.getOwnerUuid());
Vec3Impl pos = new Vec3Impl(entity.getXCoord(), entity.getYCoord(), entity.getZCoord());
if (packet.controllerPosition != null && packet.controllerPosition.compareTo(pos) != 0) return;
getPacketByUserId(entity.getOwnerUuid()).setWirelessEnabled(false);
}

Expand Down
Loading

0 comments on commit 8e7df47

Please sign in to comment.