
- How to get into minecraft plugin coding mod#
- How to get into minecraft plugin coding mods#
- How to get into minecraft plugin coding code#
We don't have a way to tell the compiler that this method is being executed inside of another type of class, so we can use this trick: The problem comes when the compiler yells at us because it thinks that we're an instance of SwitchPlayerEntityMixin. We can take advantage of that and simply use this to access the instance properties and methods. We must first remember that the onDamage method is inside of a PlayerEntity instance.
How to get into minecraft plugin coding mod#
Right now, the mod is just printing a line every time a player gets hurt, our next objective is accessing the player instance. The last parameter, info is required by the Mixin framework.īoth the source and amount are parameters that the original damage method receives, and that's the reason we can just use them in our method. Also, we are going to need the damage source and the amount of damage inflicted. Take a look to the mixin code, our purpose was to get the method onDamage executed at the end of the method damage, that's why we are using the string RETURN instead of HEAD. Just like in the GIF, you should be able to see a new line pop up in the console every time the player gets hurt, and that means we can continue to the explanation of what is going on. gradlew runClient in the console, launch a Minecraft world in creative mode, grab some instant damage potions and try to get hurt. Let's go through the following steps:Įnter fullscreen mode Exit fullscreen mode Nevertheless, you can use whatever editor you like for this guide, as most of the steps will be performed in the CLI.įor this guide, we will be using a starter to move quickly into actually building our first mod.
How to get into minecraft plugin coding code#
Last but not least, we need to pick a code editor, in this case, I chose Visual Studio Code because it's my favorite editor. To be more specific, we need the JDK 8 to be able to compile our mod. Minecraft uses Java and so does Fabric, which means we also need to have the Java Development Kit or JDK installed.
How to get into minecraft plugin coding mods#
Multiple tools help you build Minecraft mods, and I chose Fabric because one of the mods that I usually play with was built with it. Just like in Minecraft, we need some tools but in this case, they will help us in the creation process of our first mod. All I can say is that I love their content, and it's awesome to see what you can accomplish with the power of code.Ī few days later, I had an idea to develop a Minecraft mod and thought Why not? It will be fun! Basically, they build their own plugins to change the rules of the game and then they record themselves attempting to beat the modified game. Right now, there's a bunch of people recording and uploading Minecraft videos to YouTube, but these two found a way to make their content different. That video was really fun and got me to explore more of their content. A few weeks ago, YouTube recommended me a Minecraft video from Dream's Channel in which he was trying to beat the game while his friend George attempted to stop him.
