Skip to content

Commit

Permalink
Merge pull request #158 from Thorfusion/Performance-Boost
Browse files Browse the repository at this point in the history
Server Performance boost
  • Loading branch information
maggi373 committed Jan 31, 2024
2 parents 1417fde + 674c9c9 commit 04e55af
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Mekanism.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.7.10:9.10.34:(22/22/24) FIXES for EVERYONE!
1.7.10:9.10.35:(22/22/22) Server Performance boost!
1.12.2:9.12.8:(22/22/22) FIXES for EVERYONE!
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Mekanism CE also has two dependencies that it requires, as a modpack creator DO
| FEATURE: [Configurable radius digitalminer](https://github.com/Thorfusion/Mekanism-Community-Edition/issues/55) | :x: | :heavy_check_mark: |
| FEATURE: [Whitelist dimension's for windmill](https://github.com/Thorfusion/Mekanism-Community-Edition/issues/16) | :x: | :heavy_check_mark: |
| FEATURE: [Immersive Deuterium](https://github.com/Thorfusion/Mekanism-Community-Edition/pull/94) | :x: | :heavy_check_mark: |
| PERFORMANCE: [Fix Infinite Heat Transfers](https://github.com/Thorfusion/Mekanism-Community-Edition/pull/158) | :x: | :heavy_check_mark: |
| NEW FEATURES, BUGFIXES & MORE! | :x: | :heavy_check_mark: |

### Full changelog
Expand Down Expand Up @@ -152,6 +153,7 @@ Note that changes not by the mekanism ce team has been added by us from their re
+ Fixes CMEs crashes in https://github.com/Thorfusion/Mekanism-Community-Edition/pull/141
+ Plat Compat Shenanigans in https://github.com/Thorfusion/Mekanism-Community-Edition/pull/142
+ Patch Personal Chest dupe in https://github.com/Thorfusion/Mekanism-Community-Edition/pull/143
+ Fixed lag with in heat transferring devices https://github.com/Thorfusion/Mekanism-Community-Edition/pull/158

#### leytilera
+ universal cable connection to IC2
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ FMP_version=1.2.0.345
CCLIB_version=1.1.3.141
NEI_version=1.0.5.120
CCC_version=1.0.7.48
mod_version=9.10.34
alt_version=9, 10, 34
mod_version=9.10.35
alt_version=9, 10, 35
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,14 @@ public double[] simulateHeat()
@Override
public double applyTemperatureChange()
{
temperature += heatToAbsorb / locations.size();
if (heatToAbsorb < 0) { // Heat subtraction
double newTemperature = temperature + (heatToAbsorb / locations.size());
temperature = newTemperature >= 0.01 ? newTemperature : 0.0;
} else {
temperature += heatToAbsorb / locations.size();
}
heatToAbsorb = 0;

return temperature;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ public double[] simulateHeat()
@Override
public double applyTemperatureChange()
{
temperature += tier.inverseHeatCapacity * heatToAbsorb;
if (heatToAbsorb < 0) { // Heat subtraction
double newTemperature = temperature + (tier.inverseHeatCapacity * heatToAbsorb);
temperature = newTemperature >= 0.01 ? newTemperature : 0.0;
} else {
temperature += tier.inverseHeatCapacity * heatToAbsorb;
}
heatToAbsorb = 0;

if(Math.abs(temperature - clientTemperature) > (temperature / 100))
Expand Down
68 changes: 41 additions & 27 deletions src/main/java/mekanism/common/tile/TileEntityFuelwoodHeater.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ public class TileEntityFuelwoodHeater extends TileEntityContainerBlock implement
{
public double temperature;
public double heatToAbsorb = 0;

public int burnTime;
public int maxBurnTime;

/** Whether or not this machine is in it's active state. */
public ItemStack nonBurnable;


/** Whether this machine is in its active state. */
public boolean isActive;

/** The client's current active state. */
Expand Down Expand Up @@ -73,44 +75,51 @@ public void onUpdate()
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
}
}

boolean burning = false;

if(burnTime > 0)
{
burnTime--;
burning = true;
}
else {
if(inventory[0] != null)
{
maxBurnTime = burnTime = TileEntityFurnace.getItemBurnTime(inventory[0])/2;

if(burnTime > 0)
{
inventory[0].stackSize--;

if(inventory[0].stackSize == 0)
{
inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]);
if (inventory[0] != null && inventory[0] != nonBurnable) {
int fuelTime = TileEntityFurnace.getItemBurnTime(inventory[0]);

if (fuelTime > 0) {
nonBurnable = null;
maxBurnTime = burnTime = fuelTime / 2;

if (burnTime > 0) {
inventory[0].stackSize--;

if (inventory[0].stackSize == 0) {
inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]);
}

burning = true;
}
burning = true;
} else {
nonBurnable = inventory[0];
}
}
}



if(burning)
{
heatToAbsorb += general.heatPerFuelTick;
setActive(true);
} else if (isActive) {
setActive(false);
}

if (burning || temperature > 0) {
double[] loss = simulateHeat();
applyTemperatureChange();
lastEnvironmentLoss = loss[1];
}

double[] loss = simulateHeat();
applyTemperatureChange();

lastEnvironmentLoss = loss[1];

setActive(burning);
}
}

Expand Down Expand Up @@ -251,7 +260,12 @@ public double[] simulateHeat()
@Override
public double applyTemperatureChange()
{
temperature += heatToAbsorb;
if (heatToAbsorb < 0) { // Heat subtraction
double newTemperature = temperature + heatToAbsorb;
temperature = newTemperature >= 0.01 ? newTemperature : 0.0;
} else {
temperature += heatToAbsorb;
}
heatToAbsorb = 0;

return temperature;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,12 @@ public double applyTemperatureChange()
{
if(hasFrequency())
{
frequency.temperature += heatToAbsorb;
if (heatToAbsorb < 0) { // Heat subtraction
double newTemperature = frequency.temperature + heatToAbsorb;
frequency.temperature = newTemperature >= 0.01 ? newTemperature : 0.0;
} else {
frequency.temperature += heatToAbsorb;
}
}

heatToAbsorb = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,16 @@ public double[] simulateHeat()
}

@Override
public double applyTemperatureChange()
public double applyTemperatureChange()
{
temperature += heatToAbsorb;
if (heatToAbsorb < 0) { // Heat subtraction
double newTemperature = temperature + heatToAbsorb;
temperature = newTemperature >= 0.01 ? newTemperature : 0.0;
} else {
temperature += heatToAbsorb;
}
heatToAbsorb = 0;

return temperature;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,13 @@ public double[] simulateHeat()
@Override
public double applyTemperatureChange()
{
temperature += invHeatCapacity * heatToAbsorb;
if (heatToAbsorb < 0) { // Heat subtraction
double newTemperature = temperature + (invHeatCapacity * heatToAbsorb);
temperature = newTemperature >= 0.01 ? newTemperature : 0.0;
} else {
temperature += invHeatCapacity * heatToAbsorb;
}

heatToAbsorb = 0;
return temperature;
}
Expand Down

0 comments on commit 04e55af

Please sign in to comment.