Luke100000 / ImmersivePaintings

Minecraft mod. Use your own paintings! Drag and drop! In Multiplayer!
GNU General Public License v3.0
11 stars 16 forks source link

[1.18.2] Breaking paintings/graffiti that are placed on the bottom-sides of thick ceilings often results in no item. #39

Closed endarz closed 1 year ago

endarz commented 1 year ago

Describe the bug In the 1.18.2 version of the mod, painting and graffiti items that are dropped when breaking a painting or graffiti entity on the bottom-side of a block whose top face is covered by another block will bug out and often not spawn or reach the ground.

A better way of explaining this bug verbally is with two houses: the first with a two block tall ceiling, and the second with a one block tall ceiling. With the two block tall ceiling example, a painting/graffiti that is broken will attempt to drop its item above its parent block on its top face. Because all of the space above is filled with blocks, however, the item glitches out and often disappears.

In the one block tall ceiling example, a painting/graffiti that is broken is dropped on the house's second floor on the top face of its parent block, and the item can be retrieved successfully.

To Reproduce

  1. Build a 3x3 ceiling that is two blocks tall/thick.
  2. Place a painting on the center block.
  3. Do one of the following:
    • Choose an existing painting in the world.
    • Create a painting from a URL or file path.
  4. Break it. Observe that the item does not drop or, in very rare occasions, the item is flung into the vicinity far from its origin.

Expected behavior Either a painting or a graffiti item is dropped after the painting is hit.

Additional context This bug was encountered in a modpack that I created myself, so a modlist can be provided if this problem cannot be replicated.

A good workaround for this, though, is the classic painting trick where one can place a painting on the side of a sign. Just break the block where the desired parent block is and place a sign there. Then, one can place the painting on the underside of the sign and have the painting be flush with the ceiling. Breaking the painting then spawns it in the gap between the sign and adjacent blocks. Very easy workaround for now.

endarz commented 1 year ago

In further testing, I found that paintings/graffiti placed topside on blocks work as intended. That was an error due to my assumptions. I edited the issue above in support of the finding.

I also found the root of the issue, I believe; the broken painting or graffiti item is dropped above the block it is placed on, meaning the item will simply bug out and disappear if placed on very thick ceilings. I will edit the Steps to Reproduce accordingly.

endarz commented 1 year ago

I have no experience with writing code for mods, but I know Java very well. I may take a look at the code later and take a stab at fixing this issue.