Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
d0be355
🚰 Fix creative pumps not interacting with pipe networks properly
UnderscoreKilburn Feb 19, 2025
830574f
⛏️ Datagen friendly mineable tags (and other things)
UnderscoreKilburn Feb 20, 2025
16baea2
🔧More wrenchability
UnderscoreKilburn Feb 20, 2025
8b53370
⚡Fixed a couple wrench related issues with the Dynamo when in arc fur…
UnderscoreKilburn Feb 20, 2025
6918cfe
🔑Allow keypunch to be rotated when right clicked with a wrench instea…
UnderscoreKilburn Feb 20, 2025
8101104
🧪Fixed test tube racks not dropping their contents when broken
UnderscoreKilburn Feb 20, 2025
75e6b95
👋 Fix broken right click interaction with Create's configurable blocks
UnderscoreKilburn Feb 21, 2025
661c626
💧 Fix vat fluid dupe
UnderscoreKilburn Feb 22, 2025
02fde74
🌡️ Fix vat temperature and pressure monitors not saving their thresholds
UnderscoreKilburn Feb 23, 2025
497566f
📡 Fix temperature/pressure sensors not saving their settings
UnderscoreKilburn Feb 28, 2025
eae9abc
💧 Cleaned up creative pump GUI to be slightly more compact
UnderscoreKilburn Feb 28, 2025
c408da4
🔪 Fully clientside Swiss Army Knife animation logic
UnderscoreKilburn Feb 28, 2025
ddcd6a8
💨 Janky duct tape fix for Vat gas duplication
UnderscoreKilburn Feb 28, 2025
62721a6
🚰 Tentative fix for fluid transfer getting stuck when pumping out of …
UnderscoreKilburn Feb 28, 2025
90536ce
Merge remote-tracking branch 'upstream/1.20.1' into 1.20.1
UnderscoreKilburn Feb 28, 2025
fd9ecd8
Merge remote-tracking branch 'upstream/1.20.1' into 1.20.1
UnderscoreKilburn Mar 15, 2025
05610e1
↩️ Safer redirect for FluidPropagatorMixin
UnderscoreKilburn Mar 15, 2025
c4ce847
🔪 Clientside animation logic for Swiss Army Knife (for real this time)
UnderscoreKilburn Mar 15, 2025
322e2fa
🫥 Fix mixtures in beakers disappearing when looked at with Jade insta…
UnderscoreKilburn Mar 15, 2025
1208372
☢️ Fix pollutometer reading radiation levels instead of greenhouse ga…
UnderscoreKilburn Mar 15, 2025
2a58991
Merge pull request #1 from flynnvali/1.20.1
UnderscoreKilburn Mar 15, 2025
e6f912a
💬 Language fixes
UnderscoreKilburn Mar 15, 2025
7ef19b2
🧊 Fix KubeJS removing circuit boards from recipes that contain them
UnderscoreKilburn Mar 16, 2025
168ba10
Merge pull request #2 from flynnvali/acetylides
UnderscoreKilburn Mar 17, 2025
f19b87f
🛢️ Temporary fix for TFMG compatibility
UnderscoreKilburn Mar 23, 2025
97bf0ec
👓 Less buggy Colorimeters
UnderscoreKilburn Mar 23, 2025
7129947
➕ Possibly fixed a server freeze issue with the Vat and other weird i…
UnderscoreKilburn Mar 23, 2025
a73ded6
🫳 Pick up, put down, flick levers
UnderscoreKilburn Mar 23, 2025
6f5d08d
🎒 Temp fix for Sophisticated Storage compatibility
UnderscoreKilburn Mar 23, 2025
5fb46c4
🧪 Fancy JEI
UnderscoreKilburn Mar 23, 2025
11dfef7
🥛 Stacking tubes
UnderscoreKilburn Mar 23, 2025
22a47f0
⚾ Misplaced balls
UnderscoreKilburn Mar 24, 2025
54f640e
💀 Should've tested this
UnderscoreKilburn Mar 25, 2025
b33d129
⛛ This is giving me a tetraheadache
UnderscoreKilburn Mar 26, 2025
bb49d52
🍞 Baking molecules
UnderscoreKilburn Mar 27, 2025
47a0103
⤵️ Bad rotation
UnderscoreKilburn Mar 27, 2025
da8f438
📋 More JEI tweaks
UnderscoreKilburn Mar 27, 2025
68991d2
🚂 Chemical transportation
UnderscoreKilburn Mar 27, 2025
c2f5677
🔨 Fix hard dependency on JEI
UnderscoreKilburn Mar 27, 2025
2faac4b
❌ Whoops, broke basins
UnderscoreKilburn Mar 27, 2025
edfc0af
🔧 More molecule rendering fixes
UnderscoreKilburn Mar 28, 2025
d4bfe44
💨 No pressure m8
UnderscoreKilburn Mar 28, 2025
3b3f803
🧹 All about the little things
UnderscoreKilburn Mar 29, 2025
d13545a
🛞 Flywheel real
UnderscoreKilburn Mar 30, 2025
9de4984
🏃 Faster molecule rendering
UnderscoreKilburn Mar 30, 2025
5ea4620
🖌️ More visual nitpicking
UnderscoreKilburn Mar 30, 2025
3a5d234
🧑‍🤝‍🧑 Community Edition fixes
UnderscoreKilburn Mar 30, 2025
85ada74
🔥 Heat buffer
UnderscoreKilburn Mar 31, 2025
299fbb0
❄️ Coolers cool
UnderscoreKilburn Mar 31, 2025
9bb679b
🐕 wow so cool much original
UnderscoreKilburn Mar 31, 2025
00f2a66
🌍 Whoops, messed up dedicated servers again
UnderscoreKilburn Apr 1, 2025
435be71
Merge branch '1.20.1' into heat-rebalance
UnderscoreKilburn Apr 1, 2025
4c4429a
🌡️ Never studied thermodynamics
UnderscoreKilburn Apr 2, 2025
77bcf04
♨️ Finetuning and cleanup
UnderscoreKilburn Apr 3, 2025
397ccc7
🍲 Can't forget about Basins
UnderscoreKilburn Apr 4, 2025
97ee61a
💵 Caching out
UnderscoreKilburn Apr 4, 2025
3026bef
✒️ Speelchecking
UnderscoreKilburn Apr 4, 2025
e3e9736
⬆️ Version up
UnderscoreKilburn Apr 5, 2025
fd7572f
💥 Mixed opinion
UnderscoreKilburn Apr 5, 2025
2e97490
🌈 Mixin it up
UnderscoreKilburn Apr 7, 2025
81be6d9
🧽 Minor Supplementaries compat fixes
UnderscoreKilburn Apr 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Destroy
# Destroy - Snapshot 𝑖

