PotatoPresident/worldborderfixer

1.20.2 compatibility?

Closed this issue · 0 comments

The pre-release of version 1.20.2 has been released, can you make compatibility with this version? I am currently working on the latest snapshots 1.20.2 and there are obvious changes in the PersistentStateManager. Namely, the getOrCreate() method has changed:

public <T extends PersistentState> T getOrCreate(PersistentState.Type<T> type, String id) {
    T persistentState = this.get(type, id);
    if (persistentState != null) {
        return persistentState;
    }
    PersistentState persistentState2 = (PersistentState)type.constructor().get();
    this.set(id, persistentState2);
    return (T)persistentState2;
}

I accordingly added the TYPE field to the WorldState class, but the multiborders do not work:

public static final PersistentState.Type<WorldBorderState> TYPE = new PersistentState.Type<>(
            WorldBorderState::new, WorldBorderState::fromNbt, DataFixTypes.LEVEL);

In mixin:

WorldBorderState worldBorderState = world.getPersistentStateManager().getOrCreate(WorldBorderState.TYPE, "worldBorder");