Alternate Current

Alternate Current is a Fabric mod for 1.14, 1.15, 1.16, 1.17 version along with 1.8.9 via Legacy Fabric.

The mod expands on Redstone dust and block updates.

Short Answer:

An efficient and non-locational redstone dust implementation

Alternate Current is an efficient and non-locational redstone dust implementation. It can reduce mspt up to 20x compared to vanilla, and the block update order is non-locational and largely non-directional, making it much more intuitive to work with!

DISCLAIMER

As this mod is still in beta, more testing needs to be done to improve performance and vanilla parity.

Features

Alternate Current is an efficient and non-locational redstone dust implementation. With the mod you will see up to 30 times fewer block updates caused by redstone dust, and working with redstone dust will be less cumbersome, due to locationality no longer being an issue.

What Does It Actually Do?

In vanilla, redstone dust updates recursively. When a wire block is updated, it updates its power level and then updates the blocks around it. This is especially problematic with grids of redstone dust. It causes wire blocks to update their power level multiple times. This has serious performance detriments as these wire blocks will check for power multiple times and also emit countless unnecessary block updates. Furthermore, wire blocks emit block updates in an order that is dependent on the location of the wire. This makes redstone dust tedious to work with as it creates a chance your contraption does not work in other locations, and it is hard to figure out whether a contraption is locational.

This mod's implementation of redstone dust aims to fix all of these issues. It manages to do the following:

Each wire block checks for power only once.

Each wire block updates its power level only once.

Each wire block emits block updates only once.

Block updates are emitted in a predictable (though directional) order.

It achieves this by considering the power levels of the whole grid of wire blocks at once, rather than each wire in isolation. When a wire block receives a block update, all the wires it is connected to are collected into a "network". A breadth first search is done through this network to find wires that are receiving power from outside the network (power from non-wire components, mostly). The power levels of the grid are then updated in rings radiating outward from these wires. Block updates are emitted after all the power levels have been adjusted, in reverse order of the power level changes.

Changelog 1.2.1

This update fixes a crash bug and brings back support for Legacy Fabric.

1.2.0 - 1.3 to 1.13.2 Legacy Fabric, 1.14 to 1.18 Fabric

This update brings fixes and improvements for modders. Performance is otherwise unaffected.

Wires of different types would not interact properly, this has been fixed.

Performance of networks with many different wire types has been significantly improved.

Wire types with a power step of 0 (i.e. power does not decrease over distance) are now properly supported.

1.1.0 - 1.6-1.13.2 Legacy Fabric, 1.14 to 1.18 Fabric

Alternate Current is now available for Minecraft 1.6 and 1.18.

The /alternatecurrent command has been re-introduced and can be used to toggle the mod on and off.

/alternatecurrent: tells you whether the mod is currently on.

/alternatecurrent [on|off]: toggles the mod on or off.

1.0.0 - 1.7, 1.8, 1.12.2, 1.13.2 Legacy Fabric, 1.14-1.18 Fabric

Alternate Current is finally out of Beta! It is now in an excellent state, both int terms of performance and stability. I'd like to thank everyone who has stuck with me through the past several months, helping and testing the mod.

Legacy Fabric

Alternate Current is now available for Minecraft 1.7, 1.8, 1.12 and 1.13 through Legacy Fabric.

Improvements to connection management and clean-up give a 5-10% performance boost over 0.4.

Minor changes have been made to the update order to make it more consistent still.

0.4/0.4.1 - 1.14-1.18 Fabric

This is a big milestone for Alternate Current! 0.4 brings significant performance improvements as well as changes to the block update order to make it more intuitive. I do not foresee any major changes, meaning there might only be minor tweaks before a full 1.0 release!

0.4.1 - 1.17.1 Fabric

Fixed: crash when Alternate Current is used in combination with mods or data packs that extend the world height below y0.

0.4.0 - 1.14-1.18 Fabric

Added support for Minecraft 1.8 through Legacy Fabric.

Redstone wires now avoid sending block updates to any other redstone wires. While this can halve the mspt in extreme cases, it can also lead to unresponsive behavior when a network is "BUDded" in an invalid state.

Block update order now more closely follows the shape update order. Wires now emit both shape and block updates when setting their power level (in v0.3 wires would emit block updates in reverse order after the power levels had been set). This should make it behave more intuitively.

Fixed errors/crashes when replacing large amounts of dust with the /fill command.

0.3.0 - 1.14-1.17.1

Alternate Current 0.3.0 brings a slight performance boost over 0.2.0 and makes changes to the block update order. Heavily inspired by theosib's RedstoneWireTurbo, the block update order depends on the way power flows through wire networks.

The /alternatecurrent command has been removed. This means the only way to disable the mod is to remove it from your mods folder.

0.2.0 - 1.16-1.17.1

Alternate Current 0.2.0 brings some performance improvements over 0.1.3, while fixing several bugs.

Fixes

#1 spams the console with multiples of six.

#5 Observers run slower with alternate-current enabled.

Potential issues while power changes are happening and another network is updated.

0.1-0.1.3 - 1.16.5

Disclaimer

As this is the first release, more testing needs to be done to improve performance and vanilla parity.

0.1.3 - 1.16.5

The fixes in this update bring a slight performance loss, which I hope to reclaim in future updates.

Fixes

Potential memory leak when unloading chunks with redstone dust in them.

Redstone can break if the mod is repeatedly enabled/disabled while redstone is activating.

0.1.2 - 1.16.5

Changes

New optimizations for reducing the number of shape updates caused by redstone dust.

Fixes

Power levels can be incorrect in rare cases.

0.1.1 - 1.16.5

Fixes

Wire connections do not update when wires are (un)cut due to moving blocks.

Pistons breaking redstone dust can crash the game.

Block updates are sometimes not emitted in the order you would expect, breaking some 0-tick circuits.

Description on GitHub (0.1.0 for 1.16.5):

Alternate Current is an efficient and non-locational redstone dust implementation. With the mod you will see up to 20 times fewer block updates caused by redstone dust, and working with redstone dust will be less cumbersome, due to locationality no longer being an issue.

To enable the mod, use the /fastredstone enable command. To disable it, use the /fastredstone disable command.

What does it actually do?

In vanilla, redstone dust updates recursively. When a wire block is updated, it updates its power level and then updates the blocks around it. This is especially problematic with grids of redstone dust. It causes wire blocks to update their power level multiple times. This has serious performance detriments as these wire blocks will check for power multiple times and also emit countless unnecessary block updates. Furthermore, wire blocks emit block updates in an order that is dependent on the location of the wire. This makes redstone dust tedious to work with as it creates a chance your contraption does not work in other locations, and it is hard to figure out whether a contraption is locational.

This mod's implementation of redstone dust aims to fix all of these issues. It manages to do the following:

Each wire block checks for power only once.

Each wire block updates its power level only once.

Each wire block emits block updates only once.

Block updates are emitted in a predictable (though directional) order.

It achieves this by considering the power levels of the whole grid of wire blocks at once, rather than each wire in isolation. When a wire block receives a block update, all the wires it is connected to are collected into a "network". A breadth first search is done through this network to find wires that are receiving power from outside the network (power from non-wire components, mostly). The power levels of the grid are then updated in rings radiating outward from these wires. Block updates are emitted after all the power levels have been adjusted, in reverse order of the power level changes.