Skip to content

Commit

Permalink
just keep whacking it until it behaves
Browse files Browse the repository at this point in the history
  • Loading branch information
HbmMods committed Apr 15, 2024
1 parent 9206755 commit 673628b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 31 deletions.
30 changes: 3 additions & 27 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
## The new power network
The entire energy transfer system has been rewritten which should hopefully fix a few things
* Energy should no longer be voided (at least voiding is minimized due to timeouts for unloaded receivers)
* Transfers should be way less resource intensive, as the expected iteration count is now `max(providers, receivers)` instead of `providers * receivers`
The new system should respect priorities and diodes just like the old system did. Batteries still have their original three priority settings, diodes got two additional modes: LOWEST and HIGHEST.
A bunch of tests have been done using the most important machines, however not all machines that had to be changed for the new system have been fully tested. Expect some things to not work, in which case please file a bug report on the issues board.
Just like with the old system, grids going though unloaded chunks should still work so long as the endpoints are loaded. Grids should be less janky when changing while having unloaded parts, wwhich is likely the main cause for energy voiding.
The system can potentially support saving to the world, i.e. keeping unloaded grids functional even after the entire world is unloaded, although the functionality hasn't been implemented yet.

## Added
* New medium sized electricity pylons
* Come in wood and steel flavor
* The regular ones don't connect to cable blocks, the variants with transformers do (i.e. they act like substations for huge pylons)

## Changed
* Updated russian localization
* Condensers now need cast plates instead of welded plates
* Tweaked the substation recipe, it now yields two substations
* There is now a config option for steam clouds from cooling towers
* Nuclear explosions no longer play thunder and explosion sounds in a loop, instead they play one singular sound once the shockwave passes the player
* The HUD shake is now also synced up with the shockwave
* In addition to the hud shake, there is one brief screen shake, the same used for mini nukes (although it ends up being more subtle because your screen is most likely covered in shockwave dust)
* The HUD shake is now 3x more intense, but also only 1.5s long (instead of 5) making it snappier

## Fixed
* Changed the translation keys for bolts, pipes and shells to avoid naming conflicts
* Fixed glpyhid scout rampant mode spawning not working correctly
* Fixed nuclear explosions petrifying fallout layers, turning them into full sellafite blocks
* Fixed battery connection priority being broken, all battery blocks present during the previous updates will now have their priority default to LOW
* Fixed batteries sometimes ending up transferring themselves, wasting their entire receiving and sending speed on doing effectively nothing
* Energy tracking is still a bit flakey so there could be issues that remain with buffer mode batteries, however the transfer caps should mitigate most potential issues
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_version=1.0.27
# Empty build number makes a release type
mod_build_number=4935
mod_build_number=4936

credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms),\
\ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models,\
Expand Down
26 changes: 24 additions & 2 deletions src/main/java/api/hbm/energymk2/PowerNetMK2.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,30 @@ public void transferPower() {

IEnergyProviderMK2 src = providers.get(0);
IEnergyReceiverMK2 dest = receivers.get(0);

if(src.getPower() <= 0) { providers.remove(0); prevSrc = 0; continue; }

if(src == dest) { // STALEMATE DETECTED
//if this happens, a buffer will waste both its share of transfer and receiving potential and do effectively nothing, essentially breaking

//try if placing the conflicting provider at the end of the list does anything
//we do this first because providers have no priority, so we may shuffle those around as much as we want
if(providers.size() > 1) {
providers.add(providers.get(0));
providers.remove(0);
prevSrc = 0; //this might cause slight issues due to the tracking being effectively lost while there still might be pending operations
continue;
}
//if that didn't work, try shifting the receiver by one place (to minimize priority breakage)
if(receivers.size() > 1) {
receivers.add(2, receivers.get(0));
receivers.remove(0);
prevDest = 0; //ditto
continue;
}

//if neither option could be performed, the only conclusion is that this buffer mode battery is alone in the power net, in which case: not my provlem
}

long pd = priorityDemand[dest.getPriority().ordinal()];

Expand All @@ -175,8 +199,6 @@ public void transferPower() {
long toFill = Math.min(dest.getMaxPower() - dest.getPower(), receiverShare);

long finalTransfer = Math.min(toDrain, toFill);

if(src.getPower() <= 0) { providers.remove(0); prevSrc = 0; continue; }
if(toFill <= 0) { receivers.remove(0); prevDest = 0; continue; }

finalTransfer -= dest.transferPower(finalTransfer);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hbm/lib/RefStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (4935)";
public static final String VERSION = "1.0.27 BETA (4936)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ public void updateEntity() {

if(!worldObj.isRemote && worldObj.getBlock(xCoord, yCoord, zCoord) instanceof MachineBattery) {

if(priority == null || priority.ordinal() == 0 || priority.ordinal() == 4) {
priority = ConnectionPriority.LOW;
}

int mode = this.getRelevantMode();

if(this.node == null || this.node.expired) {
Expand Down

0 comments on commit 673628b

Please sign in to comment.