diff --git a/build.gradle b/build.gradle index bdb0d7e..53c47fe 100644 --- a/build.gradle +++ b/build.gradle @@ -10,8 +10,8 @@ buildscript { plugins { - id "architectury-plugin" version "3.1-SNAPSHOT" - id "dev.architectury.loom" version "0.8.0-SNAPSHOT" apply false + id "architectury-plugin" version "3.2.112" + id "dev.architectury.loom" version "0.9.0.131" apply false } @@ -37,13 +37,7 @@ allprojects { group = rootProject.maven_group tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - - // Minecraft 1.17 (21w19a) upwards uses Java 16. it.options.release = 8 } diff --git a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java deleted file mode 100644 index cb1d1a7..0000000 --- a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.samo_lego.simpleauth.mixin; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ActionResult; -import org.samo_lego.simpleauth.event.AuthEventHandler; -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.CallbackInfoReturnable; - -@Mixin(PlayerEntity.class) -public class MixinPlayerEntity { - - - // Player item dropping - @Inject(method = "dropSelectedItem(Z)Z", at = @At("HEAD"), cancellable = true) - private void dropSelectedItem(boolean dropEntireStack, CallbackInfoReturnable cir) { - PlayerEntity player = (PlayerEntity) (Object) this; - ActionResult result = AuthEventHandler.onDropItem(player); - - if (result == ActionResult.FAIL) { - cir.setReturnValue(false); - } - } -} \ No newline at end of file diff --git a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java index f9758a3..7dfd3a2 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java +++ b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinServerPlayerEntity.java @@ -5,11 +5,13 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.World; +import org.samo_lego.simpleauth.event.AuthEventHandler; import org.samo_lego.simpleauth.storage.PlayerCache; import org.samo_lego.simpleauth.utils.PlatformSpecific; import org.samo_lego.simpleauth.utils.PlayerAuth; @@ -20,6 +22,7 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import static org.samo_lego.simpleauth.SimpleAuth.*; import static org.samo_lego.simpleauth.utils.SimpleLogger.logInfo; @@ -198,4 +201,14 @@ public class MixinServerPlayerEntity implements PlayerAuth { ci.cancel(); } } + + // Player item dropping + @Inject(method = "dropSelectedItem(Z)Z", at = @At("HEAD"), cancellable = true) + private void dropSelectedItem(boolean dropEntireStack, CallbackInfoReturnable cir) { + ActionResult result = AuthEventHandler.onDropItem(player); + + if (result == ActionResult.FAIL) { + cir.setReturnValue(false); + } + } } \ No newline at end of file diff --git a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java index 7c47c6f..b781d5b 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java +++ b/common/src/main/java/org/samo_lego/simpleauth/mixin/MixinSlot.java @@ -24,6 +24,7 @@ public abstract class MixinSlot { player.networkHandler.sendPacket( new ScreenHandlerSlotUpdateS2CPacket( -2, + 0, player.getInventory().selectedSlot, player.getInventory().getStack(player.getInventory().selectedSlot)) ); diff --git a/common/src/main/java/org/samo_lego/simpleauth/utils/PlatformSpecific.java b/common/src/main/java/org/samo_lego/simpleauth/utils/PlatformSpecific.java index e2804bf..9eaca34 100644 --- a/common/src/main/java/org/samo_lego/simpleauth/utils/PlatformSpecific.java +++ b/common/src/main/java/org/samo_lego/simpleauth/utils/PlatformSpecific.java @@ -1,6 +1,6 @@ package org.samo_lego.simpleauth.utils; -import me.shedaniel.architectury.annotations.ExpectPlatform; +import me.shedaniel.architectury.ExpectPlatform; import net.minecraft.entity.player.PlayerEntity; public class PlatformSpecific { diff --git a/common/src/main/resources/mixins.simpleauth.json b/common/src/main/resources/mixins.simpleauth.json index 1e15509..93c575d 100644 --- a/common/src/main/resources/mixins.simpleauth.json +++ b/common/src/main/resources/mixins.simpleauth.json @@ -4,7 +4,6 @@ "compatibilityLevel": "JAVA_16", "mixins": [ "MixinPlayerAdvancementTracker", - "MixinPlayerEntity", "MixinPlayerManager", "MixinServerLoginNetworkHandler", "MixinServerPlayerEntity", diff --git a/gradle.properties b/gradle.properties index 0952a70..e7dd379 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,8 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties -minecraft_version=1.17 -yarn_mappings=1.17+build.13 +minecraft_version=1.17.1-pre2 +yarn_mappings=1.17.1-pre2+build.1 loader_version=0.11.6 #Fabric api @@ -13,10 +13,10 @@ fabric_version=0.36.0+1.17 forge_version=36.0.4 # Architectury -architectury_version=1.5.101 +architectury_version=1.14.156 # Mod Properties -mod_version = 1.8.2 +mod_version = 1.8.3 maven_group = org.samo_lego archives_base_name = simpleauth @@ -27,5 +27,5 @@ bytes_version = 1.3.0 # Carpet for debugging -carpet_core_version = 1.4.16+v201105 +carpet_core_version = 1.4.40+v210608 carpet_branch = master