Continue mapping migration
This commit is contained in:
parent
99ade39404
commit
f03fd03bd0
499 changed files with 12567 additions and 12723 deletions
|
@ -9,27 +9,26 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.network.packet.s2c.play.DifficultyS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntityMobEffectS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.WorldEventS2CPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.PlayerManager;
|
||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.TeleportTarget;
|
||||
import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelEventPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundRespawnPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.WorldProperties;
|
||||
import net.minecraft.world.biome.source.BiomeAccess;
|
||||
import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.portal.PortalInfo;
|
||||
import net.minecraft.world.level.storage.LevelData;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import ru.betterend.interfaces.TeleportingEntity;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
|
@ -37,10 +36,10 @@ import ru.betterend.world.generator.GeneratorOptions;
|
|||
public abstract class ServerPlayerEntityMixin extends Player implements TeleportingEntity {
|
||||
|
||||
@Shadow
|
||||
public ServerPlayNetworkHandler networkHandler;
|
||||
public ServerGamePacketListenerImpl networkHandler;
|
||||
@Final
|
||||
@Shadow
|
||||
public ServerPlayerInteractionManager interactionManager;
|
||||
public ServerPlayerGameMode interactionManager;
|
||||
@Final
|
||||
@Shadow
|
||||
public MinecraftServer server;
|
||||
|
@ -67,52 +66,47 @@ public abstract class ServerPlayerEntityMixin extends Player implements Teleport
|
|||
}
|
||||
|
||||
@Inject(method = "getTeleportTarget", at = @At("HEAD"), cancellable = true)
|
||||
protected void be_getTeleportTarget(ServerLevel destination, CallbackInfoReturnable<TeleportTarget> info) {
|
||||
protected void be_getTeleportTarget(ServerLevel destination, CallbackInfoReturnable<PortalInfo> info) {
|
||||
if (beCanTeleport()) {
|
||||
info.setReturnValue(new TeleportTarget(
|
||||
new Vec3d(exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5), getVelocity(), yaw, pitch));
|
||||
info.setReturnValue(new PortalInfo(new Vec3(exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5), getDeltaMovement(), yRot, xRot));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "moveToWorld", at = @At("HEAD"), cancellable = true)
|
||||
public void be_moveToWorld(ServerLevel destination, CallbackInfoReturnable<Entity> info) {
|
||||
if (beCanTeleport() && world instanceof ServerLevel) {
|
||||
if (beCanTeleport() && level instanceof ServerLevel) {
|
||||
this.inTeleportationState = true;
|
||||
ServerLevel serverWorld = this.getServerWorld();
|
||||
WorldProperties worldProperties = destination.getLevelProperties();
|
||||
LevelData worldProperties = destination.getLevelData();
|
||||
ServerPlayer player = ServerPlayer.class.cast(this);
|
||||
this.networkHandler.sendPacket(new PlayerRespawnS2CPacket(destination.getDimension(),
|
||||
destination.dimension(), BiomeAccess.hashSeed(destination.getSeed()),
|
||||
interactionManager.getGameMode(), interactionManager.getPreviousGameMode(),
|
||||
destination.isDebugWorld(), destination.isFlat(), true));
|
||||
this.networkHandler.sendPacket(
|
||||
new DifficultyS2CPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked()));
|
||||
PlayerManager playerManager = this.server.getPlayerManager();
|
||||
playerManager.sendCommandTree(player);
|
||||
serverWorld.removePlayer(player);
|
||||
this.networkHandler.send(new ClientboundRespawnPacket(destination.dimensionType(), destination.dimension(), BiomeManager.obfuscateSeed(destination.getSeed()),
|
||||
interactionManager.getGameModeForPlayer(),interactionManager.getPreviousGameModeForPlayer(), destination.isDebug(), destination.isFlat(), true));
|
||||
this.networkHandler.send(new ClientboundChangeDifficultyPacket(worldProperties.getDifficulty(), worldProperties.isDifficultyLocked()));
|
||||
PlayerList playerManager = this.server.getPlayerList();
|
||||
playerManager.sendPlayerPermissionLevel(player);
|
||||
serverWorld.removePlayerImmediately(player);
|
||||
this.removed = false;
|
||||
TeleportTarget teleportTarget = this.getTeleportTarget(destination);
|
||||
PortalInfo teleportTarget = this.findDimensionEntryPoint(destination);
|
||||
if (teleportTarget != null) {
|
||||
serverWorld.getProfiler().push("moving");
|
||||
serverWorld.getProfiler().pop();
|
||||
serverWorld.getProfiler().push("placing");
|
||||
this.setWorld(destination);
|
||||
destination.onPlayerChangeDimension(player);
|
||||
this.setRotation(teleportTarget.yaw, teleportTarget.pitch);
|
||||
this.refreshPositionAfterTeleport(teleportTarget.position.x, teleportTarget.position.y,
|
||||
teleportTarget.position.z);
|
||||
this.setLevel(destination);
|
||||
destination.addDuringPortalTeleport(player);
|
||||
this.setRot(teleportTarget.yRot, teleportTarget.xRot);
|
||||
this.moveTo(teleportTarget.pos.x, teleportTarget.pos.y, teleportTarget.pos.z);
|
||||
serverWorld.getProfiler().pop();
|
||||
this.worldChanged(serverWorld);
|
||||
this.interactionManager.setWorld(destination);
|
||||
this.networkHandler.sendPacket(new PlayerAbilitiesS2CPacket(this.abilities));
|
||||
playerManager.sendWorldInfo(player, destination);
|
||||
playerManager.sendPlayerStatus(player);
|
||||
this.interactionManager.setLevel(destination);
|
||||
this.networkHandler.send(new ClientboundPlayerAbilitiesPacket(this.abilities));
|
||||
playerManager.sendLevelInfo(player, destination);
|
||||
playerManager.sendAllPlayerInfo(player);
|
||||
|
||||
for (MobEffectInstance statusEffectInstance : this.getMobEffects()) {
|
||||
this.networkHandler.sendPacket(new EntityMobEffectS2CPacket(getEntityId(), statusEffectInstance));
|
||||
for (MobEffectInstance statusEffectInstance : this.getActiveEffects()) {
|
||||
this.networkHandler.send(new ClientboundUpdateMobEffectPacket(getId(), statusEffectInstance));
|
||||
}
|
||||
|
||||
this.networkHandler.sendPacket(new WorldEventS2CPacket(1032, BlockPos.ORIGIN, 0, false));
|
||||
this.networkHandler.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false));
|
||||
this.syncedExperience = -1;
|
||||
this.syncedHealth = -1.0F;
|
||||
this.syncedFoodLevel = -1;
|
||||
|
@ -130,7 +124,7 @@ public abstract class ServerPlayerEntityMixin extends Player implements Teleport
|
|||
|
||||
@Shadow
|
||||
@Override
|
||||
protected abstract TeleportTarget getTeleportTarget(ServerLevel destination);
|
||||
protected abstract PortalInfo findDimensionEntryPoint(ServerLevel destination);
|
||||
|
||||
@Override
|
||||
public void beSetExitPos(BlockPos pos) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue