Skip to content

Commit

Permalink
Fix brewing leveler stacking and region saving error
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Jan 11, 2024
1 parent 98a5393 commit 55ddb33
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Region relating classes.
* Region related classes.
*/
package dev.aurelium.auraskills.api.region;
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ private BrewingStandData getBrewingStandData(ItemStack ingredient, ItemStack[] b
if (!beforeItem.equals(afterItem)) {
BrewingSlot slot = standData.getSlot(i);
slot.setBrewed(true);
slot.addIngredient(ingredient); // Track the ingredient used to brew
if (slot.getIngredients().size() < 5) { // Max 5 ingredients stacked to prevent auto brewing
slot.addIngredient(ingredient); // Track the ingredient used to brew
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ private void saveChunk(CompoundTag compound, ChunkData chunkData) {
chunk = new CompoundTag();
compound.put(chunkName, chunk);
}
ListTag<CompoundTag> placedBlocks = chunk.getListTag("placed_blocks").asCompoundTagList();
ListTag<?> listTag = chunk.getListTag("placed_blocks");
ListTag<CompoundTag> placedBlocks;
if (listTag != null) {
placedBlocks = listTag.asCompoundTagList();
} else {
// Create and add placed_blocks ListTag if not exists
placedBlocks = new ListTag<>(CompoundTag.class);
chunk.put("placed_blocks", placedBlocks);
}
placedBlocks.clear(); // Clears list of block positions to account for removed positions
// Adds all positions to nbt compound list
for (BlockPosition block : chunkData.getPlacedBlocks().keySet()) {
Expand Down

0 comments on commit 55ddb33

Please sign in to comment.