From 8a383dc9d694dfe2f2eff6c9a4becbc021549c4c Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Tue, 17 Dec 2024 19:05:23 +0100 Subject: [PATCH] Unify on using LOG over LOGGER --- .../PatternAccessTermScreen.java | 4 ++-- .../java/appeng/client/guidebook/Guide.java | 14 +++++------ .../client/guidebook/GuideSourceWatcher.java | 24 +++++++++---------- .../guidebook/compiler/PageCompiler.java | 14 +++++------ .../compiler/tags/FloatingImageCompiler.java | 6 ++--- .../guidebook/indices/CategoryIndex.java | 6 ++--- .../client/guidebook/indices/ItemIndex.java | 10 ++++---- .../client/guidebook/indices/UniqueIndex.java | 4 ++-- .../guidebook/navigation/NavigationTree.java | 8 +++---- .../guidebook/render/GuidePageTexture.java | 6 ++--- .../client/guidebook/scene/SodiumCompat.java | 6 ++--- src/main/java/appeng/core/AppEngClient.java | 8 +++---- .../appeng/core/worlddata/AESavedData.java | 7 +++--- .../datagen/providers/WorldGenProvider.java | 4 ++-- .../patternprovider/PatternProviderLogic.java | 10 ++++---- .../igtooltip/BaseClassRegistrationImpl.java | 6 ++--- .../modules/igtooltip/TooltipProviders.java | 10 ++++---- .../java/appeng/items/tools/GuideItem.java | 5 ---- src/main/java/appeng/me/GridNode.java | 6 ++--- .../automation/StorageExportStrategy.java | 4 ++-- .../java/appeng/siteexport/SiteExporter.java | 20 ++++++++-------- 21 files changed, 88 insertions(+), 94 deletions(-) diff --git a/src/main/java/appeng/client/gui/me/patternaccess/PatternAccessTermScreen.java b/src/main/java/appeng/client/gui/me/patternaccess/PatternAccessTermScreen.java index 549d50bd362..e869276062c 100644 --- a/src/main/java/appeng/client/gui/me/patternaccess/PatternAccessTermScreen.java +++ b/src/main/java/appeng/client/gui/me/patternaccess/PatternAccessTermScreen.java @@ -73,7 +73,7 @@ import appeng.menu.implementations.PatternAccessTermMenu; public class PatternAccessTermScreen extends AEBaseScreen { - private static final Logger LOGGER = LoggerFactory.getLogger(PatternAccessTermScreen.class); + private static final Logger LOG = LoggerFactory.getLogger(PatternAccessTermScreen.class); private static final int GUI_WIDTH = 195; private static final int GUI_TOP_AND_BOTTOM_PADDING = 54; @@ -443,7 +443,7 @@ public void postIncrementalUpdate(long inventoryId, Int2ObjectMap slots) { var record = byId.get(inventoryId); if (record == null) { - LOGGER.warn("Ignoring incremental update for unknown inventory id {}", inventoryId); + LOG.warn("Ignoring incremental update for unknown inventory id {}", inventoryId); return; } diff --git a/src/main/java/appeng/client/guidebook/Guide.java b/src/main/java/appeng/client/guidebook/Guide.java index 16cb799c435..a880af9aa7b 100644 --- a/src/main/java/appeng/client/guidebook/Guide.java +++ b/src/main/java/appeng/client/guidebook/Guide.java @@ -67,7 +67,7 @@ * guide-specific subdirectory of resource packs. */ public final class Guide implements PageCollection { - private static final Logger LOGGER = LoggerFactory.getLogger(Guide.class); + private static final Logger LOG = LoggerFactory.getLogger(Guide.class); private final String defaultNamespace; private final String folder; @@ -199,7 +199,7 @@ public static void runDatapackReload() { @Nullable public ParsedGuidePage getParsedPage(ResourceLocation id) { if (pages == null) { - LOGGER.warn("Can't get page {}. Pages not loaded yet.", id); + LOG.warn("Can't get page {}. Pages not loaded yet.", id); return null; } @@ -233,7 +233,7 @@ public byte[] loadAsset(ResourceLocation id) { return in.readAllBytes(); } catch (FileNotFoundException ignored) { } catch (IOException e) { - LOGGER.error("Failed to open guidebook asset {}", path); + LOG.error("Failed to open guidebook asset {}", path); return null; } } @@ -248,7 +248,7 @@ public byte[] loadAsset(ResourceLocation id) { try (var input = resource.open()) { return input.readAllBytes(); } catch (IOException e) { - LOGGER.error("Failed to open guidebook asset {}", id); + LOG.error("Failed to open guidebook asset {}", id); return null; } } @@ -314,7 +314,7 @@ protected Map prepare(ResourceManager resourc try (var in = entry.getValue().open()) { pages.put(pageId, PageCompiler.parse(sourcePackId, pageId, in)); } catch (IOException e) { - LOGGER.error("Failed to load guidebook page {} from pack {}", pageId, sourcePackId, e); + LOG.error("Failed to load guidebook page {} from pack {}", pageId, sourcePackId, e); } } @@ -445,7 +445,7 @@ private Builder(@Nullable IEventBus modEventBus, String defaultNamespace, String this.startupPage = ResourceLocation.parse(startupPageIdText); } } catch (Exception e) { - LOGGER.error("Specified invalid page id in system property {}", startupPageProperty); + LOG.error("Specified invalid page id in system property {}", startupPageProperty); } // Development sources folder @@ -640,7 +640,7 @@ private ExtensionCollection buildExtensions() { private void validateAll() { // Iterate and compile all pages to warn about errors on startup for (var entry : developmentPages.entrySet()) { - LOGGER.info("Compiling {}", entry.getKey()); + LOG.info("Compiling {}", entry.getKey()); getPage(entry.getKey()); } } diff --git a/src/main/java/appeng/client/guidebook/GuideSourceWatcher.java b/src/main/java/appeng/client/guidebook/GuideSourceWatcher.java index a9ee18ca286..79ba0e9b64e 100644 --- a/src/main/java/appeng/client/guidebook/GuideSourceWatcher.java +++ b/src/main/java/appeng/client/guidebook/GuideSourceWatcher.java @@ -34,7 +34,7 @@ import appeng.client.guidebook.compiler.ParsedGuidePage; class GuideSourceWatcher { - private static final Logger LOGGER = LoggerFactory.getLogger(GuideSourceWatcher.class); + private static final Logger LOG = LoggerFactory.getLogger(GuideSourceWatcher.class); /** * The {@link ResourceLocation} namespace to use for files in the watched folder. @@ -68,7 +68,7 @@ public GuideSourceWatcher(String namespace, Path sourceFolder) { throw new RuntimeException("Cannot find the specified folder for the AE2 guidebook sources: " + sourceFolder); } - LOGGER.info("Watching guidebook sources in {}", sourceFolder); + LOG.info("Watching guidebook sources in {}", sourceFolder); watchExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setDaemon(true) @@ -85,7 +85,7 @@ public GuideSourceWatcher(String namespace, Path sourceFolder) { .listener(new Listener()) .build(); } catch (IOException e) { - LOGGER.error("Failed to watch for changes in the guidebook sources at {}", sourceFolder, e); + LOG.error("Failed to watch for changes in the guidebook sources at {}", sourceFolder, e); watcher = null; } sourceWatcher = watcher; @@ -119,23 +119,23 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { @Override public FileVisitResult visitFileFailed(Path file, IOException exc) { - LOGGER.error("Failed to list page {}", file, exc); + LOG.error("Failed to list page {}", file, exc); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) { if (exc != null) { - LOGGER.error("Failed to list all pages in {}", dir, exc); + LOG.error("Failed to list all pages in {}", dir, exc); } return FileVisitResult.CONTINUE; } }); } catch (IOException e) { - LOGGER.error("Failed to list all pages in {}", sourceFolder, e); + LOG.error("Failed to list all pages in {}", sourceFolder, e); } - LOGGER.info("Loading {} guidebook pages", pagesToLoad.size()); + LOG.info("Loading {} guidebook pages", pagesToLoad.size()); var loadedPages = pagesToLoad.entrySet() .stream() .map(entry -> { @@ -144,14 +144,14 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) { return PageCompiler.parse(sourcePackId, entry.getKey(), in); } catch (Exception e) { - LOGGER.error("Failed to reload guidebook page {}", path, e); + LOG.error("Failed to reload guidebook page {}", path, e); return null; } }) .filter(Objects::nonNull) .toList(); - LOGGER.info("Loaded {} pages from {} in {}", loadedPages.size(), sourceFolder, stopwatch); + LOG.info("Loaded {} pages from {} in {}", loadedPages.size(), sourceFolder, stopwatch); return loadedPages; } @@ -186,7 +186,7 @@ public synchronized void close() { try { sourceWatcher.close(); } catch (IOException e) { - LOGGER.error("Failed to close fileystem watcher for {}", sourceFolder); + LOG.error("Failed to close fileystem watcher for {}", sourceFolder); } } } @@ -210,7 +210,7 @@ public boolean isWatching() { @Override public void onException(Exception e) { - LOGGER.error("Failed watching for changes", e); + LOG.error("Failed watching for changes", e); } } @@ -228,7 +228,7 @@ private synchronized void pageChanged(Path path) { var page = PageCompiler.parse(sourcePackId, pageId, in); changedPages.put(pageId, page); } catch (Exception e) { - LOGGER.error("Failed to reload guidebook page {}", path, e); + LOG.error("Failed to reload guidebook page {}", path, e); } } diff --git a/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java b/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java index 210bc88b167..9731c787be5 100644 --- a/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java +++ b/src/main/java/appeng/client/guidebook/compiler/PageCompiler.java @@ -84,7 +84,7 @@ @ApiStatus.Internal public final class PageCompiler { - private static final Logger LOGGER = LoggerFactory.getLogger(PageCompiler.class); + private static final Logger LOG = LoggerFactory.getLogger(PageCompiler.class); /** * Default gap between block-level elements. Set as margin. @@ -174,13 +174,13 @@ private static Frontmatter parseFrontmatter(ResourceLocation pageId, MdAstRoot r for (var child : root.children()) { if (child instanceof MdAstYamlFrontmatter frontmatter) { if (result != null) { - LOGGER.error("Found more than one frontmatter!"); // TODO: proper debugging + LOG.error("Found more than one frontmatter!"); // TODO: proper debugging continue; } try { result = Frontmatter.parse(pageId, frontmatter.value); } catch (Exception e) { - LOGGER.error("Failed to parse frontmatter for page {}", pageId, e); + LOG.error("Failed to parse frontmatter for page {}", pageId, e); break; } } @@ -402,12 +402,12 @@ private LytImage compileImage(MdAstImage astImage) { var imageId = IdUtils.resolveLink(astImage.url, pageId); var imageContent = pages.loadAsset(imageId); if (imageContent == null) { - LOGGER.error("Couldn't find image {}", astImage.url); + LOG.error("Couldn't find image {}", astImage.url); image.setTitle("Missing image: " + astImage.url); } image.setImage(imageId, imageContent); } catch (ResourceLocationException e) { - LOGGER.error("Invalid image id: {}", astImage.url); + LOG.error("Invalid image id: {}", astImage.url); image.setTitle("Invalid image URL: " + astImage.url); } return image; @@ -447,9 +447,9 @@ public LytFlowContent createErrorFlowContent(String text, UnistNode child) { span.appendText("~".repeat(pos.column() - 1) + "^"); span.appendBreak(); - LOGGER.warn("{}\n{}\n{}\n", text, line, "~".repeat(pos.column() - 1) + "^"); + LOG.warn("{}\n{}\n{}\n", text, line, "~".repeat(pos.column() - 1) + "^"); } else { - LOGGER.warn("{}\n", text); + LOG.warn("{}\n", text); } return span; diff --git a/src/main/java/appeng/client/guidebook/compiler/tags/FloatingImageCompiler.java b/src/main/java/appeng/client/guidebook/compiler/tags/FloatingImageCompiler.java index 1a4cc11b513..6523f12e6e8 100644 --- a/src/main/java/appeng/client/guidebook/compiler/tags/FloatingImageCompiler.java +++ b/src/main/java/appeng/client/guidebook/compiler/tags/FloatingImageCompiler.java @@ -18,7 +18,7 @@ public class FloatingImageCompiler extends FlowTagCompiler { public static final String TAG_NAME = "FloatingImage"; - private static final Logger LOGGER = LoggerFactory.getLogger(FloatingImageCompiler.class); + private static final Logger LOG = LoggerFactory.getLogger(FloatingImageCompiler.class); @Override public Set getTagNames() { @@ -39,12 +39,12 @@ protected void compile(PageCompiler compiler, LytFlowParent parent, MdxJsxElemen var imageId = IdUtils.resolveLink(src, compiler.getPageId()); var imageContent = compiler.loadAsset(imageId); if (imageContent == null) { - LOGGER.error("Couldn't find image {}", src); + LOG.error("Couldn't find image {}", src); image.setTitle("Missing image: " + src); } image.setImage(imageId, imageContent); } catch (ResourceLocationException e) { - LOGGER.error("Invalid image id: {}", src); + LOG.error("Invalid image id: {}", src); image.setTitle("Invalid image URL: " + src); } diff --git a/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java b/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java index f4c581c3d7d..988c3b5eb21 100644 --- a/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java +++ b/src/main/java/appeng/client/guidebook/indices/CategoryIndex.java @@ -18,7 +18,7 @@ * This index is installed by default on all {@linkplain appeng.client.guidebook.Guide guides}. */ public class CategoryIndex extends MultiValuedIndex { - private static final Logger LOGGER = LoggerFactory.getLogger(CategoryIndex.class); + private static final Logger LOG = LoggerFactory.getLogger(CategoryIndex.class); public CategoryIndex() { super( @@ -35,7 +35,7 @@ private static List> getCategories(ParsedGuidePage page } if (!(categoriesNode instanceof List categoryList)) { - LOGGER.warn("Page {} contains malformed categories frontmatter", page.getId()); + LOG.warn("Page {} contains malformed categories frontmatter", page.getId()); return List.of(); } @@ -48,7 +48,7 @@ private static List> getCategories(ParsedGuidePage page if (listEntry instanceof String categoryString) { categories.add(Pair.of(categoryString, anchor)); } else { - LOGGER.warn("Page {} contains a malformed categories frontmatter entry: {}", page.getId(), listEntry); + LOG.warn("Page {} contains a malformed categories frontmatter entry: {}", page.getId(), listEntry); } } diff --git a/src/main/java/appeng/client/guidebook/indices/ItemIndex.java b/src/main/java/appeng/client/guidebook/indices/ItemIndex.java index 8e0efcb7cc8..fe865a4b868 100644 --- a/src/main/java/appeng/client/guidebook/indices/ItemIndex.java +++ b/src/main/java/appeng/client/guidebook/indices/ItemIndex.java @@ -21,7 +21,7 @@ * This index is installed by default on all {@linkplain appeng.client.guidebook.Guide guides}. */ public class ItemIndex extends UniqueIndex { - private static final Logger LOGGER = LoggerFactory.getLogger(ItemIndex.class); + private static final Logger LOG = LoggerFactory.getLogger(ItemIndex.class); public ItemIndex() { super( @@ -38,7 +38,7 @@ private static List> getItemAnchors(ParsedGui } if (!(itemIdsNode instanceof List itemIdList)) { - LOGGER.warn("Page {} contains malformed item_ids frontmatter", page.getId()); + LOG.warn("Page {} contains malformed item_ids frontmatter", page.getId()); return List.of(); } @@ -50,7 +50,7 @@ private static List> getItemAnchors(ParsedGui try { itemId = IdUtils.resolveId(itemIdStr, page.getId().getNamespace()); } catch (ResourceLocationException e) { - LOGGER.warn("Page {} contains a malformed item_ids frontmatter entry: {}", page.getId(), + LOG.warn("Page {} contains a malformed item_ids frontmatter entry: {}", page.getId(), listEntry); continue; } @@ -60,11 +60,11 @@ private static List> getItemAnchors(ParsedGui itemAnchors.add(Pair.of( itemId, new PageAnchor(page.getId(), null))); } else { - LOGGER.warn("Page {} references an unknown item {} in its item_ids frontmatter", + LOG.warn("Page {} references an unknown item {} in its item_ids frontmatter", page.getId(), itemId); } } else { - LOGGER.warn("Page {} contains a malformed item_ids frontmatter entry: {}", page.getId(), listEntry); + LOG.warn("Page {} contains a malformed item_ids frontmatter entry: {}", page.getId(), listEntry); } } diff --git a/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java b/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java index fdbd3393c93..6d542e94f65 100644 --- a/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java +++ b/src/main/java/appeng/client/guidebook/indices/UniqueIndex.java @@ -22,7 +22,7 @@ * Maintains an index for any given page using a mapping function for keys and values of the index. */ public class UniqueIndex implements PageIndex { - private static final Logger LOGGER = LoggerFactory.getLogger(UniqueIndex.class); + private static final Logger LOG = LoggerFactory.getLogger(UniqueIndex.class); private final Map> index = new HashMap<>(); @@ -99,7 +99,7 @@ private void addToIndex(ParsedGuidePage page) { var value = entry.getValue(); var previousPage = index.put(key, new Record<>(page.getId(), value)); if (previousPage != null) { - LOGGER.warn("Key conflict in index {}: {} is used by pages {} and {}", + LOG.warn("Key conflict in index {}: {} is used by pages {} and {}", name, key, page, previousPage); hadDuplicates = true; } diff --git a/src/main/java/appeng/client/guidebook/navigation/NavigationTree.java b/src/main/java/appeng/client/guidebook/navigation/NavigationTree.java index b90cd760102..8d3f82f66da 100644 --- a/src/main/java/appeng/client/guidebook/navigation/NavigationTree.java +++ b/src/main/java/appeng/client/guidebook/navigation/NavigationTree.java @@ -24,7 +24,7 @@ public class NavigationTree { - private static final Logger LOGGER = LoggerFactory.getLogger(NavigationTree.class); + private static final Logger LOG = LoggerFactory.getLogger(NavigationTree.class); private final Map nodeIndex; @@ -107,7 +107,7 @@ private static NavigationNode createNode(HashMap LOGGER.error("Failed to deserialize component patch {} for icon {}: {}", + .resultOrPartial(err -> LOG.error("Failed to deserialize component patch {} for icon {}: {}", navigationEntry.iconComponents(), navigationEntry.iconItemId(), err)); icon = new ItemStack(iconItem, 1, patch.orElse(DataComponentPatch.EMPTY)); } else { @@ -128,7 +128,7 @@ private static NavigationNode createNode(HashMap usedTextures = new IdentityHashMap<>(); @@ -76,7 +76,7 @@ public static GuidePageTexture load(ResourceLocation id, byte[] imageContent) { try { return new GuidePageTexture(id, imageContent); } catch (Exception e) { - LOGGER.error("Failed to get image {}: {}", id, e.toString()); + LOG.error("Failed to get image {}: {}", id, e.toString()); return missing(); } } @@ -91,7 +91,7 @@ public AbstractTexture use() { var nativeImage = NativeImage.read(guidePageTexture.imageContent); return new DynamicTexture(nativeImage); } catch (IOException e) { - LOGGER.error("Failed to read image {}: {}", guidePageTexture.id, e.toString()); + LOG.error("Failed to read image {}: {}", guidePageTexture.id, e.toString()); return MissingTextureAtlasSprite.getTexture(); } }); diff --git a/src/main/java/appeng/client/guidebook/scene/SodiumCompat.java b/src/main/java/appeng/client/guidebook/scene/SodiumCompat.java index 5cba7cbf056..1d9b803aa18 100644 --- a/src/main/java/appeng/client/guidebook/scene/SodiumCompat.java +++ b/src/main/java/appeng/client/guidebook/scene/SodiumCompat.java @@ -12,7 +12,7 @@ import net.neoforged.fml.ModList; public class SodiumCompat { - private static final Logger LOGGER = LoggerFactory.getLogger(SodiumCompat.class); + private static final Logger LOG = LoggerFactory.getLogger(SodiumCompat.class); @Nullable private static final MethodHandle METHOD_HANDLE; @@ -24,10 +24,10 @@ public class SodiumCompat { Class.forName("me.jellysquid.mods.sodium.client.render.texture.SpriteUtil"), "markSpriteActive", MethodType.methodType(void.class, TextureAtlasSprite.class)); - LOGGER.info("Loaded Sodium active sprite compat."); + LOG.info("Loaded Sodium active sprite compat."); } catch (NoSuchMethodException | IllegalAccessException | ClassNotFoundException e) { if (ModList.get().getModContainerById("sodium").isPresent()) { - LOGGER.error("Failed to load Sodium active sprite compat.", e); + LOG.error("Failed to load Sodium active sprite compat.", e); } } diff --git a/src/main/java/appeng/core/AppEngClient.java b/src/main/java/appeng/core/AppEngClient.java index ee7370f9e9d..9c44fdff703 100644 --- a/src/main/java/appeng/core/AppEngClient.java +++ b/src/main/java/appeng/core/AppEngClient.java @@ -132,7 +132,7 @@ */ @Mod(value = AppEng.MOD_ID, dist = Dist.CLIENT) public class AppEngClient extends AppEngBase { - private static final Logger LOGGER = LoggerFactory.getLogger(AppEngClient.class); + private static final Logger LOG = LoggerFactory.getLogger(AppEngClient.class); private static AppEngClient INSTANCE; @@ -294,7 +294,7 @@ private void clientSetup(FMLClientSetupEvent event) { try { postClientSetup(minecraft); } catch (Throwable e) { - LOGGER.error("AE2 failed postClientSetup", e); + LOG.error("AE2 failed postClientSetup", e); throw new RuntimeException(e); } }); @@ -498,7 +498,7 @@ public void openGuideAtPreviousPage(ResourceLocation initialPage) { openGuideScreen(screen); } catch (Exception e) { - LOGGER.error("Failed to open guide.", e); + LOG.error("Failed to open guide.", e); } } @@ -509,7 +509,7 @@ public void openGuideAtAnchor(PageAnchor anchor) { openGuideScreen(screen); } catch (Exception e) { - LOGGER.error("Failed to open guide at {}.", anchor, e); + LOG.error("Failed to open guide at {}.", anchor, e); } } diff --git a/src/main/java/appeng/core/worlddata/AESavedData.java b/src/main/java/appeng/core/worlddata/AESavedData.java index 1bcbb5f901c..d89f7f631e7 100644 --- a/src/main/java/appeng/core/worlddata/AESavedData.java +++ b/src/main/java/appeng/core/worlddata/AESavedData.java @@ -6,9 +6,8 @@ import java.nio.file.Files; import java.nio.file.StandardCopyOption; -import com.mojang.logging.LogUtils; - import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; @@ -20,7 +19,7 @@ * Base class for all AE2 saved data to make them more resistant to crashes while writing. Thank you RS for the idea! */ public abstract class AESavedData extends SavedData { - private static final Logger LOGGER = LogUtils.getLogger(); + private static final Logger LOG = LoggerFactory.getLogger(AESavedData.class); @Override public void save(File file, HolderLookup.Provider registries) { @@ -44,7 +43,7 @@ public void save(File file, HolderLookup.Provider registries) { Files.move(tempFile, targetPath, StandardCopyOption.REPLACE_EXISTING); } } catch (IOException iOException) { - LOGGER.error("Could not save data {}", this, iOException); + LOG.error("Could not save data {}", this, iOException); } this.setDirty(false); } diff --git a/src/main/java/appeng/datagen/providers/WorldGenProvider.java b/src/main/java/appeng/datagen/providers/WorldGenProvider.java index 67e31d2502b..3ce816cbac3 100644 --- a/src/main/java/appeng/datagen/providers/WorldGenProvider.java +++ b/src/main/java/appeng/datagen/providers/WorldGenProvider.java @@ -23,7 +23,7 @@ import appeng.core.AppEng; public class WorldGenProvider implements DataProvider { - private static final Logger LOGGER = LoggerFactory.getLogger(WorldGenProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(WorldGenProvider.class); private final PackOutput output; private final CompletableFuture registries; @@ -72,7 +72,7 @@ private static Optional> writeToPath(Path path, CachedO DynamicOps json, Encoder encoder, E value) { var optional = encoder.encodeStart(json, value).resultOrPartial((error) -> { - LOGGER.error("Couldn't serialize element {}: {}", path, error); + LOG.error("Couldn't serialize element {}: {}", path, error); }); return optional.map(data -> DataProvider.saveStable(cache, data, path)); diff --git a/src/main/java/appeng/helpers/patternprovider/PatternProviderLogic.java b/src/main/java/appeng/helpers/patternprovider/PatternProviderLogic.java index 7525fff4546..0dee56c8b76 100644 --- a/src/main/java/appeng/helpers/patternprovider/PatternProviderLogic.java +++ b/src/main/java/appeng/helpers/patternprovider/PatternProviderLogic.java @@ -83,7 +83,7 @@ * Shared code between the pattern provider block and part. */ public class PatternProviderLogic implements InternalInventoryHost, ICraftingProvider { - private static final Logger LOGGER = LoggerFactory.getLogger(PatternProviderLogic.class); + private static final Logger LOG = LoggerFactory.getLogger(PatternProviderLogic.class); public static final String NBT_MEMORY_CARD_PATTERNS = "patterns"; public static final String NBT_UNLOCK_EVENT = "unlockEvent"; @@ -172,7 +172,7 @@ public void writeToNBT(CompoundTag tag, HolderLookup.Provider registries) { tag.putByte(NBT_UNLOCK_EVENT, (byte) 2); tag.put(NBT_UNLOCK_STACK, GenericStack.writeTag(registries, unlockStack)); } else { - LOGGER.error("Saving pattern provider {}, locked waiting for stack, but stack is null!", host); + LOG.error("Saving pattern provider {}, locked waiting for stack, but stack is null!", host); } } else if (unlockEvent == UnlockCraftingEvent.REDSTONE_PULSE) { tag.putByte(NBT_UNLOCK_EVENT, (byte) 3); @@ -202,14 +202,14 @@ public void readFromNBT(CompoundTag tag, HolderLookup.Provider registries) { case 2 -> UnlockCraftingEvent.RESULT; case 3 -> UnlockCraftingEvent.REDSTONE_PULSE; default -> { - LOGGER.error("Unknown unlock event type {} in NBT for pattern provider: {}", unlockEventType, tag); + LOG.error("Unknown unlock event type {} in NBT for pattern provider: {}", unlockEventType, tag); yield null; } }; if (this.unlockEvent == UnlockCraftingEvent.RESULT) { this.unlockStack = GenericStack.readTag(registries, tag.getCompound(NBT_UNLOCK_STACK)); if (this.unlockStack == null) { - LOGGER.error("Could not load unlock stack for pattern provider from NBT: {}", tag); + LOG.error("Could not load unlock stack for pattern provider from NBT: {}", tag); } } else { this.unlockStack = null; @@ -682,7 +682,7 @@ private void onStackReturnedToNetwork(GenericStack genericStack) { if (unlockStack == null) { // Actually an error state... - LOGGER.error("pattern provider was waiting for RESULT, but no result was set"); + LOG.error("pattern provider was waiting for RESULT, but no result was set"); unlockEvent = null; } else if (unlockStack.what().equals(genericStack.what())) { var remainingAmount = unlockStack.amount() - genericStack.amount(); diff --git a/src/main/java/appeng/integration/modules/igtooltip/BaseClassRegistrationImpl.java b/src/main/java/appeng/integration/modules/igtooltip/BaseClassRegistrationImpl.java index e4636886444..3e183696a16 100644 --- a/src/main/java/appeng/integration/modules/igtooltip/BaseClassRegistrationImpl.java +++ b/src/main/java/appeng/integration/modules/igtooltip/BaseClassRegistrationImpl.java @@ -15,7 +15,7 @@ import appeng.api.parts.IPartHost; public class BaseClassRegistrationImpl implements BaseClassRegistration { - private static final Logger LOGGER = LoggerFactory.getLogger(BaseClassRegistrationImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(BaseClassRegistrationImpl.class); private final List baseClasses = new ArrayList<>(); private final Set partHostClasses = new HashSet<>(); @@ -27,7 +27,7 @@ public void addBaseBlockEntity(Class blockEntityClass, Cl // If any superclass is already in the list, don't add it for (var registeredClass : baseClasses) { if (registeredClass.isSuperclassOf(defaultClass)) { - LOGGER.info("Not registering {}, because superclass {} is already registered.", + LOG.info("Not registering {}, because superclass {} is already registered.", defaultClass, registeredClass); return; } @@ -36,7 +36,7 @@ public void addBaseBlockEntity(Class blockEntityClass, Cl // Remove any subclasses of this class baseClasses.removeIf(otherClass -> { if (defaultClass.isSuperclassOf(otherClass)) { - LOGGER.info("Replacing default server-data registration for {} with superclass {}.", + LOG.info("Replacing default server-data registration for {} with superclass {}.", defaultClass, otherClass); return true; } diff --git a/src/main/java/appeng/integration/modules/igtooltip/TooltipProviders.java b/src/main/java/appeng/integration/modules/igtooltip/TooltipProviders.java index ad0f5297708..64ff236832e 100644 --- a/src/main/java/appeng/integration/modules/igtooltip/TooltipProviders.java +++ b/src/main/java/appeng/integration/modules/igtooltip/TooltipProviders.java @@ -46,7 +46,7 @@ public final class TooltipProviders implements TooltipProvider { - private static final Logger LOGGER = LoggerFactory.getLogger(TooltipProviders.class); + private static final Logger LOG = LoggerFactory.getLogger(TooltipProviders.class); public static final ServiceLoader LOADER = ServiceLoader.load(TooltipProvider.class); @@ -76,7 +76,7 @@ public static void loadCommon(CommonRegistration registration) { } for (var clazz : baseClasses.getBaseClasses()) { - LOGGER.debug("Registering default-data for BE {} and sub-classes", clazz); + LOG.debug("Registering default-data for BE {} and sub-classes", clazz); registration.addBlockEntityData(AppEng.makeId("grid_node"), clazz.blockEntity(), new GridNodeStateDataProvider()); registration.addBlockEntityData(AppEng.makeId("power_storage"), clazz.blockEntity(), @@ -86,7 +86,7 @@ public static void loadCommon(CommonRegistration registration) { } for (var clazz : baseClasses.getPartHostClasses()) { - LOGGER.debug("Registering part host provider for {} and sub-classes", clazz); + LOG.debug("Registering part host provider for {} and sub-classes", clazz); registration.addBlockEntityData( AppEng.makeId("base_" + clazz.blockEntity().getSimpleName().toLowerCase(Locale.ROOT)), clazz.blockEntity(), @@ -103,7 +103,7 @@ public static void loadClient(ClientRegistration registration) { } for (var clazz : baseClasses.getBaseClasses()) { - LOGGER.debug("Registering default client providers for BE {} and sub-classes", clazz); + LOG.debug("Registering default client providers for BE {} and sub-classes", clazz); registration.addBlockEntityBody( clazz.blockEntity(), clazz.block(), @@ -123,7 +123,7 @@ public static void loadClient(ClientRegistration registration) { } for (var clazz : baseClasses.getPartHostClasses()) { - LOGGER.debug("Registering part host provider for {} and sub-classes", clazz); + LOG.debug("Registering part host provider for {} and sub-classes", clazz); registration.addBlockEntityName( clazz.blockEntity(), clazz.block(), diff --git a/src/main/java/appeng/items/tools/GuideItem.java b/src/main/java/appeng/items/tools/GuideItem.java index 95d15a0f489..f9f248e1c35 100644 --- a/src/main/java/appeng/items/tools/GuideItem.java +++ b/src/main/java/appeng/items/tools/GuideItem.java @@ -1,8 +1,5 @@ package appeng.items.tools; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; @@ -17,8 +14,6 @@ * Shows the guidebook when used. */ public class GuideItem extends AEBaseItem { - private static final Logger LOGGER = LoggerFactory.getLogger(GuideItem.class); - public GuideItem(Properties properties) { super(properties); } diff --git a/src/main/java/appeng/me/GridNode.java b/src/main/java/appeng/me/GridNode.java index 9a03525809e..d63fe6b3df3 100644 --- a/src/main/java/appeng/me/GridNode.java +++ b/src/main/java/appeng/me/GridNode.java @@ -35,10 +35,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.MutableClassToInstanceMap; import com.google.gson.stream.JsonWriter; -import com.mojang.logging.LogUtils; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import net.minecraft.CrashReportCategory; import net.minecraft.core.Direction; @@ -73,7 +73,7 @@ import appeng.util.JsonStreamUtil; public class GridNode implements IGridNode, IPathItem, IDebugExportable { - private static final Logger LOGGER = LogUtils.getLogger(); + private static final Logger LOG = LoggerFactory.getLogger(GridNode.class); private final ServerLevel level; /** @@ -682,7 +682,7 @@ public int propagateChannelsUpwards(boolean consumesChannel) { } if (this.usedChannels > getMaxChannels()) { - LOGGER.error( + LOG.error( "Internal channel assignment error. Grid node {} has {} channels passing through it but it only supports up to {}. Please open an issue on the AE2 repository.", this, this.usedChannels, getMaxChannels()); } diff --git a/src/main/java/appeng/parts/automation/StorageExportStrategy.java b/src/main/java/appeng/parts/automation/StorageExportStrategy.java index e19efae1de3..4b36b3d7057 100644 --- a/src/main/java/appeng/parts/automation/StorageExportStrategy.java +++ b/src/main/java/appeng/parts/automation/StorageExportStrategy.java @@ -17,7 +17,7 @@ import appeng.api.storage.StorageHelper; public class StorageExportStrategy implements StackExportStrategy { - private static final Logger LOGGER = LoggerFactory.getLogger(StorageExportStrategy.class); + private static final Logger LOG = LoggerFactory.getLogger(StorageExportStrategy.class); private final BlockCapabilityCache cache; private final HandlerStrategy handlerStrategy; @@ -69,7 +69,7 @@ public long transfer(StackTransferContext context, AEKey what, long amount) { long leftover = extracted - wasInserted; leftover -= inv.getInventory().insert(what, leftover, Actionable.MODULATE, context.getActionSource()); if (leftover > 0) { - LOGGER.error("Storage export: adjacent block unexpectedly refused insert, voided {}x{}", leftover, + LOG.error("Storage export: adjacent block unexpectedly refused insert, voided {}x{}", leftover, what); } } diff --git a/src/main/java/appeng/siteexport/SiteExporter.java b/src/main/java/appeng/siteexport/SiteExporter.java index 59d8f1cee85..dfe6e661bd1 100644 --- a/src/main/java/appeng/siteexport/SiteExporter.java +++ b/src/main/java/appeng/siteexport/SiteExporter.java @@ -19,10 +19,10 @@ import com.mojang.blaze3d.platform.NativeImage; import org.apache.commons.io.FilenameUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import net.minecraft.ChatFormatting; import net.minecraft.DetectedVersion; @@ -91,7 +91,7 @@ @OnlyIn(Dist.CLIENT) public final class SiteExporter implements ResourceExporter { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOG = LoggerFactory.getLogger(SiteExporter.class); private static final int ICON_DIMENSION = 128; @@ -176,7 +176,7 @@ public void referenceItem(ItemStack stack) { if (!stack.isEmpty()) { items.add(stack.getItem()); if (!stack.getComponentsPatch().isEmpty()) { - LOGGER.error("Couldn't handle stack with NBT tag: {}", stack); + LOG.error("Couldn't handle stack with NBT tag: {}", stack); } } } @@ -239,7 +239,7 @@ private void dumpRecipes(SiteExportWriter writer) { } else if (recipe instanceof ChargerRecipe chargerRecipe) { writer.addRecipe(id, chargerRecipe); } else { - LOGGER.warn("Unable to handle recipe {} of type {}", holder.id(), recipe.getType()); + LOG.warn("Unable to handle recipe {} of type {}", holder.id(), recipe.getType()); } } } @@ -316,9 +316,9 @@ private void export() throws Exception { // Load data packs if needed if (client.level == null) { - LOGGER.info("Reloading datapacks to get recipes"); + LOG.info("Reloading datapacks to get recipes"); Guide.runDatapackReload(); - LOGGER.info("Completed datapack reload"); + LOG.info("Completed datapack reload"); } // Reference all navigation node icons @@ -329,7 +329,7 @@ private void export() throws Exception { for (var page : guide.getPages()) { currentPage = page; - LOGGER.debug("Compiling {}", page); + LOG.debug("Compiling {}", page); var compiledPage = PageCompiler.compile(guide, guide.getExtensions(), page); processPage(indexWriter, page, compiledPage); @@ -468,7 +468,7 @@ private void processItems(Minecraft client, renderer.setupItemRendering(); - LOGGER.info("Exporting items..."); + LOG.info("Exporting items..."); for (var item : items) { var stack = new ItemStack(item); @@ -516,7 +516,7 @@ private void processFluids(Minecraft client, renderer.setupItemRendering(); - LOGGER.info("Exporting fluids..."); + LOG.info("Exporting fluids..."); for (var fluid : fluids) { var fluidVariant = new FluidStack(fluid, 1); String fluidId = BuiltInRegistries.FLUID.getKey(fluid).toString();