Create

Create

86M Downloads

NBT Data Loosed on Contraption Disassembly

Allmoz opened this issue ยท 1 comments

commented

Describe the Bug

when a contraption is disassembled, create first destroy the block at a location and then it sets the blocks into the world in 2 steps. first it create the block as default, then it fills the nbt data. When one of the 2 first steps fails the functions continues and the nbt data is lost.

the function in question is addBlocksToWorld:

https://github.com/Creators-of-Create/Create/blob/mc1.18/dev/src/main/java/com/simibubi/create/content/contraptions/Contraption.java#L1095C52-L1095C52

For example when there is a bedrock block removal is denied and the new block is dropped as it was to be placed in the world in by the first step. this means for example that items in chest or liquids in tanks gets lost.

Later in the chain of the modding community it also extend to claim and permissions mods (for example OPAC) that also could deny part of the steps.

** edited to add bedrock block issue, and better reflect the bug

Reproduction Steps

  1. assembly a minecart contraption on unclaimed chunks
  2. un assembly a minecart contraption in claimed chunks ( has to be different chunks and be in those states and protection has to be enabled)

Expected Result

ideally, for the contraption to not be able to be disassembled if any of its block is in a chunk that it cannot be replaced. rising an exception to the chat

the issue has been raised also to the opac mod developer:

thexaero/open-parties-and-claims#279 (comment)

:) best regards!

Screenshots and Videos

No response

Crash Report or Log

No response

Operating System

Windows 11

Mod Version

0.5.1d

Minecraft Version

1.18.2

Forge Version

40.2.9

Other Mods

OPAC

Additional Context

No response

commented

Well, as OPAC developer pointed out, same issue happens also when there is a bedrock block in the way, so is more like a bug. (so i edited the title and the the description)

i was checking the forge documentation:

https://nekoyue.github.io/ForgeJavaDocs-NG/javadoc/1.18.2/net/minecraft/world/level/Level.html#destroyBlock(net.minecraft.core.BlockPos,boolean,net.minecraft.world.entity.Entity,int)

The method destroyBlock of the class Level return a boolean that is not been taken into account in:

Maybe an option is to first for try to destroy all blocks, and if any of those destructions failed then deny the disassembly of the contraption. In the case of the minecart contraption, to avoid looping, maybe drop the contraption as an item.

It does make sense to destroy the level blocks even if the contraption fails to be placed the blocks even if the contraption, no need to revert that.