diff --git a/build.gradle b/build.gradle index 769eefb..ec3e464 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,9 @@ plugins { - id "dev.architectury.loom" version "1.4-SNAPSHOT" + id "dev.architectury.loom" version "1.5-SNAPSHOT" id "maven-publish" } -sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name +base.archivesName = project.archives_base_name version = "${project.mod_version}+mc${project.minecraft_version}" group = project.maven_group @@ -39,6 +37,9 @@ tasks.withType(JavaCompile) { } java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + withSourcesJar() } diff --git a/gradle.properties b/gradle.properties index 69c6f48..223da8f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,11 +5,11 @@ loom.platform=neoforge # Base properties minecraft_version=1.20.4 - neoforge_version=20.4.169 + neoforge_version=20.4.234 yarn_mappings=1.20.4+build.3 # Mod Properties - mod_version=0.1.1 + mod_version=0.1.2 maven_group=org.thinkingstudio.forged_networking archives_base_name=ForgedNetworking mod_id=forged_networking diff --git a/src/main/java/net/fabricmc/fabric/api/event/AutoInvokingEvent.java b/src/main/java/net/fabricmc/fabric/api/event/AutoInvokingEvent.java deleted file mode 100644 index fabfe1d..0000000 --- a/src/main/java/net/fabricmc/fabric/api/event/AutoInvokingEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018, 2019 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.fabricmc.fabric.api.event; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Indicates that this {@link Event} is auto-invoking: - * it calls the event callback implemented by a context parameter type automatically and without registration. - * - *

This means that this event can be listened to in two ways: - *

- * - *

Do note that there may be more than one context parameter. - * - *

A typical use case is feature augmentation, for example to expose raw clicks to slots. - * The event callback has a slot parameter - the context parameter - and the event itself is carrying this annotation. - * All the slot needs to receive slot clicks is to implement {@code SlotClickCallback} on itself. - * It shouldn't do any explicit event registration like {@code SLOT_CLICK_EVENT.register(this::onSlotClick)}, - * otherwise it will see extraneous callback invocations. - * - *

In general, an auto-invoking event bridges the gap between the flexibility of an event with global reach, - * and the convenience of implementing an interface that gets detected automatically. - * - *

This is a documentation-only annotation, the event factory has to implement the functionality explicitly by checking the parameter type and invoking it. - * On top of adding this annotation, the event field or method should document which parameters are context parameters, - * and under which circumstances they are invoked. - */ -// TODO: explore enforcing that auto-invoked listeners don't register themselves. -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.FIELD, ElementType.METHOD }) -public @interface AutoInvokingEvent { -} diff --git a/src/main/java/net/fabricmc/fabric/impl/networking/NetworkingImpl.java b/src/main/java/net/fabricmc/fabric/impl/networking/NetworkingImpl.java index ceb6546..86a3cae 100644 --- a/src/main/java/net/fabricmc/fabric/impl/networking/NetworkingImpl.java +++ b/src/main/java/net/fabricmc/fabric/impl/networking/NetworkingImpl.java @@ -16,6 +16,7 @@ package net.fabricmc.fabric.impl.networking; +import net.neoforged.fml.loading.FMLLoader; import org.slf4j.Logger; import net.minecraft.util.Identifier; @@ -35,7 +36,7 @@ public final class NetworkingImpl { */ public static final boolean FORCE_PACKET_SERIALIZATION = Boolean.parseBoolean(System.getProperty( "fabric-api.networking.force-packet-serialization", - Boolean.toString(ForgedNetworkingAPI.isDevelopmentEnvironment()))); + Boolean.toString(!FMLLoader.isProduction()))); /** * Id of packet used to register supported channels. diff --git a/src/main/java/org/thinkingstudio/forged/networking/ForgedNetworkingAPI.java b/src/main/java/org/thinkingstudio/forged/networking/ForgedNetworkingAPI.java index 1396172..f391514 100644 --- a/src/main/java/org/thinkingstudio/forged/networking/ForgedNetworkingAPI.java +++ b/src/main/java/org/thinkingstudio/forged/networking/ForgedNetworkingAPI.java @@ -27,14 +27,14 @@ public ForgedNetworkingAPI() { ClientNetworkingImpl.clientInit(); } - if (ForgedNetworkingAPI.isDevelopmentEnvironment()) { + if (!FMLLoader.isProduction()) { NeoForge.EVENT_BUS.addListener(EventPriority.HIGHEST, RegisterCommandsEvent.class, event -> { if (SharedConstants.isDevelopment) { // Command is registered when isDevelopment is set. return; } - if (!ForgedNetworkingAPI.isDevelopmentEnvironment()) { + if (FMLLoader.isProduction()) { // Only register this command in a dev env return; } @@ -43,8 +43,4 @@ public ForgedNetworkingAPI() { }); } } - - public static boolean isDevelopmentEnvironment() { - return !FMLLoader.isProduction(); - } }