Merge remote-tracking branch 'origin/main' into 1.18
This commit is contained in:
commit
aa4acfe3d7
|
|
@ -34,18 +34,25 @@ public class ClientBookRegistryMixin {
|
||||||
for(Book book : BookRegistry.INSTANCE.books.values()) {
|
for(Book book : BookRegistry.INSTANCE.books.values()) {
|
||||||
try {
|
try {
|
||||||
BookContents contents = (BookContents)contentsField.get(book);
|
BookContents contents = (BookContents)contentsField.get(book);
|
||||||
|
if(contents == null || contents.entries == null)
|
||||||
|
continue;
|
||||||
for(BookEntry entry : contents.entries.values()) {
|
for(BookEntry entry : contents.entries.values()) {
|
||||||
for (BookPage page : entry.getPages()) {
|
for(BookPage page : entry.getPages()) {
|
||||||
if (page instanceof PageTemplate) {
|
if(page instanceof PageTemplate) {
|
||||||
List<TemplateComponent> components;
|
List<TemplateComponent> components;
|
||||||
|
|
||||||
BookTemplate template = (BookTemplate) templateField.get(page);
|
BookTemplate template = (BookTemplate) templateField.get(page);
|
||||||
|
if(template == null)
|
||||||
|
continue;
|
||||||
components = (List<TemplateComponent>) componentsField.get(template);
|
components = (List<TemplateComponent>) componentsField.get(template);
|
||||||
|
if(components == null)
|
||||||
|
continue;
|
||||||
for (TemplateComponent component : components) {
|
for (TemplateComponent component : components) {
|
||||||
if (component instanceof ComponentItemStack) {
|
if (component instanceof ComponentItemStack) {
|
||||||
ItemStack[] items = (ItemStack[]) itemsField.get(component);
|
ItemStack[] items = (ItemStack[]) itemsField.get(component);
|
||||||
for(int i = 0; i < items.length; i++) {
|
if(items == null)
|
||||||
if(items[i] != null && items[i].getItem() == Items.AIR) {
|
continue;
|
||||||
|
for (int i = 0; i < items.length; i++) {
|
||||||
|
if (items[i] != null && items[i].getItem() == Items.AIR) {
|
||||||
items[i] = ItemStack.EMPTY;
|
items[i] = ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -54,8 +61,7 @@ public class ClientBookRegistryMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(ReflectiveOperationException e) {
|
} catch(ReflectiveOperationException ignored) {
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ModernFix.LOGGER.info("Cleared {} unneeded book NBT tags", numItemsCleared);
|
ModernFix.LOGGER.info("Cleared {} unneeded book NBT tags", numItemsCleared);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user