From 80fe25bcb811508a5fe826c37513a8a63239cb55 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 19 Jun 2021 20:41:15 -0400 Subject: [Release] version 2.0.0 --- build.gradle | 31 +++++----- gradle.properties | 10 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/net/cshift/transit/network/Channel.java | 8 +-- .../java/net/cshift/transit/network/INode.java | 9 ++- .../net/cshift/transit/network/PoolManifest.java | 16 ++++-- .../net/cshift/transit/type/group/TypeGroup.java | 66 +--------------------- src/main/resources/fabric.mod.json | 4 +- 8 files changed, 45 insertions(+), 101 deletions(-) diff --git a/build.gradle b/build.gradle index 62083f9..f807b77 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,23 @@ plugins { - id 'fabric-loom' version '0.5-SNAPSHOT' + id 'fabric-loom' version '0.8-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_16 +targetCompatibility = JavaVersion.VERSION_16 archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" @@ -38,13 +46,8 @@ tasks.withType(JavaCompile).configureEach { // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too - // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. - // We'll use that if it's available, but otherwise we'll use the older option. - def targetVersion = 8 - if (JavaVersion.current().isJava9Compatible()) { - it.options.release = targetVersion - } + // Minecraft 1.17 (21w19a) upwards uses Java 16. + it.options.release = 16 } java { @@ -74,9 +77,11 @@ publishing { } } - // Select the repositories you want to publish to - // To publish to maven local, no extra repositories are necessary. Just use the task `publishToMavenLocal`. + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. } } diff --git a/gradle.properties b/gradle.properties index 66a855f..04fba21 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.16.4 - yarn_mappings=1.16.4+build.6 - loader_version=0.10.6+build.214 + minecraft_version=1.17 + yarn_mappings=1.17+build.1 + loader_version=0.11.3 # Mod Properties - mod_version = 2.0.0-alpha.predev.2 + mod_version = 2.0.0 maven_group = net.corechg archives_base_name = transit-api # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.25.1+build.416-1.16 + fabric_version=0.34.9+1.17 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index da9702f..0f80bbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/net/cshift/transit/network/Channel.java b/src/main/java/net/cshift/transit/network/Channel.java index c7be552..e5c64da 100644 --- a/src/main/java/net/cshift/transit/network/Channel.java +++ b/src/main/java/net/cshift/transit/network/Channel.java @@ -109,12 +109,10 @@ public final class Channel { /** Send a packet to the recieving node * * @param packet the packet to send - * @return {@code true} if the recieving node accepts the packet + * @return The overflow data if the packet is only partially accepted. {@code null} otherwise. */ - public boolean send(IStaticPacket packet) + public IStaticPacket send(IStaticPacket packet) { - if(!this.isTerminated()) - return to.accept(packet, this); - return false; + return to.accept(packet, this); } } diff --git a/src/main/java/net/cshift/transit/network/INode.java b/src/main/java/net/cshift/transit/network/INode.java index 8f74dd6..7cbb1cc 100644 --- a/src/main/java/net/cshift/transit/network/INode.java +++ b/src/main/java/net/cshift/transit/network/INode.java @@ -8,14 +8,13 @@ import net.cshift.transit.network.packet.*; */ public interface INode { - /** Returns a channel manifest for the INode + /** Returns a pool manifest for the INode * */ public PoolManifest getManifest(); /** Get the system managing the node or {@code null} if there isn't one * - * @return System */ public ISystem getSystem(); @@ -28,7 +27,7 @@ public interface INode /** Call this function to establish a connection with a node. * * @param The type of connection being asked for - * @param group The group of connection being asked for + * @param poolID The ID of the pool the channel will interface with (see PoolManifest) * @param asker The asking node * @return A channel if the node accepts the request, {@code null} otherwise */ @@ -40,9 +39,9 @@ public interface INode * @param The type of the packet and channel * @param packet The packet to be vetted * @param channel The channel which the packet is coming through - * @return true if the node accepts the packet + * @return The overflow data if the packet is only partially accepted. {@code null} otherwise. */ - public boolean accept(IStaticPacket packet, Channel channel); + public IStaticPacket accept(IStaticPacket packet, Channel channel); /** Pressure * diff --git a/src/main/java/net/cshift/transit/network/PoolManifest.java b/src/main/java/net/cshift/transit/network/PoolManifest.java index d6bec43..e23d47f 100644 --- a/src/main/java/net/cshift/transit/network/PoolManifest.java +++ b/src/main/java/net/cshift/transit/network/PoolManifest.java @@ -2,35 +2,39 @@ package net.cshift.transit.network; /** * @author Kyle Gunger - * @apiNote A channel manifest represents a set of possible data/resource pools that another node can request a channel to. + * @apiNote A pool manifest represents a set of possible data/resource pools that another node can request a channel to. */ -public interface PoolManifest { +public abstract class PoolManifest { /** Represents the number of pools that the node has access to for the specified resource. * @apiNote A "pool" in this context represents an independant network of resources. * Pool zero should be the default group that simple nodes will attempt to connect to. * @param group The TypeGroup that the pool belongs to */ - public int poolCount(String group); + public abstract int poolCount(String group); /** The ID of the pool. The INode will use this in a connection attempt with the other INode. * * @param group The TypeGroup the pool belongs to * @param pool Array-like index for pool (gotten from poolCount) */ - public int poolID(String group, int pool); + public abstract int poolID(String group, int pool); /** If the mod supports named pools, the names can be querried through this function. * * @param group The TypeGroup the pool belongs to * @param pool Array-like index for pool (gotten from poolCount) */ - public String poolName(String group, int pool); + public String poolName(String group, int pool) { + return ""; + } /** If the mod supports pool descriptions, they can be accessed by this method. * * @param group The TypeGroup the pool belongs to * @param pool Array-like index for pool (gotten from poolCount) */ - public String poolDescription(String group, int pool); + public String poolDescription(String group, int pool) { + return ""; + } } diff --git a/src/main/java/net/cshift/transit/type/group/TypeGroup.java b/src/main/java/net/cshift/transit/type/group/TypeGroup.java index d120cba..214f28c 100644 --- a/src/main/java/net/cshift/transit/type/group/TypeGroup.java +++ b/src/main/java/net/cshift/transit/type/group/TypeGroup.java @@ -5,14 +5,13 @@ import java.util.ArrayList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import net.cshift.transit.network.packet.*; import net.cshift.transit.type.Type; /** * @author Kyle Gunger * @param The base object which all grouped Types should convert between. */ -public class TypeGroup +public final class TypeGroup { // The base Type (provides the group's identifier) private Type baseType; @@ -181,68 +180,7 @@ public class TypeGroup } - // Type conversion - - /** Actually convert the packet - * - * @param packet - * @param type - * @return - */ - @Deprecated - protected IStaticPacket convertPacketRaw(IStaticPacket packet, Type type) - { - return type.packetFromBase(packet.getType().toBase(packet.getData())); - } - - /**Convert a packet to a new type Returns null if the type isn't in the group. - * - * @param packet The packet to convert - * @param type The type to convert to - * @return Packet - */ - @Deprecated - public IStaticPacket convertPacket(IStaticPacket packet, Type type) - { - return type.convertFrom(packet, this.getGroup()); - } - - /**Convert a packet to a new type Returns null if the type isn't found. - * - * @param packet The packet to convert - * @param groupID The groupID of the Type to convert to - * @param typeID The typeID of the Type to convert to - * @return Packet - */ - @Deprecated - public IStaticPacket convertPacket(IStaticPacket packet, String groupID, String typeID) - { - Type toType = getType(groupID, typeID); - if(toType != null) - { - return toType.convertFrom(packet, this.getGroup()); - } - - return null; - } - - /**Convert a packet to a new type. Returns null if the type isn't found. - * - * @param packet The packet to convert - * @param typeID The typeID of the Type to convert to - * @return Packet - */ - @Deprecated - public IStaticPacket convertPacket(IStaticPacket packet, String typeID) - { - Type toType = getType(typeID); - if(toType != null) - { - return toType.convertFrom(packet, this.getGroup()); - } - - return null; - } + // DO ALL TYPE CONVERSION USING TYPES. /** The group identifier. Given by the Base Group * @return String diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 913c80c..9768c22 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "transit-api", - "version": "2.0.0-alpha.predev.2", + "version": "2.0.0", "name": "Transit API", "description": "Move things about!", @@ -26,6 +26,6 @@ "depends": { "fabricloader": ">=0.7.4", - "minecraft": "1.16.x" + "minecraft": "1.17.x" } } -- cgit v1.2.3