Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single block pump refactor & bugfix #1300

Merged
merged 1 commit into from
Nov 25, 2017
Merged

Single block pump refactor & bugfix #1300

merged 1 commit into from
Nov 25, 2017

Conversation

mitchej123
Copy link
Contributor

Was having trouble with pumps downstream in the GTNH fork, figured I'd offer it up here as well if there's any interest.

  1. Pump will properly save it's state and reload with chunk load/reload.
    It remembers that it was pumping and doesn't immediately move down.
    Additionally, corrected saving of fluid type so it will properly look it
    up when it reloads

  2. Fixed getYHeadOfPump() so it doesn't punch through bedrock if you
    destroy the pump head. If you break a gap into an existing pipe line,
    it will move down through the broken spots until it finds an existing
    set of pipes - in which case it will continue from the bottom. If you
    break the pump head, it will replace the last pipe with a new Head and
    carry on about it's business.

1) Pump will properly save it's state and reload with chunk load/reload.
It remembers that it was pumping and doesn't immediately move down.
Additionally, corrected saving of fluid type so it will properly look it
up when it reloads

2) Fixed getYHeadOfPump() so it doesn't punch through bedrock if you
destroy the pump head.  If you break a gap into an existing pipe line,
it will move down through the broken spots until it finds an existing
set of pipes - in which case it will continue from the bottom.  If you
break the pump head, it will replace the last pipe with a new Head and
carry on about it's business.
int yHead = getYOfPumpHead();
if (yHead <= 0) {
if (yHead <= 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes flat bedrock.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but this function shouldn't otherwise punch through anything solid (the consume fluid prevents that).

This was one of the first places I changed while tracking down the bug that was punching through bedrock -- which turned out to actually be in getYHeadOfPump() which was indiscriminately replacing blocks.

Copy link
Collaborator

@draknyte1 draknyte1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather appreciate the verbose comments throughout.
At the y == 1 comment I left, maybe also check if it's bedrock?

@Blood-Asp Blood-Asp merged commit 84e95d3 into Blood-Asp:unstable Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants