Update to 1.17.1-pre2

This commit is contained in:
NikitaCartes 2021-06-29 23:43:20 +03:00
parent 902afa91b8
commit 2d798cf9d1
No known key found for this signature in database
GPG Key ID: 3A5BAB26D767AA69
7 changed files with 22 additions and 40 deletions

View File

@ -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
}

View File

@ -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<Boolean> cir) {
PlayerEntity player = (PlayerEntity) (Object) this;
ActionResult result = AuthEventHandler.onDropItem(player);
if (result == ActionResult.FAIL) {
cir.setReturnValue(false);
}
}
}

View File

@ -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<Boolean> cir) {
ActionResult result = AuthEventHandler.onDropItem(player);
if (result == ActionResult.FAIL) {
cir.setReturnValue(false);
}
}
}

View File

@ -24,6 +24,7 @@ public abstract class MixinSlot {
player.networkHandler.sendPacket(
new ScreenHandlerSlotUpdateS2CPacket(
-2,
0,
player.getInventory().selectedSlot,
player.getInventory().getStack(player.getInventory().selectedSlot))
);

View File

@ -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 {

View File

@ -4,7 +4,6 @@
"compatibilityLevel": "JAVA_16",
"mixins": [
"MixinPlayerAdvancementTracker",
"MixinPlayerEntity",
"MixinPlayerManager",
"MixinServerLoginNetworkHandler",
"MixinServerPlayerEntity",

View File

@ -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