Update yarn to 1.17

This commit is contained in:
NikitaCartes 2021-06-23 19:20:21 +03:00
parent ee875275e7
commit 52e6740ad1
No known key found for this signature in database
GPG Key ID: 3A5BAB26D767AA69
8 changed files with 20 additions and 19 deletions

View File

@ -29,7 +29,7 @@ public class SimpleAuth {
/** /**
* HashMap of players that have joined the server. * HashMap of players that have joined the server.
* It's cleared on server stop in order to save some interactions with database during runtime. * It's cleared on server stop in order to save some interactions with database during runtime.
* Stores their data as {@link org.samo_lego.simpleauth.storage.PlayerCache PlayerCache} object. * Stores their data as {@link PlayerCache PlayerCache} object.
*/ */
public static final HashMap<String, PlayerCache> playerCacheMap = new HashMap<>(); public static final HashMap<String, PlayerCache> playerCacheMap = new HashMap<>();

View File

@ -145,7 +145,7 @@ public class AuthCommand {
} }
/** /**
* Sets {@link org.samo_lego.simpleauth.storage.AuthConfig.MainConfig.WorldSpawn global spawn}. * Sets {@link AuthConfig.MainConfig.WorldSpawn global spawn}.
* *
* @param source executioner of the command * @param source executioner of the command
* @param world world id of global spawn * @param world world id of global spawn

View File

@ -68,7 +68,7 @@ public abstract class MixinServerPlayNetworkHandler {
ActionResult result = AuthEventHandler.onPlayerMove(player); ActionResult result = AuthEventHandler.onPlayerMove(player);
if (result == ActionResult.FAIL) { if (result == ActionResult.FAIL) {
// A bit ugly, I know. (we need to update player position) // A bit ugly, I know. (we need to update player position)
player.networkHandler.requestTeleport(player.getX(), player.getY(), player.getZ(), player.yaw, player.pitch); player.networkHandler.requestTeleport(player.getX(), player.getY(), player.getZ(), player.getYaw(0), player.getPitch(0));
ci.cancel(); ci.cancel();
} }
} }

View File

@ -52,12 +52,12 @@ public class MixinServerPlayerEntity implements PlayerAuth {
// Saving position // Saving position
cache.lastLocation.dimension = player.getServerWorld(); cache.lastLocation.dimension = player.getServerWorld();
cache.lastLocation.position = player.getPos(); cache.lastLocation.position = player.getPos();
cache.lastLocation.yaw = player.yaw; cache.lastLocation.yaw = player.getYaw(0);
cache.lastLocation.pitch = player.pitch; cache.lastLocation.pitch = player.getPitch(0);
// Teleports player to spawn // Teleports player to spawn
player.teleport( player.teleport(
server.getWorld(RegistryKey.of(Registry.DIMENSION, new Identifier(config.worldSpawn.dimension))), server.getWorld(RegistryKey.of(Registry.WORLD_KEY, new Identifier(config.worldSpawn.dimension))),
config.worldSpawn.x, config.worldSpawn.x,
config.worldSpawn.y, config.worldSpawn.y,
config.worldSpawn.z, config.worldSpawn.z,

View File

@ -1,7 +1,7 @@
package org.samo_lego.simpleauth.mixin; package org.samo_lego.simpleauth.mixin;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.world.WorldSaveHandler; import net.minecraft.world.WorldSaveHandler;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -53,7 +53,7 @@ public class MixinWorldSaveHandler {
), ),
locals = LocalCapture.CAPTURE_FAILHARD locals = LocalCapture.CAPTURE_FAILHARD
) )
private void fileExists(PlayerEntity playerEntity, CallbackInfoReturnable<CompoundTag> cir, CompoundTag compoundTag, File file) { private void fileExists(PlayerEntity playerEntity, CallbackInfoReturnable<NbtCompound> cir, NbtCompound compoundTag, File file) {
// @ModifyVariable cannot capture locals // @ModifyVariable cannot capture locals
this.fileExists = file.exists(); this.fileExists = file.exists();
} }
@ -72,7 +72,7 @@ public class MixinWorldSaveHandler {
target = "Ljava/io/File;exists()Z" target = "Ljava/io/File;exists()Z"
) )
) )
private CompoundTag migratePlayerData(CompoundTag compoundTag, PlayerEntity player) { private NbtCompound migratePlayerData(NbtCompound compoundTag, PlayerEntity player) {
// Checking for offline player data only if online doesn't exist yet // Checking for offline player data only if online doesn't exist yet
String playername = player.getGameProfile().getName().toLowerCase(); String playername = player.getGameProfile().getName().toLowerCase();
if(config.main.premiumAutologin && mojangAccountNamesCache.contains(playername) && !this.fileExists) { if(config.main.premiumAutologin && mojangAccountNamesCache.contains(playername) && !this.fileExists) {

View File

@ -7,6 +7,7 @@ import com.google.gson.annotations.SerializedName;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import java.util.Objects; import java.util.Objects;
@ -64,7 +65,7 @@ public class PlayerCache {
public float pitch; public float pitch;
} }
public final PlayerCache.LastLocation lastLocation = new PlayerCache.LastLocation(); public final LastLocation lastLocation = new LastLocation();
private static final Gson gson = new GsonBuilder() private static final Gson gson = new GsonBuilder()
@ -94,10 +95,11 @@ public class PlayerCache {
// Setting position cache // Setting position cache
playerCache.lastLocation.dimension = player.getServerWorld(); playerCache.lastLocation.dimension = player.getServerWorld();
playerCache.lastLocation.position = player.getPos(); playerCache.lastLocation.position = player.getPos();
playerCache.lastLocation.yaw = player.yaw; playerCache.lastLocation.yaw = player.getYaw(0);
playerCache.lastLocation.pitch = player.pitch; playerCache.lastLocation.pitch = player.getPitch(0);
playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL); playerCache.wasInPortal = player.getServerWorld().getBlockState(player.getBlockPos()).getBlock().equals(Blocks.NETHER_PORTAL);
//playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL);
} }
return playerCache; return playerCache;

View File

@ -1,4 +1,3 @@
accessWidener v1 named accessWidener v1 named
accessible class net/minecraft/server/network/ServerLoginNetworkHandler$State accessible class net/minecraft/server/network/ServerLoginNetworkHandler$State
accessible field net/minecraft/entity/Entity yaw F

View File

@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric properties # Fabric properties
minecraft_version=21w10a minecraft_version=1.17
yarn_mappings=21w10a+build.1 yarn_mappings=1.17+build.13
loader_version=0.11.2 loader_version=0.11.6
#Fabric api #Fabric api
fabric_version=0.28.5+1.15 fabric_version=0.36.0+1.17
# Forge # Forge
forge_version=36.0.4 forge_version=36.0.4