Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Fixes for wireless chargers #852

Merged
merged 4 commits into from
Mar 22, 2024

Conversation

Jonodonozym
Copy link
Contributor

Addresses Modpack issue #14596

The wireless charger stops working in single player when the player saves and quits to the title screen, then reopens the world. Closing and relaunching the client is the only way to fix this.

This happens because while the Wireless Charger object gets destroyed when the chunk is unloaded, that 'ghost' object remains in the static ChargingHelper. When the chunk is reloaded, a new wireless charger object is created, but is not added to the ChargingHelper because the 'ghost' object occupies the same position. This 'ghost' object is drained of energy but doesn't receive any energy so it runs out after a few ticks.

This fix replaces the old 'ghost' charger object with the new instance of the same charger.

@Jonodonozym
Copy link
Contributor Author

Jonodonozym commented Mar 18, 2024

Also just spotted another theoretical bug for MP.

The tick counter in ChargingHelper increases per playertickevent rather than per servertickevent, meaning

  • only one player per second will get charged i.e. charges slower the more players are online
  • while there are an even number of players online, most of them will never get charged

Will add a fix shortly.

@Jonodonozym Jonodonozym changed the title Fix wireless chargers in SP Fix wireless chargers Mar 18, 2024
@Jonodonozym Jonodonozym changed the title Fix wireless chargers Fixes for wireless chargers Mar 18, 2024
@Dream-Master Dream-Master requested a review from a team March 19, 2024 19:57
@Dream-Master Dream-Master merged commit 39af314 into GTNewHorizons:master Mar 22, 2024
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants