Migrate to SLF4j

This commit is contained in:
modmuss50 2022-01-19 20:41:36 +00:00
parent 98eed4da8e
commit 55eb70742f
7 changed files with 45 additions and 20 deletions

View file

@ -33,8 +33,8 @@ import net.fabricmc.fabric.api.event.world.WorldTickCallback;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import reborncore.api.ToolManager; import reborncore.api.ToolManager;
import reborncore.api.blockentity.UnloadHandler; import reborncore.api.blockentity.UnloadHandler;
import reborncore.common.RebornCoreCommands; import reborncore.common.RebornCoreCommands;
@ -65,7 +65,7 @@ public class RebornCore implements ModInitializer {
public static final String MOD_VERSION = "@MODVERSION@"; public static final String MOD_VERSION = "@MODVERSION@";
public static final String WEB_URL = "https://files.modmuss50.me/"; public static final String WEB_URL = "https://files.modmuss50.me/";
public static final Logger LOGGER = LogManager.getFormatterLogger(MOD_ID); public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static File configDir; public static File configDir;
public static boolean LOADED = false; public static boolean LOADED = false;

View file

@ -26,8 +26,7 @@ package reborncore.client.gui.builder.widget;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import org.apache.logging.log4j.util.TriConsumer; import reborncore.common.misc.TriConsumer;
public class GuiButtonExtended extends ButtonWidget { public class GuiButtonExtended extends ButtonWidget {

View file

@ -37,8 +37,8 @@ import net.minecraft.screen.slot.Slot;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.Range; import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.network.ClientBoundPackets; import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
@ -54,7 +54,7 @@ import java.util.function.Predicate;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BuiltScreenHandler extends ScreenHandler { public class BuiltScreenHandler extends ScreenHandler {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LoggerFactory.getLogger(BuiltScreenHandler.class);
private final String name; private final String name;

View file

@ -0,0 +1,30 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.common.misc;
@FunctionalInterface
public interface TriConsumer<A, B, C> {
void accept(A a, B b, C c);
}

View file

@ -225,9 +225,7 @@ public class MultiblockWorldRegistry {
} }
if (newMaster == null) { if (newMaster == null) {
RebornCore.LOGGER.fatal( RebornCore.LOGGER.error("Multiblock system checked a merge pool of size %d, found no master candidates. This should never happen., {}", mergePool.size());
String.format("Multiblock system checked a merge pool of size %d, found no master candidates. This should never happen.",
mergePool.size()));
} else { } else {
// Merge all the other machines into the master machine, // Merge all the other machines into the master machine,
// then unregister them // then unregister them
@ -282,8 +280,7 @@ public class MultiblockWorldRegistry {
// potentially dead. // potentially dead.
// Validate that they are empty/dead, then unregister them. // Validate that they are empty/dead, then unregister them.
if (!controller.isEmpty()) { if (!controller.isEmpty()) {
RebornCore.LOGGER.fatal( RebornCore.LOGGER.error("Found a non-empty controller. Forcing it to shed its blocks and die. This should never happen!");
"Found a non-empty controller. Forcing it to shed its blocks and die. This should never happen!");
detachedParts.addAll(controller.detachAllBlocks()); detachedParts.addAll(controller.detachAllBlocks());
} }

View file

@ -37,8 +37,8 @@ import net.minecraft.screen.ScreenHandler;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.apache.logging.log4j.LogManager; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.client.ClientChunkManager; import reborncore.client.ClientChunkManager;
import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.BuiltScreenHandler;
@ -46,13 +46,12 @@ import reborncore.common.blockentity.FluidConfiguration;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blockentity.SlotConfiguration; import reborncore.common.blockentity.SlotConfiguration;
import reborncore.common.chunkloading.ChunkLoaderManager; import reborncore.common.chunkloading.ChunkLoaderManager;
import reborncore.common.util.WorldUtils;
import java.util.List; import java.util.List;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class ClientBoundPacketHandlers { public class ClientBoundPacketHandlers {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LoggerFactory.getLogger(ClientBoundPacketHandlers.class);
public static void init() { public static void init() {
NetworkManager.registerClientBoundHandler(new Identifier("reborncore", "custom_description"), (client, handler, packetBuffer, responseSender) -> { NetworkManager.registerClientBoundHandler(new Identifier("reborncore", "custom_description"), (client, handler, packetBuffer, responseSender) -> {

View file

@ -33,8 +33,8 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import reborncore.common.blockentity.RedstoneConfiguration; import reborncore.common.blockentity.RedstoneConfiguration;
import reborncore.common.config.Configuration; import reborncore.common.config.Configuration;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
@ -58,7 +58,7 @@ import java.util.function.Predicate;
public class TechReborn implements ModInitializer { public class TechReborn implements ModInitializer {
public static final String MOD_ID = "techreborn"; public static final String MOD_ID = "techreborn";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID); public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static TechReborn INSTANCE; public static TechReborn INSTANCE;
public static ItemGroup ITEMGROUP = FabricItemGroupBuilder.build( public static ItemGroup ITEMGROUP = FabricItemGroupBuilder.build(