2021-05-21 18:18:32 +02:00
|
|
|
package net.saltymc.eaa.mixin;
|
2021-05-20 22:26:46 +02:00
|
|
|
|
2021-05-21 22:51:30 +02:00
|
|
|
import net.minecraft.client.network.ClientPlayerEntity;
|
2021-05-22 12:48:12 +02:00
|
|
|
import net.saltymc.eaa.EaaMod;
|
|
|
|
import net.saltymc.eaa.handler.CommandHandler;
|
|
|
|
import net.saltymc.eaa.util.ResponseEntity;
|
2021-05-22 15:46:39 +02:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2021-05-20 22:26:46 +02:00
|
|
|
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;
|
2021-05-21 22:51:30 +02:00
|
|
|
/*
|
2021-05-20 22:26:46 +02:00
|
|
|
@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!");
|
|
|
|
}
|
|
|
|
}
|
2021-05-21 22:51:30 +02:00
|
|
|
*/
|
|
|
|
@Mixin(ClientPlayerEntity.class)
|
2021-05-22 15:46:39 +02:00
|
|
|
public class ExampleMixin { //ClientPlayerEntityMixin
|
2021-05-22 12:48:12 +02:00
|
|
|
|
2021-05-22 15:46:39 +02:00
|
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
2021-05-22 12:48:12 +02:00
|
|
|
|
2021-05-21 22:51:30 +02:00
|
|
|
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
|
|
|
|
private void onSendChatMessage(String message, CallbackInfo info) {
|
2021-05-22 15:46:39 +02:00
|
|
|
ResponseEntity responseEntity = EaaMod.getInstance().onEvent(message);
|
2021-05-22 12:48:12 +02:00
|
|
|
|
|
|
|
if (responseEntity.isInterceptEvent())
|
2021-05-21 22:51:30 +02:00
|
|
|
info.cancel();
|
2021-05-22 12:48:12 +02:00
|
|
|
|
2021-05-21 22:51:30 +02:00
|
|
|
}
|
|
|
|
}
|