GlowstoneMC / Glowstone

A fast, customizable and compatible open source server for Minecraft: Java Edition
https://glowstone.net
Other
1.88k stars 271 forks source link

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

Closed Red-Teapot closed 5 years ago

Red-Teapot commented 5 years ago

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.

Red-Teapot commented 5 years ago

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.

mastercoms commented 5 years ago

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

Red-Teapot commented 5 years ago

@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.