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

Bad counting of different blocks #110

Open
organizatsiya opened this issue Nov 7, 2020 · 6 comments
Open

Bad counting of different blocks #110

organizatsiya opened this issue Nov 7, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@organizatsiya
Copy link
Contributor

organizatsiya commented Nov 7, 2020

Description
Hello,
The system for calculating limits is flawed for blocks that grow from several blocks.
For example, if you put a cactus, +1 is added to the limit but when it grows by 1 block and you break it, -1 is added to the limit which makes 0 while there is still a block of cactus.
On the other hand, if you break the block of sand under the cactus, it drops and yet the limit is still +1.
Same for sugar cane and bamboo

For campfires, if you put a campfire, the limit adds +1, if you turn it off and then relight it, the limit adds +1 while it's the same campfire, hence a limit result of +2 for a single campfire.

@BONNe
Copy link
Member

BONNe commented Nov 7, 2020

I am not saying that it should not be fixed, but I am just curious...
why do you limit bamboo, cactus, and campfires?

I think flowers had the same issue, but not sure if it is fixed.

@organizatsiya
Copy link
Contributor Author

I limit cactus and sugar cane so as not to have gigantic farms on the server because I want to be able to provide sand at a reduced price to promote concrete constructions

@tastybento tastybento added the bug Something isn't working label Nov 7, 2020
@tastybento
Copy link
Member

Unfortunately, this is extremely hard to track because events are not fired for these kinds of breakages because the player is not involved with it. Actually it may be impossible to track this. That is why there is a recount command for the player to run. If they think the limits are wrong.

@organizatsiya
Copy link
Contributor Author

organizatsiya commented Nov 27, 2020

And why not just check that when you place or break one of these blocks there is a block of sand or dirt underneath?
if it's true, +1 or -1, if it's false, do nothing

Edit: coarse dirt, mycelium, podzol, farmland, dirt, grass, red sand, sand

@tastybento
Copy link
Member

It's not that - say that the plant is on a block and something breaks that block, then the whole plant is destroyed. In that case, there is no Bukkit event that is fired. The underlying block can be broken in many ways that are not related to players. So, the addon assume the plant is still there. That's the problem. It will over-count, so that's why the player can ask for a recount if they disagree.

@BONNe
Copy link
Member

BONNe commented Feb 16, 2021

Tasty, that is not entirely correct.

Bukkit will call the event: BlockPhysicsEvent.
It is not called, only if a block is voided or replaced with a physic update suppression. But in these situations. the plant will still float.

It is never recommended to use this event due to the fact, that it is called 7 times per single block.
So any check done with this event should be very, very fast. Otherwise, it will impact the server very hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants