38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package net.saltymc.eaa.mixin;
|
|
|
|
import net.minecraft.client.network.ClientPlayerEntity;
|
|
import net.saltymc.eaa.EaaMod;
|
|
import net.saltymc.eaa.handler.CommandHandler;
|
|
import net.saltymc.eaa.util.ResponseEntity;
|
|
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;
|
|
/*
|
|
@Mixin(TitleScreen.class)
|
|
public class ExampleMixin {
|
|
@Inject(at = @At("HEAD"), method = "init()V")
|
|
private void init(CallbackInfo info) {
|
|
System.out.println("This line is printed by an example mod mixin!");
|
|
}
|
|
}
|
|
*/
|
|
@Mixin(ClientPlayerEntity.class)
|
|
public class ExampleMixin extends MixinInterface { //ClientPlayerEntityMixin
|
|
|
|
public ExampleMixin(final EaaMod eaaMod){
|
|
super(eaaMod);
|
|
}
|
|
|
|
|
|
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
|
|
private void onSendChatMessage(String message, CallbackInfo info) {
|
|
System.out.println("in onSendChatMessage");
|
|
|
|
ResponseEntity responseEntity = eaaMod.onEvent(message);
|
|
|
|
if (responseEntity.isInterceptEvent())
|
|
info.cancel();
|
|
|
|
}
|
|
} |