Sponge: TileEntity not in world after changing block

Created on 2 Jun 2019  路  2Comments  路  Source: SpongePowered/Sponge

I am currently running

  • SpongeForge version: 1.12.2-2825-7.1.6-RC3745 (technically SpongePowered/SpongeCommon@81e0fb2c31cda3799fe6b44ffb866de2c4f7f641 in a dev environment).
  • Java version: Oracle JDK 1.8.0_201
  • Operating System: Windows 10

I'm reporting this under SC rather than SF as most of the relevant logic (MixinWorldServer, etc...) appears in SC. Sorry if this is incorrect!

Mods

Neither are technically needed to reproduce, but provide a useful visual indicator of the problem.

Plugins

All test plugins present in a SpongeForge development environment

Issue Description

I originally reported this as MinecraftPortCentral/GriefPrevention#896, but have been able to isolate this to just Sponge.

When a plugin subscribes to ChangeBlockEvent (and so ShouldFire.CHANGE_BLOCK_EVENT is true), tile entities are present within the world after changing the block state (while they would be if CHANGE_BLOCK_EVENT was false).

As a result, blocks which perform logic within neighbour updates do not see a tile at the changed position, and so may end up in an incorrect state.

Reproduction steps

  • Add an event listener to ChangeBlockEvent, or some subclass.
  • Start the server, and place down a server.
  • Add a breakpoint at the bottom of BlockFurnace.setState, and configure it to log world.getTileEntity(blockPos).
  • Add some fuel and ore to the furnace to make it start smelting.
  • Observe the tile is null.
  • Remove the event listener and repeat - observe the tile is not null.

This can be seen more visually by placing a wired modem next to a furnace. Any time the furnace starts or stops smelting, the wired modems would deactivate as the tile is not present when receiving neighbour updates, and so no peripheral is present.

1.12

Most helpful comment

Can confirm this fixes the problem, thank you!

All 2 comments

Can confirm this fixes the problem, thank you!

Can confirm this fixes the problem, thank you!

Thank you for the detailed report! It really did make finding the bug all that much easier, knowing where to look pretty much exactly!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

XakepSDK picture XakepSDK  路  5Comments

nikosgram picture nikosgram  路  3Comments

ImMorpheus picture ImMorpheus  路  4Comments

XakepSDK picture XakepSDK  路  4Comments

randombyte-developer picture randombyte-developer  路  5Comments