SpongePowered / Sponge

The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms.
MIT License
390 stars 211 forks source link

SetBlock to AIR dont set, but to other types ok #1700

Open FabioZumbi12 opened 6 years ago

FabioZumbi12 commented 6 years ago

I am currently running

Issue Description I am plugin dev of redprotect plugin and i having a issue on try to set the type of some blocks(tested with glowstone) to AIR. On my tests, when i try to set other types of blocks it works normally, only to AIR dont work.

loc.setBlock(BlockTypes.AIR.getDefaultState()); -> dont work
loc.setBlock(BlockTypes.STONE.getDefaultState()); -> works
gabizou commented 6 years ago

Is the boolean value returned true?

FabioZumbi12 commented 6 years ago

Yes, returned true. For stone too.

ryantheleach commented 6 years ago
ryantheleach - Today at 12:44 PM
What context are you calling it from?
FabioZumbi12 - Today at 12:45 PM
from... InteractBlockEvent.Secondary event
and from primary too
using with that scheduler, AIR and STONE works
out of scheduler, only STONE works(edited)
FabioZumbi12 commented 6 years ago

To let us to know whats wrong, here is how i using on my resource:

This is called from here: https://github.com/FabioZumbi12/RedProtect/blob/master/RedProtect-Sponge-56/src/main/java/br/net/fabiozumbi12/RedProtect/Sponge/listeners/RPPlayerListener.java#L147

In this call only stone works: https://github.com/FabioZumbi12/RedProtect/blob/master/RedProtect-Sponge-56/src/main/java/br/net/fabiozumbi12/RedProtect/Sponge/RPUtil.java#L1008

But in this (inside Scheduler) works for both Stone and Air: https://github.com/FabioZumbi12/RedProtect/blob/master/RedProtect-Sponge-56/src/main/java/br/net/fabiozumbi12/RedProtect/Sponge/RPUtil.java#L1039

That loop have a max of 4 blocks in diferent positions.

Edit: And the setBlock method: https://github.com/FabioZumbi12/RedProtect/blob/master/RedProtect-Sponge-7/src/main/java/br/net/fabiozumbi12/RedProtect/Sponge/RPVHelper7.java#L53

ryantheleach commented 6 years ago

TestPlugin.zip Untested, created during lunch break: https://gist.github.com/ryantheleach/411b98e386bc4932bab7901538aad037 Usage: /bug <blockTristate> <itemTristate> <cancel>

Then right click on a block.