|
@@ -2,219 +2,115 @@ package me.km.overrides;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import com.mojang.authlib.GameProfile;
|
|
import com.mojang.authlib.GameProfile;
|
|
-import io.netty.buffer.Unpooled;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
import me.km.Server;
|
|
import me.km.Server;
|
|
import me.km.utils.ReflectionUtils;
|
|
import me.km.utils.ReflectionUtils;
|
|
-import net.minecraft.entity.Entity;
|
|
|
|
-import net.minecraft.entity.EntityType;
|
|
|
|
|
|
+import net.minecraft.block.BlockState;
|
|
|
|
+import net.minecraft.block.Blocks;
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
-import net.minecraft.nbt.CompoundNBT;
|
|
|
|
-import net.minecraft.network.NetworkManager;
|
|
|
|
-import net.minecraft.network.PacketBuffer;
|
|
|
|
-import net.minecraft.network.play.ServerPlayNetHandler;
|
|
|
|
import net.minecraft.network.play.server.SChangeGameStatePacket;
|
|
import net.minecraft.network.play.server.SChangeGameStatePacket;
|
|
-import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
|
|
|
|
-import net.minecraft.network.play.server.SHeldItemChangePacket;
|
|
|
|
-import net.minecraft.network.play.server.SJoinGamePacket;
|
|
|
|
-import net.minecraft.network.play.server.SPlayEntityEffectPacket;
|
|
|
|
-import net.minecraft.network.play.server.SPlayerAbilitiesPacket;
|
|
|
|
-import net.minecraft.network.play.server.SPlayerListItemPacket;
|
|
|
|
|
|
+import net.minecraft.network.play.server.SPlaySoundEffectPacket;
|
|
import net.minecraft.network.play.server.SRespawnPacket;
|
|
import net.minecraft.network.play.server.SRespawnPacket;
|
|
import net.minecraft.network.play.server.SServerDifficultyPacket;
|
|
import net.minecraft.network.play.server.SServerDifficultyPacket;
|
|
import net.minecraft.network.play.server.SSetExperiencePacket;
|
|
import net.minecraft.network.play.server.SSetExperiencePacket;
|
|
-import net.minecraft.network.play.server.SSpawnPositionPacket;
|
|
|
|
-import net.minecraft.network.play.server.STagsListPacket;
|
|
|
|
-import net.minecraft.network.play.server.SUpdateRecipesPacket;
|
|
|
|
-import net.minecraft.potion.EffectInstance;
|
|
|
|
|
|
+import net.minecraft.network.play.server.SWorldSpawnChangedPacket;
|
|
import net.minecraft.server.dedicated.DedicatedPlayerList;
|
|
import net.minecraft.server.dedicated.DedicatedPlayerList;
|
|
import net.minecraft.server.dedicated.DedicatedServer;
|
|
import net.minecraft.server.dedicated.DedicatedServer;
|
|
import net.minecraft.server.management.DemoPlayerInteractionManager;
|
|
import net.minecraft.server.management.DemoPlayerInteractionManager;
|
|
import net.minecraft.server.management.PlayerInteractionManager;
|
|
import net.minecraft.server.management.PlayerInteractionManager;
|
|
import net.minecraft.server.management.PlayerList;
|
|
import net.minecraft.server.management.PlayerList;
|
|
-import net.minecraft.server.management.PlayerProfileCache;
|
|
|
|
|
|
+import net.minecraft.tags.BlockTags;
|
|
|
|
+import net.minecraft.util.SoundCategory;
|
|
|
|
+import net.minecraft.util.SoundEvents;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.BlockPos;
|
|
-import net.minecraft.util.math.Vec3d;
|
|
|
|
|
|
+import net.minecraft.util.math.MathHelper;
|
|
|
|
+import net.minecraft.util.math.vector.Vector3d;
|
|
|
|
+import net.minecraft.util.registry.DynamicRegistries;
|
|
|
|
+import net.minecraft.util.text.ChatType;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
import net.minecraft.util.text.TranslationTextComponent;
|
|
import net.minecraft.util.text.TranslationTextComponent;
|
|
-import net.minecraft.world.GameRules;
|
|
|
|
import net.minecraft.world.IWorld;
|
|
import net.minecraft.world.IWorld;
|
|
|
|
+import net.minecraft.world.biome.BiomeManager;
|
|
import net.minecraft.world.server.ServerWorld;
|
|
import net.minecraft.world.server.ServerWorld;
|
|
-import net.minecraft.world.dimension.DimensionType;
|
|
|
|
-import net.minecraft.world.storage.WorldInfo;
|
|
|
|
-import org.apache.logging.log4j.LogManager;
|
|
|
|
|
|
+import net.minecraft.world.storage.IWorldInfo;
|
|
|
|
+import net.minecraft.world.storage.PlayerData;
|
|
|
|
|
|
public final class ModPlayerList extends DedicatedPlayerList {
|
|
public final class ModPlayerList extends DedicatedPlayerList {
|
|
private final DedicatedServer server;
|
|
private final DedicatedServer server;
|
|
private final List<ServerPlayerEntity> players;
|
|
private final List<ServerPlayerEntity> players;
|
|
private final Map<UUID, ServerPlayerEntity> uuidToPlayerMap;
|
|
private final Map<UUID, ServerPlayerEntity> uuidToPlayerMap;
|
|
|
|
|
|
- public ModPlayerList(DedicatedServer server) {
|
|
|
|
- super(server);
|
|
|
|
|
|
+ public ModPlayerList(DedicatedServer server, DynamicRegistries.Impl registries, PlayerData pd) {
|
|
|
|
+ super(server, registries, pd);
|
|
this.server = server;
|
|
this.server = server;
|
|
this.players = getPlayers();
|
|
this.players = getPlayers();
|
|
this.uuidToPlayerMap = ReflectionUtils.getFieldValue(Map.class, PlayerList.class, this, "field_177454_f");
|
|
this.uuidToPlayerMap = ReflectionUtils.getFieldValue(Map.class, PlayerList.class, this, "field_177454_f");
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public void initializeConnectionToPlayer(NetworkManager netManager, ServerPlayerEntity p) {
|
|
|
|
- GameProfile profile = p.getGameProfile();
|
|
|
|
- PlayerProfileCache cache = this.server.getPlayerProfileCache();
|
|
|
|
- cache.addEntry(profile);
|
|
|
|
- CompoundNBT compoundnbt = this.readPlayerDataFromFile(p);
|
|
|
|
-
|
|
|
|
- ServerWorld sw = this.server.getWorld(p.dimension);
|
|
|
|
- if(sw == null) {
|
|
|
|
- p.dimension = DimensionType.OVERWORLD;
|
|
|
|
- sw = this.server.getWorld(p.dimension);
|
|
|
|
- p.setPosition(sw.getWorldInfo().getSpawnX(), sw.getWorldInfo().getSpawnY(), sw.getWorldInfo().getSpawnZ());
|
|
|
|
- }
|
|
|
|
- p.setWorld(sw);
|
|
|
|
- p.interactionManager.setWorld((ServerWorld) p.world);
|
|
|
|
- String s1 = "local";
|
|
|
|
- if(netManager.getRemoteAddress() != null) {
|
|
|
|
- s1 = netManager.getRemoteAddress().toString();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- LogManager.getLogger().info("{}[{}] logged in with entity id {} at ({}, {}, {})", p.getName().getString(), s1, p.getEntityId(), p.getPosX(), p.getPosY(), p.getPosZ());
|
|
|
|
- WorldInfo wi = sw.getWorldInfo();
|
|
|
|
- setPlayerGameTypeBasedOnOther(p, null, sw);
|
|
|
|
- ServerPlayNetHandler spnh = new ServerPlayNetHandler(server, netManager, p);
|
|
|
|
- net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(netManager, "PLAY_TO_CLIENT");
|
|
|
|
- net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(netManager, p);
|
|
|
|
- GameRules gamerules = sw.getGameRules();
|
|
|
|
- spnh.sendPacket(new SJoinGamePacket(p.getEntityId(), p.interactionManager.getGameType(), WorldInfo.byHashing(wi.getSeed()), wi.isHardcore(), sw.dimension.getType(), this.getMaxPlayers(), wi.getGenerator(), getViewDistance(), gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO), !gamerules.getBoolean(GameRules.DO_IMMEDIATE_RESPAWN)));
|
|
|
|
- spnh.sendPacket(new SCustomPayloadPlayPacket(SCustomPayloadPlayPacket.BRAND, (new PacketBuffer(Unpooled.buffer())).writeString(this.getServer().getServerModName())));
|
|
|
|
- spnh.sendPacket(new SServerDifficultyPacket(wi.getDifficulty(), wi.isDifficultyLocked()));
|
|
|
|
- spnh.sendPacket(new SPlayerAbilitiesPacket(p.abilities));
|
|
|
|
- spnh.sendPacket(new SHeldItemChangePacket(p.inventory.currentItem));
|
|
|
|
- spnh.sendPacket(new SUpdateRecipesPacket(server.getRecipeManager().getRecipes()));
|
|
|
|
- spnh.sendPacket(new STagsListPacket(server.getNetworkTagManager()));
|
|
|
|
- this.updatePermissionLevel(p);
|
|
|
|
- p.getStats().markAllDirty();
|
|
|
|
- p.getRecipeBook().init(p);
|
|
|
|
- this.sendScoreboard(sw.getScoreboard(), p);
|
|
|
|
- this.server.refreshStatusNextTick();
|
|
|
|
-
|
|
|
|
- spnh.setPlayerLocation(p.getPosX(), p.getPosY(), p.getPosZ(), p.rotationYaw, p.rotationPitch);
|
|
|
|
- this.addPlayer(p);
|
|
|
|
- this.uuidToPlayerMap.put(p.getUniqueID(), p);
|
|
|
|
- this.sendPacketToAllPlayers(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p));
|
|
|
|
-
|
|
|
|
- for(int i = 0; i < this.players.size(); i++) {
|
|
|
|
- p.connection.sendPacket(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, players.get(i)));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- sw.addNewPlayer(p);
|
|
|
|
- server.getCustomBossEvents().onPlayerLogin(p);
|
|
|
|
- sendWorldInfo(p, sw);
|
|
|
|
- if(!this.server.getResourcePackUrl().isEmpty()) {
|
|
|
|
- p.loadResourcePack(server.getResourcePackUrl(), server.getResourcePackHash());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for(EffectInstance effectinstance : p.getActivePotionEffects()) {
|
|
|
|
- spnh.sendPacket(new SPlayEntityEffectPacket(p.getEntityId(), effectinstance));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(compoundnbt != null && compoundnbt.contains("RootVehicle", 10)) {
|
|
|
|
- CompoundNBT compoundnbt1 = compoundnbt.getCompound("RootVehicle");
|
|
|
|
- final ServerWorld worldf = sw;
|
|
|
|
- Entity entity1 = EntityType.func_220335_a(compoundnbt1.getCompound("Entity"), sw, (p_217885_1_) -> {
|
|
|
|
- return !worldf.summonEntity(p_217885_1_) ? null : p_217885_1_;
|
|
|
|
- });
|
|
|
|
- if(entity1 != null) {
|
|
|
|
- UUID uuid = compoundnbt1.getUniqueId("Attach");
|
|
|
|
- if(entity1.getUniqueID().equals(uuid)) {
|
|
|
|
- p.startRiding(entity1, true);
|
|
|
|
- } else {
|
|
|
|
- for(Entity entity : entity1.getRecursivePassengers()) {
|
|
|
|
- if(entity.getUniqueID().equals(uuid)) {
|
|
|
|
- p.startRiding(entity, true);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(!p.isPassenger()) {
|
|
|
|
- LogManager.getLogger().warn("Couldn't reattach entity to player");
|
|
|
|
- p.removeEntity(entity1);
|
|
|
|
-
|
|
|
|
- for(Entity entity2 : entity1.getRecursivePassengers()) {
|
|
|
|
- sw.removeEntity(entity2);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- p.addSelfToInternalCraftingInventory();
|
|
|
|
- net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedIn(p);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public ServerPlayerEntity createPlayerForUser(GameProfile profile) {
|
|
public ServerPlayerEntity createPlayerForUser(GameProfile profile) {
|
|
UUID uuid = PlayerEntity.getUUID(profile);
|
|
UUID uuid = PlayerEntity.getUUID(profile);
|
|
List<ServerPlayerEntity> list = Lists.newArrayList();
|
|
List<ServerPlayerEntity> list = Lists.newArrayList();
|
|
|
|
|
|
- for(int i = 0; i < this.players.size(); i++) {
|
|
|
|
- ServerPlayerEntity p = this.players.get(i);
|
|
|
|
- if(p.getUniqueID().equals(uuid)) {
|
|
|
|
- list.add(p);
|
|
|
|
|
|
+ for(int i = 0; i < this.players.size(); ++i) {
|
|
|
|
+ ServerPlayerEntity serverplayerentity = this.players.get(i);
|
|
|
|
+ if(serverplayerentity.getUniqueID().equals(uuid)) {
|
|
|
|
+ list.add(serverplayerentity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- ServerPlayerEntity p2 = this.uuidToPlayerMap.get(profile.getId());
|
|
|
|
- if(p2 != null && !list.contains(p2)) {
|
|
|
|
- list.add(p2);
|
|
|
|
|
|
+ ServerPlayerEntity p = this.uuidToPlayerMap.get(profile.getId());
|
|
|
|
+ if(p != null && !list.contains(p)) {
|
|
|
|
+ list.add(p);
|
|
}
|
|
}
|
|
|
|
|
|
- for(ServerPlayerEntity p : list) {
|
|
|
|
- p.connection.disconnect(new TranslationTextComponent("multiplayer.disconnect.duplicate_login"));
|
|
|
|
|
|
+ for(ServerPlayerEntity serverplayerentity1 : list) {
|
|
|
|
+ serverplayerentity1.connection.disconnect(new TranslationTextComponent("multiplayer.disconnect.duplicate_login"));
|
|
}
|
|
}
|
|
|
|
|
|
- PlayerInteractionManager playerinteractionmanager;
|
|
|
|
- if(server.isDemo()) {
|
|
|
|
- playerinteractionmanager = new DemoPlayerInteractionManager(server.getWorld(DimensionType.OVERWORLD));
|
|
|
|
|
|
+ ServerWorld w = this.server.func_241755_D_();
|
|
|
|
+ PlayerInteractionManager manager;
|
|
|
|
+ if(this.server.isDemo()) {
|
|
|
|
+ manager = new DemoPlayerInteractionManager(w);
|
|
} else {
|
|
} else {
|
|
- playerinteractionmanager = new PlayerInteractionManager(server.getWorld(DimensionType.OVERWORLD));
|
|
|
|
|
|
+ manager = new PlayerInteractionManager(w);
|
|
}
|
|
}
|
|
|
|
|
|
- return new ModEntityPlayerMP(this.server, this.server.getWorld(DimensionType.OVERWORLD), profile, playerinteractionmanager);
|
|
|
|
|
|
+ return new ModEntityPlayerMP(this.server, w, profile, manager);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ServerPlayerEntity recreatePlayerEntity(ServerPlayerEntity pIn, DimensionType dim, boolean conqueredEnd) {
|
|
|
|
|
|
+ public ServerPlayerEntity func_232644_a_(ServerPlayerEntity pIn, boolean p_232644_2_) {
|
|
Server.scriptEvents.onPlayerPreRespawn(pIn);
|
|
Server.scriptEvents.onPlayerPreRespawn(pIn);
|
|
- ServerWorld world = server.getWorld(dim);
|
|
|
|
- if(world == null) {
|
|
|
|
- dim = pIn.getSpawnDimension();
|
|
|
|
- } else if(!world.getDimension().canRespawnHere()) {
|
|
|
|
- dim = world.getDimension().getRespawnDimension(pIn);
|
|
|
|
- }
|
|
|
|
- if(server.getWorld(dim) == null) {
|
|
|
|
- dim = DimensionType.OVERWORLD;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
this.removePlayer(pIn);
|
|
this.removePlayer(pIn);
|
|
pIn.getServerWorld().removePlayer(pIn, true); // Forge: keep data until copyFrom called
|
|
pIn.getServerWorld().removePlayer(pIn, true); // Forge: keep data until copyFrom called
|
|
- BlockPos blockpos = pIn.getBedLocation(dim);
|
|
|
|
- boolean flag = pIn.isSpawnForced(dim);
|
|
|
|
- pIn.dimension = dim;
|
|
|
|
- PlayerInteractionManager playerinteractionmanager;
|
|
|
|
|
|
+ BlockPos blockpos = pIn.func_241140_K_();
|
|
|
|
+ float f = pIn.func_242109_L();
|
|
|
|
+ boolean flag = pIn.func_241142_M_();
|
|
|
|
+ ServerWorld serverworld = server.getWorld(pIn.func_241141_L_());
|
|
|
|
+ Optional<Vector3d> optional;
|
|
|
|
+ if(serverworld != null && blockpos != null) {
|
|
|
|
+ optional = PlayerEntity.func_242374_a(serverworld, blockpos, f, flag, p_232644_2_);
|
|
|
|
+ } else {
|
|
|
|
+ optional = Optional.empty();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ServerWorld w = serverworld != null && optional.isPresent() ? serverworld : server.func_241755_D_();
|
|
|
|
+ PlayerInteractionManager manager;
|
|
if(this.server.isDemo()) {
|
|
if(this.server.isDemo()) {
|
|
- playerinteractionmanager = new DemoPlayerInteractionManager(this.server.getWorld(pIn.dimension));
|
|
|
|
|
|
+ manager = new DemoPlayerInteractionManager(w);
|
|
} else {
|
|
} else {
|
|
- playerinteractionmanager = new PlayerInteractionManager(this.server.getWorld(pIn.dimension));
|
|
|
|
|
|
+ manager = new PlayerInteractionManager(w);
|
|
}
|
|
}
|
|
|
|
|
|
- ServerPlayerEntity p = new ModEntityPlayerMP(this.server, this.server.getWorld(pIn.dimension), pIn.getGameProfile(), playerinteractionmanager, (ModEntityPlayerMP) pIn);
|
|
|
|
|
|
+ ServerPlayerEntity p = new ModEntityPlayerMP(server, w, pIn.getGameProfile(), manager, (ModEntityPlayerMP) pIn);
|
|
p.connection = pIn.connection;
|
|
p.connection = pIn.connection;
|
|
- p.copyFrom(pIn, conqueredEnd);
|
|
|
|
|
|
+ p.copyFrom(pIn, p_232644_2_);
|
|
pIn.remove(false); // Forge: clone event had a chance to see old data, now discard it
|
|
pIn.remove(false); // Forge: clone event had a chance to see old data, now discard it
|
|
- p.dimension = dim;
|
|
|
|
p.setEntityId(pIn.getEntityId());
|
|
p.setEntityId(pIn.getEntityId());
|
|
p.setPrimaryHand(pIn.getPrimaryHand());
|
|
p.setPrimaryHand(pIn.getPrimaryHand());
|
|
|
|
|
|
@@ -222,39 +118,49 @@ public final class ModPlayerList extends DedicatedPlayerList {
|
|
p.addTag(s);
|
|
p.addTag(s);
|
|
}
|
|
}
|
|
|
|
|
|
- ServerWorld sw = this.server.getWorld(pIn.dimension);
|
|
|
|
- setPlayerGameTypeBasedOnOther(p, pIn, sw);
|
|
|
|
- if(blockpos != null) {
|
|
|
|
- Optional<Vec3d> optional = PlayerEntity.checkBedValidRespawnPosition(server.getWorld(pIn.dimension), blockpos, flag);
|
|
|
|
- if(optional.isPresent()) {
|
|
|
|
- Vec3d vec3d = optional.get();
|
|
|
|
- p.setLocationAndAngles(vec3d.x, vec3d.y, vec3d.z, 0.0f, 0.0f);
|
|
|
|
- p.setSpawnPoint(blockpos, flag, false, dim);
|
|
|
|
|
|
+ this.setPlayerGameTypeBasedOnOther(p, pIn, w);
|
|
|
|
+ boolean flag2 = false;
|
|
|
|
+ if(optional.isPresent()) {
|
|
|
|
+ BlockState blockstate = w.getBlockState(blockpos);
|
|
|
|
+ boolean flag1 = blockstate.isIn(Blocks.RESPAWN_ANCHOR);
|
|
|
|
+ Vector3d vector3d = optional.get();
|
|
|
|
+ float f1;
|
|
|
|
+ if(!blockstate.isIn(BlockTags.BEDS) && !flag1) {
|
|
|
|
+ f1 = f;
|
|
} else {
|
|
} else {
|
|
- p.connection.sendPacket(new SChangeGameStatePacket(0, 0.0f));
|
|
|
|
|
|
+ Vector3d vector3d1 = Vector3d.copyCenteredHorizontally(blockpos).subtract(vector3d).normalize();
|
|
|
|
+ f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vector3d1.z, vector3d1.x) * (double) (180F / (float) Math.PI) - 90.0D);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ p.setLocationAndAngles(vector3d.x, vector3d.y, vector3d.z, f1, 0.0F);
|
|
|
|
+ p.func_242111_a(w.getDimensionKey(), blockpos, f, flag, false);
|
|
|
|
+ flag2 = !p_232644_2_ && flag1;
|
|
|
|
+ } else if(blockpos != null) {
|
|
|
|
+ p.connection.sendPacket(new SChangeGameStatePacket(SChangeGameStatePacket.field_241764_a_, 0.0F));
|
|
}
|
|
}
|
|
|
|
|
|
- while(!sw.hasNoCollisions(p) && p.getPosY() < 256.0D) {
|
|
|
|
- p.setPosition(p.getPosX(), p.getPosY() + 1.0, p.getPosZ());
|
|
|
|
|
|
+ while(!w.hasNoCollisions(p) && p.getPosY() < 256.0D) {
|
|
|
|
+ p.setPosition(p.getPosX(), p.getPosY() + 1.0D, p.getPosZ());
|
|
}
|
|
}
|
|
|
|
|
|
- WorldInfo wi = p.world.getWorldInfo();
|
|
|
|
- net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(p.connection.netManager, p);
|
|
|
|
- p.connection.sendPacket(new SRespawnPacket(p.dimension, WorldInfo.byHashing(wi.getSeed()), wi.getGenerator(), p.interactionManager.getGameType()));
|
|
|
|
- BlockPos pos = sw.getSpawnPoint();
|
|
|
|
|
|
+ IWorldInfo iworldinfo = p.world.getWorldInfo();
|
|
|
|
+ p.connection.sendPacket(new SRespawnPacket(p.world.getDimensionType(), p.world.getDimensionKey(), BiomeManager.getHashedSeed(p.getServerWorld().getSeed()), p.interactionManager.getGameType(), p.interactionManager.func_241815_c_(), p.getServerWorld().isDebug(), p.getServerWorld().func_241109_A_(), p_232644_2_));
|
|
p.connection.setPlayerLocation(p.getPosX(), p.getPosY(), p.getPosZ(), p.rotationYaw, p.rotationPitch);
|
|
p.connection.setPlayerLocation(p.getPosX(), p.getPosY(), p.getPosZ(), p.rotationYaw, p.rotationPitch);
|
|
- p.connection.sendPacket(new SSpawnPositionPacket(pos));
|
|
|
|
- p.connection.sendPacket(new SServerDifficultyPacket(wi.getDifficulty(), wi.isDifficultyLocked()));
|
|
|
|
|
|
+ p.connection.sendPacket(new SWorldSpawnChangedPacket(w.getSpawnPoint(), w.func_242107_v()));
|
|
|
|
+ p.connection.sendPacket(new SServerDifficultyPacket(iworldinfo.getDifficulty(), iworldinfo.isDifficultyLocked()));
|
|
p.connection.sendPacket(new SSetExperiencePacket(p.experience, p.experienceTotal, p.experienceLevel));
|
|
p.connection.sendPacket(new SSetExperiencePacket(p.experience, p.experienceTotal, p.experienceLevel));
|
|
- sendWorldInfo(p, sw);
|
|
|
|
- updatePermissionLevel(p);
|
|
|
|
- sw.addRespawnedPlayer(p);
|
|
|
|
|
|
+ this.sendWorldInfo(p, w);
|
|
|
|
+ this.updatePermissionLevel(p);
|
|
|
|
+ w.addRespawnedPlayer(p);
|
|
this.addPlayer(p);
|
|
this.addPlayer(p);
|
|
this.uuidToPlayerMap.put(p.getUniqueID(), p);
|
|
this.uuidToPlayerMap.put(p.getUniqueID(), p);
|
|
p.addSelfToInternalCraftingInventory();
|
|
p.addSelfToInternalCraftingInventory();
|
|
p.setHealth(p.getHealth());
|
|
p.setHealth(p.getHealth());
|
|
- net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(p, conqueredEnd);
|
|
|
|
|
|
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(p, p_232644_2_);
|
|
|
|
+ if(flag2) {
|
|
|
|
+ p.connection.sendPacket(new SPlaySoundEffectPacket(SoundEvents.BLOCK_RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), 1.0F, 1.0F));
|
|
|
|
+ }
|
|
|
|
+
|
|
return p;
|
|
return p;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -263,11 +169,17 @@ public final class ModPlayerList extends DedicatedPlayerList {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void sendMessage(ITextComponent component) {
|
|
|
|
- // filter multiplayer leave text
|
|
|
|
- if(component instanceof TranslationTextComponent && ((TranslationTextComponent) component).getKey().equals("multiplayer.player.left")) {
|
|
|
|
- return;
|
|
|
|
|
|
+ public void func_232641_a_(ITextComponent message, ChatType chat, UUID uuid) {
|
|
|
|
+ if(message instanceof TranslationTextComponent) {
|
|
|
|
+ TranslationTextComponent translation = (TranslationTextComponent) message;
|
|
|
|
+ switch(translation.getKey()) {
|
|
|
|
+ case "multiplayer.player.left":
|
|
|
|
+ case "multiplayer.player.joined":
|
|
|
|
+ case "multiplayer.player.joined.renamed":
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- super.sendMessage(component);
|
|
|
|
|
|
+ super.func_232641_a_(message, chat, uuid);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|