diff --git a/gradle.properties b/gradle.properties index 4fda2adbe..f599c6e00 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ legacy-fabric-gamerule-api-v1.version = 1.0.0 legacy-fabric-item-groups-v1.version = 2.0.0 legacy-fabric-keybindings-api-v1.version = 1.0.1 legacy-fabric-lifecycle-events-v1.version = 1.0.1 -legacy-fabric-logger-api-v1.version = 1.0.4 +legacy-fabric-logger-api-v1.version = 1.1.0 legacy-fabric-networking-api-v1.version = 2.0.1 legacy-fabric-permissions-api-v1.version = 1.0.1 legacy-fabric-registry-sync-api-v1.version = 2.1.0 diff --git a/legacy-fabric-command-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java b/legacy-fabric-command-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java index 13448bc68..983bf0e8a 100644 --- a/legacy-fabric-command-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java +++ b/legacy-fabric-command-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java @@ -48,10 +48,10 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.permission.v1.PermissibleCommandSource; import net.legacyfabric.fabric.api.util.Location; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class CommandManagerImpl implements CommandManager { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Command Manager"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Command Manager"); private final Object lock = new Object(); private final SimpleDispatcher dispatcher; private final List mappings = Lists.newArrayList(); diff --git a/legacy-fabric-command-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java b/legacy-fabric-command-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java index 049ad1aa8..244f32dde 100644 --- a/legacy-fabric-command-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java +++ b/legacy-fabric-command-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java @@ -49,10 +49,10 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.permission.v1.PermissibleCommandSource; import net.legacyfabric.fabric.api.util.Location; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class CommandManagerImpl implements CommandManager { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Command Manager"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Command Manager"); private final Object lock = new Object(); private final SimpleDispatcher dispatcher; private final List mappings = Lists.newArrayList(); diff --git a/legacy-fabric-command-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java b/legacy-fabric-command-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java index 13448bc68..983bf0e8a 100644 --- a/legacy-fabric-command-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java +++ b/legacy-fabric-command-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/impl/command/CommandManagerImpl.java @@ -48,10 +48,10 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.permission.v1.PermissibleCommandSource; import net.legacyfabric.fabric.api.util.Location; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class CommandManagerImpl implements CommandManager { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Command Manager"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Command Manager"); private final Object lock = new Object(); private final SimpleDispatcher dispatcher; private final List mappings = Lists.newArrayList(); diff --git a/legacy-fabric-entity-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java b/legacy-fabric-entity-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java index 7f52d4ac5..d7c0a2dd1 100644 --- a/legacy-fabric-entity-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java +++ b/legacy-fabric-entity-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java @@ -25,10 +25,10 @@ import net.legacyfabric.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents; import net.legacyfabric.fabric.api.entity.event.v1.ServerPlayerEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class EntityEventsTest implements ModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "EntityEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "EntityEvents"); @Override public void onInitialize() { diff --git a/legacy-fabric-entity-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java b/legacy-fabric-entity-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java index d45f09d4a..ac825d1b5 100644 --- a/legacy-fabric-entity-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java +++ b/legacy-fabric-entity-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java @@ -25,10 +25,10 @@ import net.legacyfabric.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents; import net.legacyfabric.fabric.api.entity.event.v1.ServerPlayerEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class EntityEventsTest implements ModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "EntityEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "EntityEvents"); @Override public void onInitialize() { diff --git a/legacy-fabric-entity-events-v1/1.9.4/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java b/legacy-fabric-entity-events-v1/1.9.4/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java index 7f52d4ac5..d7c0a2dd1 100644 --- a/legacy-fabric-entity-events-v1/1.9.4/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java +++ b/legacy-fabric-entity-events-v1/1.9.4/src/testmod/java/net/legacyfabric/fabric/test/entity/EntityEventsTest.java @@ -25,10 +25,10 @@ import net.legacyfabric.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents; import net.legacyfabric.fabric.api.entity.event.v1.ServerPlayerEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class EntityEventsTest implements ModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "EntityEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "EntityEvents"); @Override public void onInitialize() { diff --git a/legacy-fabric-lifecycle-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java b/legacy-fabric-lifecycle-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java index bf1b8088e..05cf3d0a6 100644 --- a/legacy-fabric-lifecycle-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java +++ b/legacy-fabric-lifecycle-events-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java @@ -21,10 +21,10 @@ import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ClientLifecycleEventsTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ClientLifecycleEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ClientLifecycleEvents"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-lifecycle-events-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java b/legacy-fabric-lifecycle-events-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java index bf1b8088e..05cf3d0a6 100644 --- a/legacy-fabric-lifecycle-events-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java +++ b/legacy-fabric-lifecycle-events-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java @@ -21,10 +21,10 @@ import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ClientLifecycleEventsTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ClientLifecycleEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ClientLifecycleEvents"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-lifecycle-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java b/legacy-fabric-lifecycle-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java index bf1b8088e..05cf3d0a6 100644 --- a/legacy-fabric-lifecycle-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java +++ b/legacy-fabric-lifecycle-events-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsTest.java @@ -21,10 +21,10 @@ import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ClientLifecycleEventsTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ClientLifecycleEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ClientLifecycleEvents"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/ServerLifecycleEventsTest.java b/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/ServerLifecycleEventsTest.java index 6ebc689ee..cbf3aa889 100644 --- a/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/ServerLifecycleEventsTest.java +++ b/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/ServerLifecycleEventsTest.java @@ -25,10 +25,10 @@ import net.legacyfabric.fabric.api.event.lifecycle.v1.ServerEntityEvents; import net.legacyfabric.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ServerLifecycleEventsTest implements ModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ServerLifecycleEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ServerLifecycleEvents"); @Override public void onInitialize() { diff --git a/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsCommonTest.java b/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsCommonTest.java index 2e26e0403..3e275ec2a 100644 --- a/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsCommonTest.java +++ b/legacy-fabric-lifecycle-events-v1/common/src/testmod/java/net/legacyfabric/fabric/test/lifecycle/client/ClientLifecycleEventsCommonTest.java @@ -24,10 +24,10 @@ import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientChunkEvents; import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientEntityEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ClientLifecycleEventsCommonTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ClientLifecycleEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ClientLifecycleEvents"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/api/logger/v1/Logger.java b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/api/logger/v1/Logger.java index 41052a2d3..640f7b0b5 100644 --- a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/api/logger/v1/Logger.java +++ b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/api/logger/v1/Logger.java @@ -17,7 +17,7 @@ package net.legacyfabric.fabric.api.logger.v1; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public interface Logger { /** @@ -32,7 +32,7 @@ public interface Logger { * @return a Logger implementation */ static Logger get(String context, String... subs) { - return new LoggerImpl(context, subs); + return LoggerHelper.getLogger(context, subs); } void info(String format); diff --git a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/JavaLoggerImpl.java b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/JavaLoggerImpl.java new file mode 100644 index 000000000..51ecd9a37 --- /dev/null +++ b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/JavaLoggerImpl.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2020 - 2024 Legacy Fabric + * Copyright (c) 2016 - 2022 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.legacyfabric.fabric.impl.logger; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +public class JavaLoggerImpl implements net.legacyfabric.fabric.api.logger.v1.Logger { + private final Logger instance; + + protected JavaLoggerImpl(String context, String... subs) { + List parts = new ArrayList<>(); + parts.add(context); + parts.addAll(Arrays.asList(subs)); + + instance = Logger.getLogger(parts.stream().collect(Collectors.joining("/"))); + } + + @Override + public void info(String format) { + instance.log(Level.INFO, format); + } + + @Override + public void info(String format, Object... args) { + instance.log(Level.INFO, format, args); + } + + @Override + public void info(String format, Throwable exc) { + instance.log(Level.INFO, format, exc); + } + + @Override + public void error(String format) { + instance.log(Level.SEVERE, format); + } + + @Override + public void error(String format, Object... args) { + instance.log(Level.SEVERE, format, args); + } + + @Override + public void error(String format, Throwable exc) { + instance.log(Level.SEVERE, format, exc); + } + + @Override + public void warn(String format) { + instance.log(Level.WARNING, format); + } + + @Override + public void warn(String format, Object... args) { + instance.log(Level.WARNING, format, args); + } + + @Override + public void warn(String format, Throwable exc) { + instance.log(Level.WARNING, format, exc); + } + + @Override + public void debug(String format) { + instance.log(Level.FINE, format); + } + + @Override + public void debug(String format, Object... args) { + instance.log(Level.FINE, format, args); + } + + @Override + public void debug(String format, Throwable exc) { + instance.log(Level.FINE, format, exc); + } + + @Override + public void trace(String format) { + instance.log(Level.FINEST, format); + } + + @Override + public void trace(String format, Object... args) { + instance.log(Level.FINEST, format, args); + } + + @Override + public void trace(String format, Throwable exc) { + instance.log(Level.FINEST, format, exc); + } +} diff --git a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/LoggerHelper.java b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/LoggerHelper.java new file mode 100644 index 000000000..56ec7d3ac --- /dev/null +++ b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/LoggerHelper.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2020 - 2024 Legacy Fabric + * Copyright (c) 2016 - 2022 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.legacyfabric.fabric.impl.logger; + +import java.util.function.BiFunction; + +import net.legacyfabric.fabric.api.logger.v1.Logger; +import net.legacyfabric.fabric.impl.logger.utils.TriState; + +public class LoggerHelper { + public static final String API = "LegacyFabricAPI"; + + private static TriState exists = TriState.DEFAULT; + private static final BiFunction javaLogger = JavaLoggerImpl::new; + private static final BiFunction nativeLogger = NativeLoggerImpl::new; + + public static Logger getLogger(String context, String... subs) { + if (exists == TriState.DEFAULT) { + try { + Class.forName("net.fabricmc.loader.impl.util.log.LogCategory"); + Class.forName("net.fabricmc.loader.impl.util.log.Log"); + exists = TriState.TRUE; + } catch (ClassNotFoundException ignored) { + exists = TriState.FALSE; + } + } + + return exists.get() ? nativeLogger.apply(context, subs) : javaLogger.apply(context, subs); + } +} diff --git a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/LoggerImpl.java b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/NativeLoggerImpl.java similarity index 71% rename from legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/LoggerImpl.java rename to legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/NativeLoggerImpl.java index 807a2538b..6380932a2 100644 --- a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/LoggerImpl.java +++ b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/NativeLoggerImpl.java @@ -17,37 +17,15 @@ package net.legacyfabric.fabric.impl.logger; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import net.fabricmc.loader.impl.util.log.Log; import net.fabricmc.loader.impl.util.log.LogCategory; import net.legacyfabric.fabric.api.logger.v1.Logger; -public class LoggerImpl implements Logger { - public static final String API = "LegacyFabricAPI"; - private LogCategory category; - - public LoggerImpl(String context, String... subs) { - try { // Loader 0.14.3+ - tryCreatingLogger(context, subs); - } catch (NoSuchMethodError e) { // Loader 0.13+ - List parts = new ArrayList<>(); - parts.add(context); - Collections.addAll(parts, subs); - - try { - this.category = LogCategory.class.getDeclaredConstructor(String[].class).newInstance(parts.toArray(new String[0])); - } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); - } - } - } +public class NativeLoggerImpl implements Logger { + private final LogCategory category; - private void tryCreatingLogger(String context, String... subs) throws NoSuchMethodError { + public NativeLoggerImpl(String context, String... subs) { this.category = LogCategory.createCustom(context, subs); } diff --git a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/utils/BooleanFunction.java b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/utils/BooleanFunction.java new file mode 100644 index 000000000..2f5b5e8df --- /dev/null +++ b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/utils/BooleanFunction.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 - 2024 Legacy Fabric + * Copyright (c) 2016 - 2022 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.legacyfabric.fabric.impl.logger.utils; + +/** + * Represents a function that accepts an boolean-valued argument and produces a result. + * + *

This is the {@code boolean}-consuming primitive specialization for {@link java.util.function.Function}. + */ +@FunctionalInterface +public interface BooleanFunction { + /** + * Applies this function to the given argument. + * + * @param value the function argument + * @return the function result + */ + R apply(boolean value); +} diff --git a/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/utils/TriState.java b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/utils/TriState.java new file mode 100644 index 000000000..cb9237faf --- /dev/null +++ b/legacy-fabric-logger-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/logger/utils/TriState.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2020 - 2024 Legacy Fabric + * Copyright (c) 2016 - 2022 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.legacyfabric.fabric.impl.logger.utils; + +import java.util.Objects; +import java.util.Optional; +import java.util.function.BooleanSupplier; +import java.util.function.Supplier; + +import org.jetbrains.annotations.Nullable; + +/** + * Represents a boolean value which can be true, false or refer to a default value. + */ +public enum TriState { + /** + * Represents the boolean value of {@code false}. + */ + FALSE, + /** + * Represents a value that refers to a "default" value, often as a fallback. + */ + DEFAULT, + /** + * Represents the boolean value of {@code true}. + */ + TRUE; + + /** + * Gets the corresponding tri-state from a boolean value. + * + * @param bool the boolean value + * @return {@link TriState#TRUE} or {@link TriState#FALSE} depending on the value of the boolean. + */ + public static TriState of(boolean bool) { + return bool ? TRUE : FALSE; + } + + /** + * Gets a tri-state from a nullable boxed boolean. + * + * @param bool the boolean value + * @return {@link TriState#DEFAULT} if {@code null}. + * Otherwise {@link TriState#TRUE} or {@link TriState#FALSE} depending on the value of the boolean. + */ + public static TriState of(@Nullable Boolean bool) { + return bool == null ? DEFAULT : of(bool.booleanValue()); + } + + /** + * Gets the value of the tri-state. + * + * @return true if the tri-state is {@link TriState#TRUE}. + * Otherwise false. + */ + public boolean get() { + return this == TRUE; + } + + /** + * Gets the value of the tri-state as a boxed, nullable boolean. + * + * @return {@code null} if {@link TriState#DEFAULT}. + * Otherwise {@code true} if {@link TriState#TRUE} or {@code false} if {@link TriState#FALSE}. + */ + @Nullable + public Boolean getBoxed() { + return this == DEFAULT ? null : this.get(); + } + + /** + * Gets the value of this tri-state. + * If the value is {@link TriState#DEFAULT} then use the supplied value. + * + * @param value the value to fallback to + * @return the value of the tri-state or the supplied value if {@link TriState#DEFAULT}. + */ + public boolean orElse(boolean value) { + return this == DEFAULT ? value : this.get(); + } + + /** + * Gets the value of this tri-state. + * If the value is {@link TriState#DEFAULT} then use the supplied value. + * + * @param supplier the supplier used to get the value to fallback to + * @return the value of the tri-state or the value of the supplier if the tri-state is {@link TriState#DEFAULT}. + */ + public boolean orElseGet(BooleanSupplier supplier) { + return this == DEFAULT ? supplier.getAsBoolean() : this.get(); + } + + /** + * Maps the boolean value of this tri-state if it is {@link TriState#TRUE} or {@link TriState#FALSE}. + * + * @param mapper the mapper to use + * @param the type of object being supplier by the mapper + * @return an optional containing the mapped value; {@link Optional#empty()} if the tri-state is {@link TriState#DEFAULT} or the value provided by the mapper is {@code null}. + */ + public Optional map(BooleanFunction<@Nullable ? extends T> mapper) { + Objects.requireNonNull(mapper, "Mapper function cannot be null"); + + if (this == DEFAULT) { + return Optional.empty(); + } + + return Optional.ofNullable(mapper.apply(this.get())); + } + + /** + * Gets the value of this tri-state, or throws an exception if this tri-state's value is {@link TriState#DEFAULT}. + * + * @param exceptionSupplier the supplying function that produces an exception to be thrown + * @param Type of the exception to be thrown + * @return the value + * @throws X if the value is {@link TriState#DEFAULT} + */ + public boolean orElseThrow(Supplier exceptionSupplier) throws X { + if (this != DEFAULT) { + return this.get(); + } + + throw exceptionSupplier.get(); + } +} diff --git a/legacy-fabric-logger-api-v1/common/src/main/resources/fabric.mod.json b/legacy-fabric-logger-api-v1/common/src/main/resources/fabric.mod.json index b9acf50a3..14f24b681 100644 --- a/legacy-fabric-logger-api-v1/common/src/main/resources/fabric.mod.json +++ b/legacy-fabric-logger-api-v1/common/src/main/resources/fabric.mod.json @@ -16,7 +16,7 @@ "FabricMC" ], "depends": { - "fabricloader": ">0.13" + "fabricloader": ">=0.14" }, "description": "Friendly logger api built on top of fabric loader internal's", "custom": { diff --git a/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java b/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java index b6df87b38..a5b06f1db 100644 --- a/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java +++ b/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java @@ -24,10 +24,10 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.networking.v1.S2CPlayChannelEvents; import net.legacyfabric.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ServerNetworkingTest implements ModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ServerNetworking"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ServerNetworking"); @Override public void onInitialize() { diff --git a/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java b/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java index 2c76c14d3..a64299340 100644 --- a/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java +++ b/legacy-fabric-networking-api-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java @@ -24,10 +24,10 @@ import net.legacyfabric.fabric.api.client.networking.v1.C2SPlayChannelEvents; import net.legacyfabric.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ClientNetworkingTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ClientNetworking"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ClientNetworking"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java b/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java index b6df87b38..a5b06f1db 100644 --- a/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java +++ b/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java @@ -24,10 +24,10 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.networking.v1.S2CPlayChannelEvents; import net.legacyfabric.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ServerNetworkingTest implements ModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ServerNetworking"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ServerNetworking"); @Override public void onInitialize() { diff --git a/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java b/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java index 2c76c14d3..a64299340 100644 --- a/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java +++ b/legacy-fabric-networking-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java @@ -24,10 +24,10 @@ import net.legacyfabric.fabric.api.client.networking.v1.C2SPlayChannelEvents; import net.legacyfabric.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ClientNetworkingTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ClientNetworking"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ClientNetworking"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java b/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java index b6df87b38..a5b06f1db 100644 --- a/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java +++ b/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/ServerNetworkingTest.java @@ -24,10 +24,10 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.networking.v1.S2CPlayChannelEvents; import net.legacyfabric.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ServerNetworkingTest implements ModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ServerNetworking"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ServerNetworking"); @Override public void onInitialize() { diff --git a/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java b/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java index 2c76c14d3..a64299340 100644 --- a/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java +++ b/legacy-fabric-networking-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/network/client/ClientNetworkingTest.java @@ -24,10 +24,10 @@ import net.legacyfabric.fabric.api.client.networking.v1.C2SPlayChannelEvents; import net.legacyfabric.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ClientNetworkingTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ClientNetworking"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ClientNetworking"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/AbstractNetworkAddon.java b/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/AbstractNetworkAddon.java index 266c02767..2c3d55906 100644 --- a/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/AbstractNetworkAddon.java +++ b/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/AbstractNetworkAddon.java @@ -27,7 +27,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; /** * A network addon is a simple abstraction to hold information about a player's registered channels. @@ -45,7 +45,7 @@ public abstract class AbstractNetworkAddon { protected AbstractNetworkAddon(GlobalReceiverRegistry receiver, String description) { this.receiver = receiver; - this.logger = Logger.get(LoggerImpl.API, description); + this.logger = Logger.get(LoggerHelper.API, description); } public H getHandler(String channel) { diff --git a/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/NetworkingImpl.java b/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/NetworkingImpl.java index 4fe1280e5..032e55302 100644 --- a/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/NetworkingImpl.java +++ b/legacy-fabric-networking-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/networking/NetworkingImpl.java @@ -18,11 +18,11 @@ package net.legacyfabric.fabric.impl.networking; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public final class NetworkingImpl { public static final String MOD_ID = "fabric-networking-api-v1"; - public static final Logger LOGGER = Logger.get(LoggerImpl.API, MOD_ID); + public static final Logger LOGGER = Logger.get(LoggerHelper.API, MOD_ID); /** * Id of packet used to register supported channels. */ diff --git a/legacy-fabric-permissions-api-v1/common/src/main/java/net/legacyfabric/fabric/api/permission/v1/PermissionsApiHolder.java b/legacy-fabric-permissions-api-v1/common/src/main/java/net/legacyfabric/fabric/api/permission/v1/PermissionsApiHolder.java index 46b3821bd..35ed8d9b5 100644 --- a/legacy-fabric-permissions-api-v1/common/src/main/java/net/legacyfabric/fabric/api/permission/v1/PermissionsApiHolder.java +++ b/legacy-fabric-permissions-api-v1/common/src/main/java/net/legacyfabric/fabric/api/permission/v1/PermissionsApiHolder.java @@ -27,7 +27,7 @@ import net.fabricmc.loader.api.FabricLoader; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; /** * @deprecated Unstable API, may change in the future. @@ -35,7 +35,7 @@ @Deprecated @ApiStatus.Experimental public class PermissionsApiHolder { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "PermissionApiHolder"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "PermissionApiHolder"); private static PlayerPermissionsApi PLAYER_PERMISSIONS_API = null; public static boolean setPlayerPermissionsApi(PlayerPermissionsApi api) { diff --git a/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/registry/sync/remappers/RegistryRemapper.java b/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/registry/sync/remappers/RegistryRemapper.java index a66f11cab..8110f23ff 100644 --- a/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/registry/sync/remappers/RegistryRemapper.java +++ b/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/impl/registry/sync/remappers/RegistryRemapper.java @@ -29,7 +29,7 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.registry.v1.RegistryHelper; import net.legacyfabric.fabric.api.util.Identifier; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; import net.legacyfabric.fabric.impl.registry.RegistryHelperImpl; import net.legacyfabric.fabric.impl.registry.sync.compat.IdListCompat; import net.legacyfabric.fabric.impl.registry.sync.compat.SimpleRegistryCompat; @@ -37,7 +37,7 @@ import net.legacyfabric.fabric.impl.registry.util.RegistryEventsHolder; public class RegistryRemapper { - protected static final Logger LOGGER = Logger.get(LoggerImpl.API, "RegistryRemapper"); + protected static final Logger LOGGER = Logger.get(LoggerHelper.API, "RegistryRemapper"); protected final SimpleRegistryCompat registry; protected BiMap entryDump; protected BiMap missingMap = HashBiMap.create(); diff --git a/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/WorldSaveHandlerMixin.java b/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/WorldSaveHandlerMixin.java index 1c712a1d9..1c028e3bd 100644 --- a/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/WorldSaveHandlerMixin.java +++ b/legacy-fabric-registry-sync-api-v1/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/WorldSaveHandlerMixin.java @@ -38,7 +38,7 @@ import net.minecraft.world.level.LevelProperties; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; import net.legacyfabric.fabric.impl.registry.sync.ServerRegistryRemapper; @Mixin(WorldSaveHandler.class) @@ -48,7 +48,7 @@ public class WorldSaveHandlerMixin { @Unique private static final int FABRIC_ID_REGISTRY_BACKUPS = 3; @Unique - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "WorldSaveHandler"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "WorldSaveHandler"); @Final @Shadow private File worldDir; diff --git a/legacy-fabric-rendering-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java b/legacy-fabric-rendering-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java index 45652ad3d..fe8bcb105 100644 --- a/legacy-fabric-rendering-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java +++ b/legacy-fabric-rendering-api-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java @@ -26,10 +26,10 @@ import net.legacyfabric.fabric.api.client.rendering.v1.HudRenderCallback; import net.legacyfabric.fabric.api.client.rendering.v1.InvalidateRenderStateCallback; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class RenderingEventsTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "RenderingEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "RenderingEvents"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-rendering-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java b/legacy-fabric-rendering-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java index 45652ad3d..fe8bcb105 100644 --- a/legacy-fabric-rendering-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java +++ b/legacy-fabric-rendering-api-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/client/rendering/RenderingEventsTest.java @@ -26,10 +26,10 @@ import net.legacyfabric.fabric.api.client.rendering.v1.HudRenderCallback; import net.legacyfabric.fabric.api.client.rendering.v1.InvalidateRenderStateCallback; import net.legacyfabric.fabric.api.logger.v1.Logger; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class RenderingEventsTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "RenderingEvents"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "RenderingEvents"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-resource-loader-v1/1.10.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java b/legacy-fabric-resource-loader-v1/1.10.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java index 99ab573c7..92db906fa 100644 --- a/legacy-fabric-resource-loader-v1/1.10.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java +++ b/legacy-fabric-resource-loader-v1/1.10.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java @@ -27,10 +27,10 @@ import net.legacyfabric.fabric.api.resource.IdentifiableResourceReloadListener; import net.legacyfabric.fabric.api.resource.ResourceManagerHelper; import net.legacyfabric.fabric.api.util.Identifier; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ResourceReloadTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ResourceReload"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ResourceReload"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-resource-loader-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java b/legacy-fabric-resource-loader-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java index 99ab573c7..92db906fa 100644 --- a/legacy-fabric-resource-loader-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java +++ b/legacy-fabric-resource-loader-v1/1.12.2/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java @@ -27,10 +27,10 @@ import net.legacyfabric.fabric.api.resource.IdentifiableResourceReloadListener; import net.legacyfabric.fabric.api.resource.ResourceManagerHelper; import net.legacyfabric.fabric.api.util.Identifier; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ResourceReloadTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ResourceReload"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ResourceReload"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-resource-loader-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java b/legacy-fabric-resource-loader-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java index 99ab573c7..92db906fa 100644 --- a/legacy-fabric-resource-loader-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java +++ b/legacy-fabric-resource-loader-v1/1.7.10/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java @@ -27,10 +27,10 @@ import net.legacyfabric.fabric.api.resource.IdentifiableResourceReloadListener; import net.legacyfabric.fabric.api.resource.ResourceManagerHelper; import net.legacyfabric.fabric.api.util.Identifier; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ResourceReloadTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ResourceReload"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ResourceReload"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-resource-loader-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java b/legacy-fabric-resource-loader-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java index 99ab573c7..92db906fa 100644 --- a/legacy-fabric-resource-loader-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java +++ b/legacy-fabric-resource-loader-v1/1.8.9/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java @@ -27,10 +27,10 @@ import net.legacyfabric.fabric.api.resource.IdentifiableResourceReloadListener; import net.legacyfabric.fabric.api.resource.ResourceManagerHelper; import net.legacyfabric.fabric.api.util.Identifier; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ResourceReloadTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ResourceReload"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ResourceReload"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-resource-loader-v1/1.8/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java b/legacy-fabric-resource-loader-v1/1.8/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java index 99ab573c7..92db906fa 100644 --- a/legacy-fabric-resource-loader-v1/1.8/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java +++ b/legacy-fabric-resource-loader-v1/1.8/src/testmod/java/net/legacyfabric/fabric/test/resource/loader/client/ResourceReloadTest.java @@ -27,10 +27,10 @@ import net.legacyfabric.fabric.api.resource.IdentifiableResourceReloadListener; import net.legacyfabric.fabric.api.resource.ResourceManagerHelper; import net.legacyfabric.fabric.api.util.Identifier; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ResourceReloadTest implements ClientModInitializer { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "Test", "ResourceReload"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "Test", "ResourceReload"); @Override public void onInitializeClient() { diff --git a/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ModNioResourcePack.java b/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ModNioResourcePack.java index 435a4143e..335826496 100644 --- a/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ModNioResourcePack.java +++ b/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ModNioResourcePack.java @@ -36,10 +36,10 @@ import net.legacyfabric.fabric.api.logger.v1.Logger; import net.legacyfabric.fabric.api.resource.ModResourcePack; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ModNioResourcePack extends AbstractFileResourcePack implements ModResourcePack, Closeable { - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "ModNioResourcePack"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "ModNioResourcePack"); private static final Pattern RESOURCE_PACK_PATH = Pattern.compile("[a-z0-9-_]+"); private final ModContainer container; private final Path basePath; diff --git a/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ResourceManagerHelperImpl.java b/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ResourceManagerHelperImpl.java index de1d0d1de..998b02394 100644 --- a/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ResourceManagerHelperImpl.java +++ b/legacy-fabric-resource-loader-v1/common/src/main/java/net/legacyfabric/fabric/impl/resource/loader/ResourceManagerHelperImpl.java @@ -31,11 +31,11 @@ import net.legacyfabric.fabric.api.resource.IdentifiableResourceReloadListener; import net.legacyfabric.fabric.api.resource.ResourceManagerHelper; import net.legacyfabric.fabric.api.util.Identifier; -import net.legacyfabric.fabric.impl.logger.LoggerImpl; +import net.legacyfabric.fabric.impl.logger.LoggerHelper; public class ResourceManagerHelperImpl implements ResourceManagerHelper { private static final ResourceManagerHelperImpl INSTANCE = new ResourceManagerHelperImpl(); - private static final Logger LOGGER = Logger.get(LoggerImpl.API, "ResourceManagerHelperImpl"); + private static final Logger LOGGER = Logger.get(LoggerHelper.API, "ResourceManagerHelperImpl"); private final Set addedListenerIds = new HashSet<>(); private final Set addedListeners = new LinkedHashSet<>();