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

Implement slime blocks pushing and proper handling of non-movable blocks by pistons #1017

Merged
merged 16 commits into from
Mar 17, 2019
Merged

Implement slime blocks pushing and proper handling of non-movable blocks by pistons #1017

merged 16 commits into from
Mar 17, 2019

Conversation

Red-Teapot
Copy link
Contributor

@Red-Teapot Red-Teapot commented Feb 4, 2019

Added PistonMoveBehavior enum and corresponding methods in MaterialValueManager to store information about blocks push/pull behavior (e.g. bedrock does not push and pull, flowers drop when pushed and can't be pulled). All blocks can be pushed and pulled by default.

Pistons (including sticky variant) handle the behavior.

I haven't filled materialValues.yml yet so only bedrock and cobweb work for now.

This enum specifies behavior of blocks that are going to be moved (pushed or pulled) by a piston.

Values are: MOVE, BREAK (e.g. flowers), DONT_MOVE (e.g. bedrock)
@Red-Teapot Red-Teapot changed the title [WIP] Implement proper handling of non-movable blocks by pistons [WIP] Implement slime blocks pushing and proper handling of non-movable blocks by pistons Feb 5, 2019
@Red-Teapot
Copy link
Contributor Author

Red-Teapot commented Feb 19, 2019

I think I've fixed all the stuff I needed to fix. Material push/pull behaviors are not filled yet though. Works only for cobweb and bedrock just as an example of non-pushable/drop-on-move blocks.

@Red-Teapot Red-Teapot changed the title [WIP] Implement slime blocks pushing and proper handling of non-movable blocks by pistons Implement slime blocks pushing and proper handling of non-movable blocks by pistons Feb 23, 2019

// remove piston head after retracting
setType(me.getRelative(pistonBlockFace), 0, 0);
private void breakBlock(GlowBlock block) {
Copy link
Member

Choose a reason for hiding this comment

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

This logic doesn't take into account stuff like the doTileDrops gamerule and breaking containers (dropping chest contents). This kind of logic is already implemented in the DiggingMessage handler. Could you somehow merge this code?

If not, please leave a TODO and open an issue to support this.

Copy link
Contributor

@Pr0methean Pr0methean left a comment

Choose a reason for hiding this comment

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

What are the correct piston behaviors for water and lava? Also, do we need special handling for blocks that can fall after being pushed (sand, gravel, concrete powder, dragon egg)?

@mastercoms
Copy link
Member

Merging this because it's a great start in our incomplete server implementation. Will iterate further based on reviews in this PR.

@mastercoms mastercoms merged commit 512ba7e into GlowstoneMC:dev Mar 17, 2019
@Red-Teapot
Copy link
Contributor Author

Red-Teapot commented Mar 18, 2019

@Pr0methean Movement behaviors for liquids are specified in material values. The only difference is that getMinedDrops() for liquids returns item stack containing liquid block (the method is not overridden). I'm not sure if I should override that method to return an empty stack so I made a workaround. It seems like liquids are destroyed on push and do not move on pull in vanilla game.

Regarding gravity-affected stuff, it's hard to say because it is hardly working already, e.g. blocks don't fall when a block below them is destroyed. Maybe I'll try to find out how to make blocks fall when I get some free time.

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.

6 participants