This commit is contained in:
samolego 2021-03-04 19:37:27 +01:00
parent 2b582c004e
commit 9095056da2
5 changed files with 13 additions and 12 deletions

View File

@ -35,5 +35,5 @@ dependencies {
} }
architectury { architectury {
common() common(false)
} }

View File

@ -3,6 +3,7 @@ package org.samo_lego.simpleauth.mixin;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.server.filter.TextStream;
import net.minecraft.server.network.ServerPlayNetworkHandler; import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
@ -21,7 +22,7 @@ public abstract class MixinServerPlayNetworkHandler {
public ServerPlayerEntity player; public ServerPlayerEntity player;
@Inject( @Inject(
method = "method_31286(Ljava/lang/String;)V", method = "method_31286(Lnet/minecraft/server/filter/TextStream$Message;)V",
at = @At( at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V", target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateLastActionTime()V",
@ -29,8 +30,8 @@ public abstract class MixinServerPlayNetworkHandler {
), ),
cancellable = true cancellable = true
) )
private void onPlayerChat(String message, CallbackInfo ci) { private void onPlayerChat(TextStream.Message message, CallbackInfo ci) {
ActionResult result = AuthEventHandler.onPlayerChat(this.player, message); ActionResult result = AuthEventHandler.onPlayerChat(this.player, message.getFiltered());
if (result == ActionResult.FAIL) { if (result == ActionResult.FAIL) {
ci.cancel(); ci.cancel();
} }

View File

@ -24,10 +24,10 @@ public abstract class MixinSlot {
player.networkHandler.sendPacket( player.networkHandler.sendPacket(
new ScreenHandlerSlotUpdateS2CPacket( new ScreenHandlerSlotUpdateS2CPacket(
-2, -2,
player.inventory.selectedSlot, player.getInventory().selectedSlot,
player.inventory.getStack(player.inventory.selectedSlot)) player.getInventory().getStack(player.getInventory().selectedSlot))
); );
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.inventory.getCursorStack())); player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.getInventory().getCursorStack()));
cir.setReturnValue(false); cir.setReturnValue(false);
} }
} }

View File

@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric properties # Fabric properties
minecraft_version=1.16.5 minecraft_version=21w08b
yarn_mappings=1.16.5+build.3 yarn_mappings=21w08b+build.18
loader_version=0.11.1 loader_version=0.11.2
#Fabric api #Fabric api
fabric_version=0.29.4+1.16 fabric_version=0.31.2+1.17
# Forge # Forge
forge_version=36.0.4 forge_version=36.0.4

View File

@ -13,6 +13,6 @@ pluginManagement {
include("common") include("common")
include("fabric") include("fabric")
include("forge") //include("forge")
rootProject.name = "simpleauth" rootProject.name = "simpleauth"