[go: nahoru, domu]

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

Fixes AutoBuilder block placement #84

Merged
merged 2 commits into from
Jul 16, 2021

Conversation

Sefiraat
Copy link
Member
@Sefiraat Sefiraat commented Jul 4, 2021

Description

Fixed the AutoBuilder not being able to... build. The AutoBuilder has not been able to build for some time and it is an advertised feature of the machine.

Changes

AutoBuilder#startup was checking the internal inventory but was handling the return boolean incorrectly. I inverted this and the result was the builder working correctly. After this I then reversed the whole if statement as it read much better with two positive questions as opposed to two not checks.

Related Issues

Resolves #61

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values

@Sefiraat Sefiraat requested a review from a team as a code owner July 4, 2021 19:42
@Sefiraat Sefiraat changed the title Fixes block placement Fixes AutoBuilder block placement Jul 4, 2021
Copy link
Member
@TheBusyBiscuit TheBusyBiscuit left a comment

Choose a reason for hiding this comment

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

You have no idea how long this took me to wrap my head around.
I had to draw a binary table for the values and compare it to the original implementation:

if (getBuildMode() != AutoBuilderMode.CLEAR) {
if (!initInventoryPointer()) {
setStatus(BuilderStatus.NO_INVENTORY);
return;
}
}
setStatus(BuilderStatus.RUNNING);

I drew this by hand on a piece of paper but here you go, suffer with me :P

C := getBuildMode() == AutoBuilderMode.CLEAR
I := initInventoryPointer()

C I !C !I !C & !I C v I
0 1 1 0 0 1
1 0 0 1 0 1
1 1 0 0 0 1
0 0 1 1 1 0

This part of STB really needs more documentation ._.

@TheBusyBiscuit TheBusyBiscuit merged commit 4d6c272 into Slimefun:master Jul 16, 2021
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.

Auto Builder does not recognize it's item inventory. All kinds of placement does not work
2 participants