Skip to content

Commit

Permalink
refactor: Some small 1.20.6 changes for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed May 21, 2024
1 parent d0c54d2 commit 4987f41
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public NonNullList<ItemStack> getItems() {
return items;
}

public void deserialize(HolderLookup.Provider provider, CompoundTag tag) {
items = ImplementedContainer.deserializeInventory(provider, tag, items.size());
public void deserialize(CompoundTag tag, HolderLookup.Provider provider) {
items = ImplementedContainer.deserializeInventory(tag, items.size(), provider);
}

public CompoundTag serialize(HolderLookup.Provider provider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ default boolean stillValid(Player player) {
return true;
}

static NonNullList<ItemStack> deserializeInventory(HolderLookup.Provider provider, CompoundTag tag, int minimumSize) {
static NonNullList<ItemStack> deserializeInventory(CompoundTag tag, int minimumSize, HolderLookup.Provider provider) {
int size = Math.max(minimumSize, tag.contains("Size", Tag.TAG_INT) ? tag.getInt("Size") : minimumSize);
NonNullList<ItemStack> items = NonNullList.withSize(size, ItemStack.EMPTY);
ListTag itemTags = tag.getList("Items", Tag.TAG_COMPOUND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

public interface BalmMenuProvider<TPayload> extends MenuProvider {
TPayload getScreenOpeningData(ServerPlayer player);
StreamCodec<FriendlyByteBuf, TPayload> getCodec();
StreamCodec<FriendlyByteBuf, TPayload> getScreenStreamCodec();
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void openGui(Player player, MenuProvider menuProvider) {
}

private <T> void openGui(ServerPlayer player, BalmMenuProvider<T> menuProvider) {
player.openMenu(menuProvider, buf -> menuProvider.getCodec().encode(buf, menuProvider.getScreenOpeningData(player)));
player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode(buf, menuProvider.getScreenOpeningData(player)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void openGui(Player player, MenuProvider menuProvider) {
}

private <T> void openGui(ServerPlayer player, BalmMenuProvider<T> menuProvider) {
player.openMenu(menuProvider, buf -> menuProvider.getCodec().encode(buf, menuProvider.getScreenOpeningData(player)));
player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode(buf, menuProvider.getScreenOpeningData(player)));
}

@Override
Expand Down

0 comments on commit 4987f41

Please sign in to comment.