package ru.bclib.api.datafixer; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import org.jetbrains.annotations.NotNull; import ru.bclib.interfaces.PatchBiFunction; import ru.bclib.interfaces.PatchFunction; import java.util.HashMap; import java.util.List; import java.util.Map; /** * A Patch for level.dat that is always executed no matter what Patchlevel is set in a world. */ public abstract class ForcedLevelPatch extends Patch { protected ForcedLevelPatch(@NotNull String modID, String version) { super(modID, version, true); } @Override public final Map getIDReplacements() { return new HashMap(); } @Override public final PatchFunction getWorldDataPatcher() { return null; } @Override public final PatchBiFunction getBlockStatePatcher() { return null; } @Override public final List getWorldDataIDPaths() { return null; } @Override public PatchFunction getLevelDatPatcher() { return this::runLevelDatPatch; } /** * Called with the contents of level.dat in {@code root} * @param root The contents of level.dat * @param profile The active migration profile * @return true, if the run did change the contents of root */ abstract protected Boolean runLevelDatPatch(CompoundTag root, MigrationProfile profile); }