It's working on 1.17 version but it use 21w10a mapping

This commit is contained in:
NikitaCartes 2021-06-23 20:13:17 +03:00
parent ee875275e7
commit ab445ae0c6
No known key found for this signature in database
GPG Key ID: 3A5BAB26D767AA69
4 changed files with 11 additions and 9 deletions

View File

@ -94,7 +94,8 @@ public class AuthEventHandler {
// Tries to rescue player from nether portal
if(config.main.tryPortalRescue && player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL)) {
//if(config.main.tryPortalRescue && player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL)) {
if(config.main.tryPortalRescue && player.getServerWorld().getBlockState(player.getBlockPos()).getBlock().equals(Blocks.NETHER_PORTAL)) {
BlockPos pos = player.getBlockPos();
// Teleporting player to the middle of the block
@ -117,8 +118,8 @@ public class AuthEventHandler {
if(playerCache.isAuthenticated) {
playerCache.lastIp = player.getIp();
playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL);
//playerCache.wasInPortal = player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL);
playerCache.wasInPortal = player.getServerWorld().getBlockState(player.getBlockPos()).getBlock().equals(Blocks.NETHER_PORTAL);
// Setting the session expire time
if(config.main.sessionTimeoutTime != -1)
playerCache.validUntil = System.currentTimeMillis() + config.main.sessionTimeoutTime * 1000L;

View File

@ -68,7 +68,7 @@ public abstract class MixinServerPlayNetworkHandler {
ActionResult result = AuthEventHandler.onPlayerMove(player);
if (result == ActionResult.FAIL) {
// 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();
}
}

View File

@ -52,8 +52,8 @@ public class MixinServerPlayerEntity implements PlayerAuth {
// Saving position
cache.lastLocation.dimension = player.getServerWorld();
cache.lastLocation.position = player.getPos();
cache.lastLocation.yaw = player.yaw;
cache.lastLocation.pitch = player.pitch;
cache.lastLocation.yaw = player.getYaw(0);
cache.lastLocation.pitch = player.getPitch(0);
// Teleports player to spawn
player.teleport(

View File

@ -94,10 +94,11 @@ public class PlayerCache {
// Setting position cache
playerCache.lastLocation.dimension = player.getServerWorld();
playerCache.lastLocation.position = player.getPos();
playerCache.lastLocation.yaw = player.yaw;
playerCache.lastLocation.pitch = player.pitch;
playerCache.lastLocation.yaw = player.getYaw(0);
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;