Updates version

This commit is contained in:
paulevsGitch 2021-01-14 06:21:05 +03:00
parent 87c0c153bb
commit 9c31454a46
5 changed files with 73 additions and 18 deletions

View file

@ -2,8 +2,6 @@ package ru.betterend.blocks;
import java.util.Objects;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@ -22,7 +20,6 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Direction.Axis;
import net.minecraft.util.math.Direction.AxisDirection;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.GameMode;
import net.minecraft.world.Heightmap;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
@ -76,9 +73,6 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable
if (exitPos == null) return;
if (entity instanceof ServerPlayerEntity) {
ServerPlayerEntity player = (ServerPlayerEntity) entity;
//player.teleport(destination, exitPos.getX() + 0.5D, exitPos.getY(), exitPos.getZ() + 0.5D, player.yaw, player.pitch);
//player.onTeleportationDone();
//player.resetNetherPortalCooldown();
teleportPlayer(player, destination, exitPos);
} else {
@ -93,16 +87,22 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable
}
private void teleportPlayer(ServerPlayerEntity player, ServerWorld destination, BlockPos pos) {
((TeleportingEntity) player).beSetExitPos(pos);
if (player.isCreative()) {
player.teleport(destination, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, player.yaw, player.pitch);
}
else {
player.moveToWorld(destination);
player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
if (destination.getRegistryKey() == World.OVERWORLD) {
destination.tickEntity(player);
player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
//player.teleport(destination, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, player.yaw, player.pitch);
//player.updatePositionAndAngles(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, player.yaw, player.pitch);
player.moveToWorld(destination);
player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
//player.updatePositionAndAngles(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, player.yaw, player.pitch);
//player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
}
else {
player.moveToWorld(destination);
player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
}
}
player.resetNetherPortalCooldown();