This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: ServerPlayerEntitySendMessageEvent use mixin instead of fml…
…coremod
- Loading branch information
1 parent
6ad4699
commit d2b852f
Showing
3 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/org/auioc/mods/ahutils/mixin/server/MixinServerPlayerEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.auioc.mods.ahutils.mixin.server; | ||
|
||
import java.util.UUID; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import net.minecraft.entity.player.ServerPlayerEntity; | ||
import net.minecraft.util.text.ChatType; | ||
import net.minecraft.util.text.ITextComponent; | ||
|
||
@Mixin(value = ServerPlayerEntity.class) | ||
public abstract class MixinServerPlayerEntity { | ||
|
||
// @org.spongepowered.asm.mixin.Debug(export = true, print = true) | ||
@Inject( | ||
method = "Lnet/minecraft/entity/player/ServerPlayerEntity;sendMessage(Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/util/text/ChatType;Ljava/util/UUID;)V", | ||
at = @At(value = "HEAD"), | ||
require = 1, | ||
cancellable = true, | ||
remap = false | ||
) | ||
private void onSendMessage(ITextComponent p_241151_1_, ChatType p_241151_2_, UUID p_241151_3_, CallbackInfo ci) { | ||
if (org.auioc.mods.ahutils.server.event.ServerEventRegistry.postServerPlayerEntitySendMessageEvent(p_241151_1_, p_241151_2_, p_241151_3_)) { | ||
ci.cancel(); | ||
return; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{ | ||
"ahutils.CheckPushableEvent": "coremods/ahutils/CheckPushableEvent.js", | ||
"ahutils.ServerPlayerSendMessageEvent": "coremods/ahutils/ServerPlayerSendMessageEvent.js" | ||
"ahutils.CheckPushableEvent": "coremods/ahutils/CheckPushableEvent.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters