Skip to content

Rework loading API#4

Open
bluebear94 wants to merge 3 commits intomahjerion:mainfrom
bluebear94:mf/loading-api-rework
Open

Rework loading API#4
bluebear94 wants to merge 3 commits intomahjerion:mainfrom
bluebear94:mf/loading-api-rework

Conversation

@bluebear94
Copy link

This adds two methods to LoadSave to replace the old Load and loadOrBlank methods:

// Take `Class<OBJ>` for class instead of raw `Class`
// Remove unused `newobj` parameter

public static <OBJ> OBJ load(Class<OBJ> clazz, CompoundTag nbt, String loc);
// Take `Supplier<OBJ>` for `blank` to avoid creating a new object unless needed
public static <OBJ> OBJ loadOrBlank(Class<OBJ> clazz, CompoundTag nbt, String loc, Supplier<OBJ> blank);

Unlike in #3, the old methods are only deprecated to avoid causing immediate API breakage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant