2024-12-09 18:32:08|Myriagame |source:minecraft skins
hint
This tutorial is only suitable for Intellij IDEA.
Construction and operation of the project
First open the Idea plug -in page search plug -in Minecraft Development and install the Idea.
After restarting, first click on the new project and select the generator Minecraft, and then select the mod, forge, 1.18.1, of which use mixins are available, and the module Jian Shao, the author, the website, and the update address can be set in the advanced configuration.Others can be filled in freely.
Create and wait for construction. If the project construction fails or is too slow to build, you can use DevSidecar to accelerate the construction. After the construction is completed, it may report an error in com.mojang.logging.logutil and open the error file. At this timeThe content in the file is deleted into about the following:
Package cn.ksmcbrigade.em; // Packetimport network.minecraftForge.common.minecraftForge;
import network.minecraftForge.fml.Common.mod;
Import org.apache.logging.log4j.logmanager;
Import org.apache.logging.log4j.logger;
@Mod ("em") // mod ID
Public Class Examplemod {
Private static loger logger = logManager.getLogger (); // logger
Public examplemod () {// main
Minecraftforge.event_bus.register (this);
}
}
Then click Gradle on the right side of IDEA, then open Tasks in order, Forgegradle Runs, finally click Runclient to start the game.
Simple functional implementation
First register the player engraving event:
Package cn.ksmcbrigade.em; // Packetimport network.minecraftForge.common.minecraftForge;
import network.minecraftForge.event.tickevent;
import network.mineCraftforge.eventbus.api.Subscripevent;
import network.minecraftForge.fml.Common.mod;
Import org.apache.logging.log4j.logmanager;
Import org.apache.logging.log4j.logger;
@Mod ("em")
@Mod.eventbussubscriber // event bus
Public Class Examplemod {
Private static loger logger = logManager.getLogger (); // logger
Public examplemod () {// main
Minecraftforge.event_bus.register (this);
}
@SubscripeEvent
Public Void Playrtick (TICKEVENT.Playertickevent Event) {// Player Tick Event
}
}
Take the NOFALL function as an example. First of all, in the player's engraving event, determine whether the player's fall height is greater than or equal to 3.
@SubscripeEventPublic Void Playrtick (TICKEVENT.Playertickevent Event) {// Player Tick Event
If (event.player.FallDistance> = 3) {// if> = 3
ClientpacketListener connection = minecraft.getInstance (). GetConnection (); // Get Connection
If (connection! = Null) {// if! = NULL
Connection.getConnection (). Send (new serverboundmovepacket.statusonly (true)); // Send Pakcett
}
}
}
Finally run the Runclient again for the test whether it is successful.
The following is the complete code:
Package cn.ksmcbrigade.em; // Packetimport network.minecraft.client.minecraft;
import network.mineCraft.client.multiplayer.clientpacketListener;
import network.mineCraft.network.protocol.game.serverboundMoveplayerpacket;
import network.minecraftForge.common.minecraftForge;
Import network.mineCraftforge.event.tickevent; Import Network.mineCraftforge.eventbus.api.Subscripevent;
import network.minecraftForge.fml.Common.mod;
Import org.apache.logging.log4j.logmanager;
Import org.apache.logging.log4j.logger;
@Mod ("em") // mod ID
@Mod.eventbussubscriber // event bus
Public Class Examplemod {
Private static loger logger = logManager.getLogger (); // logger
Public examplemod () {// main
Minecraftforge.event_bus.register (this);
}
@SubscripeEvent
Public Void Playrtick (TICKEVENT.Playertickevent Event) {// Player Tick Event
If (event.player.FallDistance> = 3) {// if> = 3
ClientpacketListener connection = minecraft.getInstance (). GetConnection (); // Get Connection
If (connection! = Null) {// if! = NULL
Connection.getConnection (). Send (new serverboundmovepacket.statusonly (true)); // Send Pakcett
}
}
}
}
Other file description
mods.toml
#this is an exmple mods.toml file. It contains the data related to the loading mods. Datory), and Many More that are optional (#Optional).#The overall format is standard toml format, v0.5.0.
#Not that there are a couple of toml lists in this file.
#Find More Information on Toml Format Here: https://github.com/toml-lang/toml
#The name of the mod loader type to load-for regula FML @mod Mods It Should be javafml
modloader = "javafml" #Mandatic
#A version Range to Match for Said MOD MOD LOADER-For Regular FML @mod It will be the forge version
LoaderVersion = "$ {loader_version_range}" #Mandatic this is typically bumped every minecraft version by forge. SEE OUR Download Page for lists of versions.
#The License for You Mod. This is Mandatory Metadata and Allows for Easier Composition of Your Redistributive Properties.
#Review your options at https://choosealicedense.com/. All rights reserved is the default Copyright Stance, and is this the default here.li. element = "$ {mod_license}"
#The open source protocol used by the module
#A url to refer people to when proplems occur with this mod
#IssueTrackerurl = "https: //change.me.to.your.your.tracker.example.invalid/" #Optional
#A list of mods
[[MODS]] #Mandatic
#The modid of the mod
modid = "$ {mod_id}" #Mandatic
#Module ID
#The version number of the mod
version = "$ {mod_version}" #Mandatory
#Module version
#A display name for the mod
displayName = "$ {mod_name}" #Mandatic
#Module display name
#A url to query for updates for this mod. See the json update specification https://docs.mineCraftForge.net/en/Latesc/updateChecker/
#Updatejsonurl = "https: //change.me.example.invalid/updates.json" #Optional
#A url for the "HomePage" for this mod, displayed in the mod ui
#displayurl = "https://change.me.to.your.hlets.homepage.example.invalid/" #Optional
#A FILE name (in the root of the mod jar) containing a logo for display#logoFile = "em.png" #Optional
#Module detailed page display picture
#A text Field Displayed in the Mod UI
#credits = "Thanks for this exmple mod Goes to java" #Optional
#A text Field Displayed in the Mod UI
authors = "$ {mod_authors}" #Optional
#Module author
#The description text for the mod (Multi Line!) (#Mandatic)
description = '' '$ {mod_descripting}' '
#Module Jian Shao
#A Dependency-Use the. To Indicate Dependency for A Specific Modid. Dependencies are optional.
[[DependenCies. $ {mod_id}]] #Optional
#The Modid of the Dependency
modid = "Forge" #Mandatic
#DOES This Dependency Have to Exist
MANDATORY = TRUE #MANDARY
#The version range of the dependency
versionRange = "$ {Forge_Version_Range}" #Mandatic
#Forge version required for modules
#Loading order of module
#BeFore-Load in advance
#After-Last load
ordering = "None"
#SIDE This Dependency is Applied on-Both, Client, or Server
#Both server and client must add
#Client only needs the client. For example, the above Notall can only be implemented by only client.
#Server only requires the site = "client"#here's another dependency
[[DependenCies. $ {mod_id}]]
modid = "Minecraft"
MANDATORY = TRUE
#This version range deClares a Minimum of the Current Minecraft Version up to but not including the next major version
VersionRange = "$ {Minecraft_Version_RANGE}"
#The game version required for the module
ordering = "None"
Side = "Both"
modid.mixins.json
{{"Required": true,
"Minversion": "0.8",
"Package": "cn.ksmcBrigade.em.emin", // The directory containing the mixin file
"CompatibilityLevel": "java_8",, "java_8",
"Refmap": "modid.refmap.json", // The modid in the file name here is changed to your modid.
"Mixins": [// Mixin to be loaded in both end.
],,,
"Client": [// only Mixin that needs to be loaded on the client.
],,,
"Injectors": {
"DefaultRequire": 1
}
}
National Service DNF Dark Ni
2025-01-28 09:19:27The new screenshot of the be
2025-01-28 09:18:57The 15th anniversary wallpap
2025-01-28 09:18:273DM Xuanyuan Sinicization Gr
2025-01-28 09:17:57French magazine is the first
2025-01-28 09:17:27The sneak game "Republic" wi
2025-01-28 09:16:57The story between humans and
2025-01-28 09:16:27Capture "Trinity 3: Artifact
2025-01-28 09:15:27Wind direction change "Myste
2025-01-28 09:14:57DICE's new project "Dream" w
2025-01-28 09:14:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:26Master Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25King Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25Guide Minecraft Skins
Minecraft Skins
2024-12-10 04:11:24Dark Knight Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Sparta Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Moncraft Skins of the War
Minecraft Skins
2024-12-10 04:11:22Red Witch Minecraft Skins
Minecraft Skins
2024-12-10 04:11:22Golden Cavaliers Minecraft S
Minecraft Skins
2024-12-10 04:11:22