Moving Elevators

Moving Elevators

8M Downloads

[Bug] Elevators do not preserve the correct camo state when mods are added/removed.

ellellie opened this issue ยท 0 comments

commented

Version Info

  • Minecraft, 1.21.6
  • Moving Elevators, 1.4.11

Are you using OptiFine?: No

Description of the Bug
Elevator camoState does not preserve the correct BlockState on updates to mods or game versions.

This appears to be a holdover from the 1.12 version of the mod at

compound.setInteger("camoState", Block.getStateId(this.camoState));

For modern versions, it is worth changing this to:

    @Override
    protected void writeData(ValueOutput output){
        if(this.camoState.getBlock() != Blocks.AIR)
            output.store("camoState", BlockState.CODEC, this.camoState);
    }

    @Override
    protected void readData(ValueInput input){
        this.camoState = input.read("camoState", BlockState.CODEC).orElse(Blocks.AIR.defaultBlockState());
    }

The BlockState codec is also available on other versions.

Steps to Reproduce

  • Install two mods with blocks.
  • Set two elevator blocks with camo states to blocks from either mod.
  • Remove one of the mods.

Screenshots

Image