2024-12-10 17:46:53|Myriagame |source:minecraft skins
This tutorial is set by the author's setting without permission.
Since [qωq library] is not passed on a website like CurseForge or Modrinth, a better way to use this library is to quote from local.
Find DependenCies in your Build.gradle and add the following code:
Modimplementation Filetree (DIR: 'SRC/Main/Libs', Includes: ['*.jar']
And put the jar file you downloaded (both using the development version and the release) are placed under the SRC/main/Libs folder.
After re -construction, you should have found that QΩQ has been successfully introduced.
QΩQ provides a method of simple registration of objects such as items, as shown below:
Public Class iteminit {Public Static Final Registration
- items = new registry <> (registry.item, mod_id);
Public Static Final item exmple_item = items.register ("example_item", ()-> new item (new ittem.settings ()));
}
Objects such as blocks are similar to this.
Of course don't forget to add the following sentence to your main class:
@outerridepublic void oninitialize () {
Itminit.items.register ();
}
Of course, QΩQ also added a set of event subscription systems similar to Forge. If you want to subscribe to an event, you do this as follows:
@Modeventpublic class Oneventhandle {
@SubscripeEvent
Public Static Void Onevent (IEVENT EVENT) {
// Todo
}
// If the parameters are not equal to one, QΩQ will throw a warning and does not subscribe to this method
@SubscripeEvent
Public Static Void Onevent (IEVENT EVENT1, IEVENT EVENT2) {) {
// Todo
}
// The method of annotation of @SubscripeEvent is not added.
Public static void Onevent () {
// Todo
}
}
Please don't forget to check the client in the event. Of course, you should not use the @Envalonment () annotation, which may cause the program to go wrong!
Due to the problem of some mechanisms of QΩq, it cannot completely automatically subscribe to the event. You must tell the program, which folder you put in your event, like this:
@outerridepublic void oninitialize () {
Itminit.items.register ();
Eventloader.initevent ("org.abstruck.qwq.init.event");
}
Of course, if you put your events under the Std.init.event folder, you can need not tell the program where you store the event, because the QΩQ in the folder will automatically read.
Note, don't put the class with @mixin notes and put it under the subscribed folder, it will report an error!IntersectionIntersection
If you want to use an event, but you find that when QΩQ is not implemented, you can choose to add it yourself. The following example implements the afterbread event in Block:
// Remember to inherit the IEVENT interface!Public Class afterBreakevent Implements IEvent {
Private World World;
Private Playrence Player;
Private blockpos pos;
Private blockstate state;
Private blockity blockitity;
Private itemstack stack;
Public AfterBreakevent (World World, PlayEnceRENTITY PLAYER, Blockpos POS, BlockState State, @nullable Blockentity, ITEMSTACK Stack) { This.World = world;
This.Player = Player;
This.pos = pOS;
This.State = state;
This.blockntity = blockentity;
This.stack = stack;
}
Public PlayErenetity Getplayer () {
Return Player;
}
Public blockpos getpos () {
Return pos;
}
Public blockstate getState () {
Reutrn State;
}
Public world getwork () {Return world;
}
Public blockity getBlockntity () {
Return blockity;
}
Public itemstack getstack () {
Return Stack;
}
}
Of course, only adding this code cannot achieve new events. We have to use Mixin to complete this operation, as shown below:
@mixin (block.class)public Abstract class blockmixin {
@Inject (Method = "Afterbreak", at = @AT ("Return")
Public Void AfterBreak (World World, PlayErenTity Player, Blockpos POS, BlockState State, Blockentity Blockentity, Itemstack Stack, CallBackinfo Ci) {{{{{{{{{{{{{{{{{
Block self = (block) (object) this;
EventManager.OnEventAction (()-> New AfterBreakevent (World, Player, POS, State, Blockntity, Stack)););););;);
}
}
We like Mixin, but the less it, the better, right?
Like this, you can simply create a new event.
Of course, there is a simpler way to send this issue, and I will add all event requests in Issue as much as possible.
Q & A
Q: Why must QΩQ be telling the folder where the program event is located?
A: The principle of the QΩq subscription event is to scan all class files under a folder, but if scanned to a special class like @mixin, it will report strange errors. At present, there is no solution.
Q: There are too few events that QΩq comes with it. Can I put backsts?
A: Of course, very welcome.
Q: Can QΩq add xxx?
A: You can tell me in the comment area or issue
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