Destroy is a chemistry-themed add-on to the popular Create mod. Right now it's under development.
A modified version of [Destroy](https://modrinth.com/mod/destroy/) that aims to fix several bugs which prevented the automation of many processes in Survival mode.
Comes with a handful of quality of life features, including minor recipe tweaks and better readability when viewing chemical reactions in JEI.

Find out more on the [Discord](https://discord.gg/6EBJ3AzbHu) and [Modrinth](https://modrinth.com/mod/destroy/) page.

Currently, 1.0 is in development. **This will still be a beta release**.

# License

All rights are reserved unless otherwise explicitly stated.
This is currently based on the 0.1.1 version, which is **not** compatible with the latest version of Create!

Make sure you have the following mods installed before running this:
- [Create 0.5.1j](https://modrinth.com/mod/create/version/1.20.1-0.5.1.j)
- [Petrolpark's Library 1.4.2](https://modrinth.com/mod/petrolpark/version/1.20.1-1.4.2)

If you run into any issues, please report them here, not on the main Destroy GitHub page. Thank you!
52 changes: 48 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ afterEvaluate {
tasks.configureReobfTaskForReobfJarJar.mustRunAfter(tasks.compileJava)
}

// Mod Detailss
// Mod Details
version = "${mod_version}"
group = 'com.petrolpark.destroy'
archivesBaseName = "destroy-${minecraft_version}"
Expand Down Expand Up @@ -150,6 +150,28 @@ repositories {
maven { // Blueprint
url = "https://maven.jaackson.me"
}

maven { // Architectury
url = "https://maven.architectury.dev"
content {
includeGroup "dev.architectury"
}
}
maven { // KubeJS and Rhino
url = "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.latvian.mods"
}
}

maven { // EMI
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/"
}

maven { // MixinSquared (may god have mercy)
url = "https://maven.bawnorton.com/releases"
}
}

configurations {
Expand Down Expand Up @@ -195,7 +217,7 @@ dependencies {
// JEI
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")

// Farmer's Delight
compileOnly fg.deobf("curse.maven:farmers-delight-398521:${farmersdelight_version}")
Expand All @@ -211,12 +233,34 @@ dependencies {
implementation fg.deobf("com.rbasamoyai:ritchiesprojectilelib:1.0.0-369e88d+1.20.1-forge")
implementation fg.deobf("com.rbasamoyai:createbigcannons:${cbc_version}")

// Supplementaries
implementation fg.deobf("maven.modrinth:moonlight:forge_1.20-2.13.71")
implementation fg.deobf("maven.modrinth:supplementaries:1.20-3.1.18")

// Embeddium
compileOnly fg.deobf("maven.modrinth:embeddium:${embeddium_version}+mc${minecraft_version}")

implementation fg.deobf("maven.modrinth:embeddium:${embeddium_version}+mc${minecraft_version}")

// Jade
runtimeOnly fg.deobf("maven.modrinth:jade:${jade_version}")

// KubeJS
runtimeOnly fg.deobf("dev.latvian.mods:rhino-forge:${rhino_version}")
runtimeOnly fg.deobf("dev.latvian.mods:kubejs-forge:${kubejs_version}")
runtimeOnly fg.deobf("dev.architectury:architectury-forge:${architectury_version}")

implementation fg.deobf("maven.modrinth:sophisticated-core:1.20.1-1.2.23.902")
runtimeOnly fg.deobf("maven.modrinth:sophisticated-backpacks:1.20.1-3.23.6.1211")

// ANNOTATION PROCESSORS

// MixinSquared's annotationProcessor MUST be registered BEFORE Mixin's one.
compileOnly(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-common:${mixin_squared_version}"))
implementation(jarJar("com.github.bawnorton.mixinsquared:mixinsquared-forge:${mixin_squared_version}")) {jarJar.ranged(it, "[${mixin_squared_version},)")}

annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"

compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixin_extras_version}"))
implementation(jarJar("io.github.llamalad7:mixinextras-forge:${mixin_extras_version}")) {jarJar.ranged(it, "[${mixin_extras_version},)")}
}

jar {
Expand Down
12 changes: 10 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false

# Destroy info
mod_version = 0.1.1
mod_version = 0.1.1-snapshot-i+1
minecraft_version = 1.20.1
forge_version = 47.3.7

Expand All @@ -11,6 +11,8 @@ forgegradle_version = 6.0.26
cursegradle_version = 1.4.0
mixingradle_version = 0.7-SNAPSHOT
mixin_version = 0.8.5
mixin_extras_version = 0.4.1
mixin_squared_version = 0.2.0
librarian_version = 1.+
parchment_version = 2023.09.03

Expand All @@ -21,10 +23,16 @@ flywheel_version = 0.6.11-13
registrate_version = MC1.20-1.3.3

# Optional mod dependency info
jei_version = 15.12.3.55
jei_version = 15.20.0.106
farmersdelight_version = 4638874
blueprint_version = 7.0.0
spark_version = 4587309
cbc_version = 5.5.0+mc.1.20.1-forge
curios_version = 5.9.1
embeddium_version = 0.3.30

jade_version = 11.12.3+forge
kubejs_version = 2001.6.5-build.18
rhino_version = 2001.2.3-build.10
architectury_version = 9.2.14
emi_version = 1.1.20+1.20.1
2 changes: 0 additions & 2 deletions gradle/gradle-daemon-jvm.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"destroy:tree_tap",
"destroy:vat_controller",
"destroy:vat_side",
"destroy:vat_controller",
"destroy:blacklight",
"destroy:carbon_fiber_block",
"destroy:fluorite_block",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public enum DestroyAdvancementTrigger {
COLORIMETER,
COMPLETE_SEISMOGRAPH,
CUT_ONIONS,
DISTILL("distill", "distillations"),
DISTILL("distill", "distillation"),
CHARGE_WITH_DYNAMO("charge_with_dynamo", "dynamo_charging"),
ELECTROLYZE_WITH_DYNAMO("electrolyze_with_dynamo", "electrolyze_with_dynamo"),
ELECTROLYZE_WITH_DYNAMO("electrolyze_with_dynamo", "dynamo_electrolysis"),
ETHYLANTHRAQUINONE,
EXTRUDE,
FILL_SEISMOGRAPH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.petrolpark.destroy.content.logistics.siphon.SiphonRenderer;
import com.petrolpark.destroy.content.oil.pumpjack.PumpjackBlockEntity;
import com.petrolpark.destroy.content.oil.pumpjack.PumpjackCamBlockEntity;
import com.petrolpark.destroy.content.oil.pumpjack.PumpjackInstance;
import com.petrolpark.destroy.content.oil.pumpjack.PumpjackRenderer;
import com.petrolpark.destroy.content.processing.ageing.AgeingBarrelBlockEntity;
import com.petrolpark.destroy.content.processing.ageing.AgeingBarrelRenderer;
Expand All @@ -24,15 +25,17 @@
import com.petrolpark.destroy.content.processing.glassblowing.BlowpipeBlockEntity;
import com.petrolpark.destroy.content.processing.glassblowing.BlowpipeBlockEntityRenderer;
import com.petrolpark.destroy.content.processing.sieve.MechanicalSieveBlockEntity;
import com.petrolpark.destroy.content.processing.sieve.MechanicalSieveInstance;
import com.petrolpark.destroy.content.processing.sieve.MechanicalSieveRenderer;
import com.petrolpark.destroy.content.processing.treetap.TreeTapBlockEntity;
import com.petrolpark.destroy.content.processing.treetap.TreeTapInstance;
import com.petrolpark.destroy.content.processing.treetap.TreeTapRenderer;
import com.petrolpark.destroy.content.processing.trypolithography.keypunch.KeypunchBlockEntity;
import com.petrolpark.destroy.content.processing.trypolithography.keypunch.KeypunchInstance;
import com.petrolpark.destroy.content.processing.trypolithography.keypunch.KeypunchRenderer;
import com.petrolpark.destroy.content.redstone.programmer.RedstoneProgrammerBlockEntity;
import com.petrolpark.destroy.content.redstone.programmer.RedstoneProgrammerBlockEntityRenderer;
import com.petrolpark.destroy.content.sandcastle.SandCastleBlockEntity;
import com.petrolpark.destroy.core.block.entity.instance.HorizontalShaftlessCogwheelInstance;
import com.petrolpark.destroy.core.chemistry.storage.ElementTankBlockEntity;
import com.petrolpark.destroy.core.chemistry.storage.ElementTankRenderer;
import com.petrolpark.destroy.core.chemistry.storage.SimpleMixtureTankBlockEntity.SimplePlaceableMixtureTankBlockEntity;
Expand Down Expand Up @@ -138,7 +141,7 @@ public class DestroyBlockEntityTypes {

public static final BlockEntityEntry<KeypunchBlockEntity> KEYPUNCH = REGISTRATE
.blockEntity("keypunch", KeypunchBlockEntity::new)
.instance(() -> HorizontalShaftlessCogwheelInstance::new)
.instance(() -> KeypunchInstance::new)
.validBlocks(DestroyBlocks.KEYPUNCH)
.renderer(() -> KeypunchRenderer::new)
.register();
Expand All @@ -151,6 +154,7 @@ public class DestroyBlockEntityTypes {

public static final BlockEntityEntry<MechanicalSieveBlockEntity> MECHANICAL_SIEVE = REGISTRATE
.blockEntity("mechanical_sieve", MechanicalSieveBlockEntity::new)
.instance(() -> MechanicalSieveInstance::new)
.validBlock(DestroyBlocks.MECHANICAL_SIEVE)
.renderer(() -> MechanicalSieveRenderer::new)
.register();
Expand All @@ -163,7 +167,7 @@ public class DestroyBlockEntityTypes {

public static final BlockEntityEntry<PumpjackBlockEntity> PUMPJACK = REGISTRATE
.blockEntity("pumpjack", PumpjackBlockEntity::new)
//.instance(() -> PumpjackInstance::new, false) Can't use instancing because that can't render cutout for some reason
.instance(() -> PumpjackInstance::new)
.validBlocks(DestroyBlocks.PUMPJACK)
.renderer(() -> PumpjackRenderer::new)
.register();
Expand Down Expand Up @@ -198,6 +202,7 @@ public class DestroyBlockEntityTypes {

public static final BlockEntityEntry<TreeTapBlockEntity> TREE_TAP = REGISTRATE
.blockEntity("tree_tap", TreeTapBlockEntity::new)
.instance(() -> TreeTapInstance::new)
.validBlock(DestroyBlocks.TREE_TAP)
.renderer(() -> TreeTapRenderer::new)
.register();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/petrolpark/destroy/DestroyBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public class DestroyBlocks {
.properties(p -> p
.mapColor(MapColor.SNOW)
).item(MixedExplosiveBlockItem::new)
.onRegister(registerPrimeableBombDispenserBehaviour())
.onRegister(item -> DispenserBlock.registerBehavior(item, ((MixedExplosiveBlock)item.getBlock()).new CustomExplosiveMixDispenseBehaviour()))
.build()
.register();

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/petrolpark/destroy/DestroyClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.petrolpark.destroy;

import com.petrolpark.Petrolpark;
import com.petrolpark.destroy.client.DestroyItemDisplayContexts;
import com.petrolpark.destroy.client.DestroyPartials;
import com.petrolpark.destroy.client.DestroyParticleTypes;
Expand All @@ -9,6 +10,7 @@
import com.petrolpark.destroy.client.FogHandler;
import com.petrolpark.destroy.core.extendedinventory.ExtendedInventoryClientHandler;

import com.petrolpark.item.decay.DecayingItemHandler;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

Expand All @@ -24,6 +26,9 @@ public class DestroyClient {
public static void clientInit(final FMLClientSetupEvent event) {
event.enqueueWork(() -> { // Work which must be done on main thread
DestroyItemProperties.register();

// TODO: This is supposed to be done by the Petrolpark library, remove this once this is properly fixed
Petrolpark.DECAYING_ITEM_HANDLER.set(new DecayingItemHandler.ClientDecayingItemHandler());
});
DestroyPonderTags.register();
DestroyPonderIndex.register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public void heat(float energyDensity) {

temperatureChange = nextHigherBoilingPoint.getFirst() - temperature; // Only increase the temperature by enough to get to the next BP
temperature += temperatureChange; // Raise the Mixture to the boiling point
energyDensity -= temperatureChange * getVolumetricHeatCapacity(); // Energy leftover once the Mixture has been raised to the boiling point
energyDensity -= temperatureChange * volumetricHeatCapacity; // Energy leftover once the Mixture has been raised to the boiling point

LegacySpecies molecule = nextHigherBoilingPoint.getSecond();
float liquidConcentration = getConcentrationOf(molecule) * (1f - states.get(molecule)); // The moles per bucket of liquid Molecules
Expand Down Expand Up @@ -448,7 +448,7 @@ public void heat(float energyDensity) {

temperatureChange = nextLowerBoilingPoint.getFirst() - temperature; // Only decrease the temperature by enough to get to the next condensation point
temperature += temperatureChange; // Decrease the Mixture to the boiling point
energyDensity -= temperatureChange * getVolumetricHeatCapacity(); // Additional energy once the Mixture has been lowered to the condensation point
energyDensity -= temperatureChange * volumetricHeatCapacity; // Additional energy once the Mixture has been lowered to the condensation point

LegacySpecies molecule = nextLowerBoilingPoint.getSecond();
float gasConcentration = getConcentrationOf(molecule) * states.get(molecule);
Expand Down Expand Up @@ -654,7 +654,7 @@ public Phases separatePhases(double initialVolume) {
// Add Reaction Results to new Mixtures
for (Entry<ReactionResult, Float> entry : reactionResults.entrySet()) {
double resultMoles = entry.getValue() * initialVolume;
double newTotalVolume = newLiquidVolume * newGasVolume;
double newTotalVolume = newLiquidVolume + newGasVolume;
liquidMixture.reactionResults.put(entry.getKey(), (float)(resultMoles / newTotalVolume)); // A cancelled-out expression for (resultMoles / liquidVolume) * (liquidVolume / (liquidVolume + gasVolume)). Essentially we just divvy out the results based on the volumes of the two phases
gasMixture.reactionResults.put(entry.getKey(), (float)(resultMoles / newTotalVolume));
};
Expand Down Expand Up @@ -723,18 +723,36 @@ protected void incrementReactionResults(LegacyReaction reaction, float molesPerB
* @param heatingPower The power being supplied to this Basin by the {@link com.petrolpark.destroy.core.chemistry.vat.IVatHeaterBlock heater} below it.
* @param outsideTemperature The {@link com.petrolpark.destroy.core.pollution.Pollution#getLocalTemperature temperature} outside the Basin.
*/
public ReactionInBasinResult reactInBasin(int volume, List<ItemStack> availableStacks, float heatingPower, float outsideTemperature) {
public ReactionInBasinResult reactInBasin(int volume, List<ItemStack> availableStacks, float heatingTemperature, float outsideTemperature) {
float volumeInLiters = (float)volume / Constants.MILLIBUCKETS_PER_LITER;
int ticks = 0;

// Bottom face receives heat, other faces dissipate heat into the environment
// The bottom face is more conductive than the other faces, this is balanced in such a way that a kindled Blaze Burner
// reaches roughly 130°C and a superheated Blaze Burner reaches roughly 360°C, hot enough to boil mercury
float averageTemperature = (1.35f * heatingTemperature + 4.65f * outsideTemperature) / 6f;

ReactionContext context = new ReactionContext(availableStacks, 0f, false);
dissolveItems(context, volumeInLiters); // Dissolve all Items
while (!equilibrium && ticks < 600) { // React the Mixture
float energyChange = heatingPower / TICKS_PER_SECOND;
energyChange += (outsideTemperature - temperature) * 100f / TICKS_PER_SECOND; // Fourier's Law (sort of), the Basin has a fixed conductance of 100 andthe divide by 20 is for 20 ticks per second
if (Math.abs(energyChange) > 0.0001f) {
heat(1000 * energyChange / volume); // 1000 converts getFluidAmount() in mB to Buckets
while (ticks < 600) { // React the Mixture
// Fourier's Law (sort of), the Basin has a fixed conductance and the divide by 20 is for 20 ticks per second
// The Basin is given unrealistically high conductance to help make it more reliable by ensuring that the
// contained Mixture reaches its target temperature quickly.
float temperatureDifference = averageTemperature - temperature;
float energyChange = temperatureDifference * 300000f / TICKS_PER_SECOND;
float predictedMixtureTemperatureChange = Math.abs(energyChange / (volumeInLiters * getVolumetricHeatCapacity()));

if (predictedMixtureTemperatureChange > 0.001f) {
// Prevent temperature from exploding to infinity due to the high conductance and time step
// This is a certified Euler moment and I'm too lazy to switch over to a fancier integrator for the moment
if (predictedMixtureTemperatureChange > Math.abs(temperatureDifference))
energyChange *= 0.99f * Math.abs(temperatureDifference) / predictedMixtureTemperatureChange;

heat(energyChange / volumeInLiters);
} else if(equilibrium) {
break;
};

reactForTick(context, 1);
ticks++;
};
Expand Down Expand Up @@ -768,7 +786,6 @@ public Map<ReactionResult, Integer> getCompletedResults(double volumeInLiters) {

// Decrease the amount of Reaction that has happened
reactionResults.replace(result, molesPerLiterOfReaction - numberOfResult * result.getRequiredMoles() / (float)volumeInLiters);

results.put(result, numberOfResult);
};
// reactionResults.keySet().removeIf(result -> { // Remove any one-off Results and Results which have run out
Expand Down
Loading