From 52687dac549545b4fcc34ad3817d30b5f94c0702 Mon Sep 17 00:00:00 2001 From: samo_lego <34912839+samolego@users.noreply.github.com> Date: Tue, 10 Mar 2020 15:15:57 +0100 Subject: [PATCH] Updating looom and yarn --- build.gradle | 8 ++++---- gradle.properties | 8 ++++---- .../org/samo_lego/simpleauth/event/AuthEventHandler.java | 3 ++- .../org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java | 7 +------ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 5e1ea45..f668d81 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.2.5-SNAPSHOT' + id 'fabric-loom' version '0.2.6-SNAPSHOT' id 'maven-publish' } @@ -16,11 +16,11 @@ minecraft { dependencies { //to change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}" - modCompile "net.fabricmc:fabric-loader:${project.loader_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API. This is technically optional, but you probably want it anyway. - modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" // Argon2 library for password hashing implementation 'de.mkammerer:argon2-jvm:2.6' diff --git a/gradle.properties b/gradle.properties index fb2aa9e..55147d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,12 +2,12 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties -minecraft_version=20w08a -yarn_mappings=20w08a+build.2 -loader_version=0.7.8+build.184 +minecraft_version=20w10a +yarn_mappings=20w10a+build.16 +loader_version=0.7.8+build.187 #Fabric api -fabric_version=0.4.33+build.299-1.16 +fabric_version=0.5.1+build.305-1.16 # Mod Properties mod_version = 1.2.0 diff --git a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java index b08fea6..502c6de 100644 --- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -32,7 +32,8 @@ public class AuthEventHandler { SimpleAuth.deauthenticatedUsers.add(player); /*CompoundTag loginTries = new CompoundTag(); loginTries.putInt("loginTries", 0); - player.saveToTag(loginTries);*/ + player.saveToTag(loginTries); + player.writeCustomDataToTag(loginTries);*/ // Player not authenticated // If clause actually not needed, since we add player to deauthenticated hashset above if (!SimpleAuth.isAuthenticated(player)) { diff --git a/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java b/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java index f3f0bcc..c571b28 100644 --- a/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java +++ b/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.java @@ -1,15 +1,12 @@ package org.samo_lego.simpleauth.mixin; -import net.minecraft.container.PlayerContainer; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.ActionResult; import org.samo_lego.simpleauth.event.item.DropItemCallback; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -17,8 +14,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(PlayerEntity.class) public abstract class MixinPlayerEntity { - @Shadow @Final public PlayerContainer playerContainer; - // Thanks to PR https://github.com/FabricMC/fabric/pull/260 and AbusedLib https://github.com/abused/AbusedLib @Inject(method = "dropItem(Lnet/minecraft/item/ItemStack;ZZ)Lnet/minecraft/entity/ItemEntity;", at = @At("INVOKE"), cancellable = true) private void dropItem(ItemStack stack, boolean dropAtFeet, boolean saveThrower, CallbackInfoReturnable cir) { @@ -28,7 +23,7 @@ public abstract class MixinPlayerEntity { if (result == ActionResult.FAIL) { // Canceling the item drop, as well as giving the items back to player (and updating inv with packet) player.giveItemStack(stack); - playerContainer.sendContentUpdates(); + player.inventory.updateItems(); cir.cancel(); } }