Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Add clear boolean to Block#setType

Open Machine-Maker opened this issue 4 years ago • 7 comments

So I tested this and didnt run into any issues, but since it's dealing with part of the code base I'm not entirely comfortable with yet, the whole changing block state part, I probably put the clear in the wrong place in CraftBlock#setTypeAndData.

Also, if it is a bug that the existing setType doesn't clear inventories, this can easily be refactored to just fix that instead of adding a new parameter to clear tile entities.

Fixes SPIGOT-3725

Machine-Maker avatar May 22 '21 04:05 Machine-Maker

this is how setType has always worked, why is it considered a bug

Spottedleaf avatar May 22 '21 11:05 Spottedleaf

bug = "undocumented behaviour I didn't realise", Not really a bug as bukkit does not say that it won't run block removal logic, i guess it's something that you can be unaware of, this somewhat seems like the fact that removal logic is ran maaaybe should be documented?

electronicboy avatar May 22 '21 11:05 electronicboy

this is how setType has always worked, why is it considered a bug

yeah, I didn’t think it was, but since there is a spigot bug report for it, and I was unsure if it has always done this or not, I just wanted to check.

Machine-Maker avatar May 22 '21 14:05 Machine-Maker

this has definitely been the behavior forever. here's old WE code: https://github.com/EngineHub/WorldEdit/blob/3.0/src/com/sk89q/worldedit/EditSession.java#L160-L161

wizjany avatar May 22 '21 15:05 wizjany

Ok great, then adding a new method is the way to go. The old methods already default to false for that Boolean argument, so should be all good. Just concerned with the location of the actually clearing.

Machine-Maker avatar May 22 '21 16:05 Machine-Maker

So... you know how it's always been this way? Well spigot just changed the behavior to wipe the tile entity when using Block#seType. Unsure if this is even needed then anymore. Unless the old behavior should be kept.

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/8d244b0b7e35596b160452c1aa7ec4fc21de4d50

Machine-Maker avatar Jul 22 '21 01:07 Machine-Maker

So now that this has been the behavior for a while, should this be closed? Doesn't seem like there is much input for this behavior to be kept.

Owen1212055 avatar Oct 22 '22 20:10 Owen1212055