-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Implement Moss blocks #6885
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
base: minor-next
Are you sure you want to change the base?
Implement Moss blocks #6885
Conversation
# Conflicts: # src/block/BlockTypeIds.php
dktapps
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know WTF is going on with Mossy Carpet
|
Sorry for all the WTFs btw. Since I'm not familiar with pale moss carpets I was tripping out wondering if you'd vibecoded the class for it 😂 |
src/block/PaleMossCarpetVine.php
Outdated
|
|
||
| use pocketmine\item\Item; | ||
|
|
||
| class PaleMossCarpetVine extends PaleMossCarpet{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems suspicious. When is a carpet not a carpet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm not sure I understand the question. If it's the top part, it doesn't have the carpet texture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instanceof PaleMossCarpet will return true for the vines, which are not really carpets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we should separate these two classes? These two blocks have similarities so I thought we could make isCarpetPart()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class name looks weird too. Its more a PaleMossVine only ? I'm agree that extending PaleMossCarpet is creepy, would be better to add a trait if you have many duplicate code ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we should separate these two classes? These two blocks have similarities so I thought we could make
isCarpetPart()
You could have a common base class if you want, but the instanceof PaleMossCarpet returning true feels like a problem to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the naming of the base class, BasePaleMossCarpet seems a bit odd in the "base" part. What do you think? Or maybe I'm overthinking it
It's in line with the naming of abstract classes from other blocks though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PaleMossVegetation? PaleMossPlant? idk
ShockedPlot7560
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if I missed something with the TODO removing ? Does minecraft changed the behavior ?
src/block/PaleMossCarpetVine.php
Outdated
|
|
||
| use pocketmine\item\Item; | ||
|
|
||
| class PaleMossCarpetVine extends PaleMossCarpet{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class name looks weird too. Its more a PaleMossVine only ? I'm agree that extending PaleMossCarpet is creepy, would be better to add a trait if you have many duplicate code ?
|
I added the DIRT tag to the moss block. That's what the game does to check for support for most blocks |
|
This PR has been marked as "Waiting on Author", but we haven't seen any activity in 7 days. If there is no further activity, it will be closed in 28 days. Note for maintainers: Adding an assignee to the PR will prevent it from being marked as stale. |
src/block/PaleMossVine.php
Outdated
|
|
||
| protected function canBeSupportedAt(Block $block) : bool{ | ||
| $below = $block->getSide(Facing::DOWN); | ||
| return $below instanceof PaleMossVine && $below->isCarpetPart(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type ID would make more sense for this
src/block/PaleMossCarpet.php
Outdated
| use pocketmine\player\Player; | ||
| use pocketmine\world\BlockTransaction; | ||
|
|
||
| class PaleMossCarpet extends PaleMossVine{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of this either.
My thinking was to have a base class and then the carpet and vine would individually extend it.
That way you wouldn't need a dodgy hack to avoid the infinite recursion for asItem()
This PR implements moss blocks and moss carpets, including their pale variants. This also update relevant block logic to recognize moss blocks as valid support.
This PR does not implement Azalea and Flowering Azalea
1.17.0 - Caves and Cliffs, 1.21.50 - The Garden Awakens
Related issues & PRs
#6116
Changes
API changes
MossBlock,MossCarpet,PaleMossBlock,PaleMossCarpet, andPaleMossCarpetVineMOSS_BLOCK,MOSS_CARPET,PALE_MOSS_BLOCK,PALE_MOSS_CARPET, andPALE_MOSS_CARPET_VINEinVanillaBlocksBlockTypeIdsMOSS_REPLACEABLEtag inBlockTypeTagsand applied it to relevant existing blocks to allow moss spreading and placementBehavioural changes
Follow-up
Implement Azalea and Flowering Azalea
Tests
https://youtu.be/mBI6AJ52Lx8