Giter Site home page Giter Site logo

mixin-tutorial's Introduction

this tutorial is no longer being maintained!

for a more up-to-date and in-depth tutorial, check out my new tutorial!

thanks for all the support!

Mixin Tutorial - INTELLJI

I haven't seen any decent mixin tutorials, so here's one.

Topics

  • Setting up your first mixin project
  • Creating your first mixin

Setup

Create a new folder where ever you want your client to be. Example Client

Open up IntelliJ. Then click New Project > Gradle > Next. Set the Location to the folder you just created EC INTELLIJ

Copy and paste the build.gradle into your build.gradle. EC INTELLIJ 2

Then click the "Load Gradle Changes" Button on the top right. refresh button

You might be noticing an error popping up in the bottom half, that's totally normal. It's because forgegradle doesn't support newer versions of gradle.

Screen Shot 2021-07-21 at 1 52 50 AM

To fix this, go to gradle > wrapper > gradle-wrapper.properties then replace whatever version is currently there, with 4.7

Screen.Recording.2021-07-21.at.1.55.02.AM.mov

Now for the lengthy part. Replace all the "example" strings with your client name. Also replace the "net" packages with whatever fits you. An example is shown below.

! This MUST be done for all instances. DO NOT CHANGE ANY OF THE "mixin" OR "mixins" strings !

Once you are done, click the gradle button on the far right. Then click Tasks > forgegradle > setupDecompWorkspace. This will take some time. Screen Shot 2021-07-21 at 2 09 49 AM

Once that process is finished, click Tasks > forgegradle > genIntellijRuns Screen Shot 2021-07-21 at 2 10 32 AM

Click the button at the top then click Minecraft Client An example is shown below.

Screen.Recording.2021-07-21.at.2.14.01.AM.mov

Click the same button again, then click Edit Configurations. You will see an error saying "Class 'GradleStart not found in module 'ExampleClient'". To fix this, set the Client to Client.main.

Screen.Recording.2021-07-21.at.2.20.45.AM.mov

Click Apply. The error should be gone now.

Tweaker

Create a new package in src/main/java with the package name you've set in your build.gradle in this case, it would be net.example

Create a new package named mixins inside the previous pacakge then create a new java file with whatever you named your tweaker. In this case, it's ExampleTweaker.

Copy the code from this tweaker to yours.

Replace the example at Mixins.addConfiguration("mixins.example.json"); (inside your tweaker) with your client name or whatever you named your package.

So far, your project should look something like this:

Screen Shot 2021-07-21 at 2 28 07 AM

Mixin Time!

Now it's time to make your first mixin!

Create a new file named whatever was inside your Mixins.addConfiguration("mixins.example.json"); inside the resource folder.

Screen Shot 2021-07-21 at 2 36 44 AM

Then, copy the json from here into the json file you just created.

Ok, now it's time to create an actual mixin.

Create a package named client inside the package where your tweaker is located.

Then, inside that client package, create a java file named MixinMinecraft

Screen Shot 2021-07-21 at 2 39 38 AM

then add this mixin code:

@Mixin(Minecraft.class)
public class MixinMinecraft {
    @Inject(method = "createDisplay", at = @At("RETURN"))
    public void createDisplay(CallbackInfo callbackInfo) {
        Display.setTitle("Example Client | 1.8.9");
    }
}

Congrats! You've made a mixin client for 1.8.9! For more guidance, join the spongepowered discord and check out this cheatsheet

Having issues? Feel free to contact me on discord (ddozzi#6190), the code is also available here

mixin-tutorial's People

Contributors

ddozzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mixin-tutorial'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.