Coder Social home page Coder Social logo

common-networking's Introduction

Common Networking:

This library mod aims to unify networking and packet registration between mod loaders so that Developers using Jared's MultiLoader Template only need to deal with networking in the common module. But, it is not limited to only usage with MultiLoader. This can be used in other projects as well.

This also allows your mod to be loader agnostic. The way packets are built and constructed, Forge version of the mod on the client, can talk to the Fabric version on the server. Though you will need to create your own handshake packet.

Downloads:

Add to project:

repositories {
    maven {
        url = "https://jm.gserv.me/repository/maven-public/"
    }
}
Fabric:
dependencies {
    modImplementation 'mysticdrew:common-networking-fabric:1.0.8-1.20.1'
}
Forge:
dependencies {
    implementation fg.deobf('mysticdrew:common-networking-forge:1.0.8-1.20.1')
}
NeoForge:
dependencies {
    implementation fg.deobf('mysticdrew:common-networking-neoforge:1.0.8-1.20.1')
}
Common:
dependencies {
    implementation 'mysticdrew:common-networking-common:1.0.8-1.20.1'
}

How to Use:

Using the mod is quite simple.

Register your packets anytime during startup in your Common Mod Class and/or your Common Client Mod Class.

See Packet Registration Class the example uses a class with an init method. This is not required.

Creating packets are very similar to how you would do it in Forge or Fabric already, see ExamplePacketOne.

Sending a packet can either use the Dispatcher for static calls or by getting the NetworkHandler from the Network Class.

Contributing:

Pull Requests are welcome and encouraged.

Working with the Source

  • IntelliJ IDEA
  • OpenJDK 1.17

1. Setup Common Networking with MultiLoader Template for IntelliJ IDEA

IntelliJ IDEA

Common Networking uses the MultiLoader Template for combining sources of Fabric and Forge.

  1. If your default JVM/JDK is not Java 17 you will encounter an error when opening the project. This error is fixed by going to File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVMand changing the value to a valid Java 17 JVM. You will also need to set the Project SDK to Java 17. This can be done by going to File > Project Structure > Project SDK. Once both have been set open the Gradle tab in IDEA and click the refresh button to reload the project.
  2. Open the Gradle tab in IDEA if it has not already been opened. Navigate to Your Project > Common > Tasks > vanilla gradle > decompile. Run this task to decompile Minecraft.
  3. Open the Gradle tab in IDEA if it has not already been opened. Navigate to Your Project > Forge > Tasks > forgegradle runs > genIntellijRuns. Run this task to set up run configurations for Forge.
  4. Open your Run/Debug Configurations. Under the Application category there should now be options to run Forge and Fabric projects. Select one of the client options and try to run it.
  5. Assuming you were able to run the game in step 7 your workspace should now be set up.

common-networking's People

Contributors

mysticdrew avatar ricksouth avatar thatgravyboat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

common-networking's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.