@@ -19,13 +19,11 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
|
||||
|
||||
@Override
|
||||
public void setKnockbackStrength(int knockbackStrength) {
|
||||
Preconditions.checkArgument(knockbackStrength >= 0, "Knockback value (%s) cannot be negative", knockbackStrength);
|
||||
getHandle().setKnockback(knockbackStrength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getKnockbackStrength() {
|
||||
return getHandle().knockback;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,7 +115,6 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
|
||||
|
||||
@Override
|
||||
public void setShotFromCrossbow(boolean shotFromCrossbow) {
|
||||
getHandle().setShotFromCrossbow(shotFromCrossbow);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,6 +129,18 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
|
||||
getHandle().pickupItemStack = CraftItemStack.asNMSCopy(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWeapon() {
|
||||
return CraftItemStack.asBukkitCopy(getHandle().getWeaponItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeapon(ItemStack item) {
|
||||
Preconditions.checkArgument(item != null, "ItemStack cannot be null");
|
||||
|
||||
getHandle().firedFromWeapon = CraftItemStack.asNMSCopy(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityArrow getHandle() {
|
||||
return (EntityArrow) entity;
|
||||
|
||||
@@ -11,7 +11,7 @@ public abstract class CraftAbstractWindCharge extends CraftFireball implements A
|
||||
|
||||
@Override
|
||||
public void explode() {
|
||||
this.getHandle().explode();
|
||||
this.getHandle().explode(this.getHandle().position());
|
||||
this.getHandle().discard(EntityRemoveEvent.Cause.EXPLODE); // SPIGOT-7577 - explode doesn't discard the entity, this happens only in tick and onHitBlock
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.world.entity.decoration.BlockAttachedEntity;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
|
||||
public class CraftBlockAttachedEntity extends CraftEntity {
|
||||
public CraftBlockAttachedEntity(CraftServer server, BlockAttachedEntity entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockAttachedEntity getHandle() {
|
||||
return (BlockAttachedEntity) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftBlockAttachedEntity";
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,9 @@ import net.minecraft.world.entity.boss.EntityComplexPart;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.entity.projectile.EntityArrow;
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@@ -202,7 +204,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
if (location.getWorld() != null && !location.getWorld().equals(getWorld())) {
|
||||
// Prevent teleportation to an other world during world generation
|
||||
Preconditions.checkState(!entity.generation, "Cannot teleport entity to an other world during world generation");
|
||||
entity.teleportTo(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location));
|
||||
entity.changeDimension(new DimensionTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3D.ZERO, location.getPitch(), location.getYaw(), DimensionTransition.DO_NOTHING, TeleportCause.PLUGIN));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -856,7 +858,22 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return;
|
||||
}
|
||||
|
||||
entityTracker.broadcast(getHandle().getAddEntityPacket());
|
||||
entityTracker.broadcast(getHandle().getAddEntityPacket(entityTracker.serverEntity));
|
||||
}
|
||||
|
||||
public void update(EntityPlayer player) {
|
||||
if (!getHandle().isAlive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WorldServer world = ((CraftWorld) getWorld()).getHandle();
|
||||
PlayerChunkMap.EntityTracker entityTracker = world.getChunkSource().chunkMap.entityMap.get(getEntityId());
|
||||
|
||||
if (entityTracker == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.connection.send(getHandle().getAddEntityPacket(entityTracker.serverEntity));
|
||||
}
|
||||
|
||||
private static PermissibleBase getPermissibleBase() {
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.BlockDiodeAbstract;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -226,8 +227,8 @@ public final class CraftEntityTypes {
|
||||
private static final BiConsumer<SpawnData, net.minecraft.world.entity.Entity> MOVE = (spawnData, entity) -> entity.moveTo(spawnData.x(), spawnData.y(), spawnData.z(), spawnData.yaw(), spawnData.pitch());
|
||||
private static final BiConsumer<SpawnData, net.minecraft.world.entity.Entity> MOVE_EMPTY_ROT = (spawnData, entity) -> entity.moveTo(spawnData.x(), spawnData.y(), spawnData.z(), 0, 0);
|
||||
private static final BiConsumer<SpawnData, EntityFireball> DIRECTION = (spawnData, entity) -> {
|
||||
Vector direction = spawnData.location().getDirection().multiply(10);
|
||||
entity.assignPower(direction.getX(), direction.getY(), direction.getZ());
|
||||
Vector direction = spawnData.location().getDirection();
|
||||
entity.assignDirectionalMovement(new Vec3D(direction.getX(), direction.getY(), direction.getZ()), 1.0);
|
||||
};
|
||||
private static final Map<Class<?>, EntityTypeData<?, ?>> CLASS_TYPE_DATA = new HashMap<>();
|
||||
private static final Map<EntityType, EntityTypeData<?, ?>> ENTITY_TYPE_DATA = new HashMap<>();
|
||||
@@ -472,8 +473,8 @@ public final class CraftEntityTypes {
|
||||
if (nmsBlock.isSolid() || BlockDiodeAbstract.isDiode(nmsBlock)) {
|
||||
boolean taken = false;
|
||||
AxisAlignedBB bb = (ItemFrame.class.isAssignableFrom(clazz))
|
||||
? EntityItemFrame.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height)
|
||||
: EntityHanging.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height);
|
||||
? EntityItemFrame.calculateBoundingBoxStatic(pos, CraftBlock.blockFaceToNotch(dir).getOpposite())
|
||||
: EntityPainting.calculateBoundingBoxStatic(pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height);
|
||||
List<net.minecraft.world.entity.Entity> list = spawnData.world().getEntities(null, bb);
|
||||
for (Iterator<net.minecraft.world.entity.Entity> it = list.iterator(); !taken && it.hasNext(); ) {
|
||||
net.minecraft.world.entity.Entity e = it.next();
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.world.entity.projectile.EntityFireball;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
@@ -72,16 +73,15 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
||||
Preconditions.checkArgument(acceleration != null, "Vector acceleration cannot be null");
|
||||
// SPIGOT-6993: EntityFireball#assignPower will normalize the given values
|
||||
// Note: Because of MC-80142 the fireball will stutter on the client when setting the power to something other than 0 or the normalized vector * 0.1
|
||||
getHandle().xPower = acceleration.getX();
|
||||
getHandle().yPower = acceleration.getY();
|
||||
getHandle().zPower = acceleration.getZ();
|
||||
getHandle().assignDirectionalMovement(new Vec3D(acceleration.getX(), acceleration.getY(), acceleration.getZ()), acceleration.length());
|
||||
update(); // SPIGOT-6579
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Vector getAcceleration() {
|
||||
return new Vector(getHandle().xPower, getHandle().yPower, getHandle().zPower);
|
||||
Vec3D delta = getHandle().getDeltaMovement();
|
||||
return new Vector(delta.x, delta.y, delta.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.entity.Hanging;
|
||||
|
||||
public class CraftHanging extends CraftEntity implements Hanging {
|
||||
public class CraftHanging extends CraftBlockAttachedEntity implements Hanging {
|
||||
public CraftHanging(CraftServer server, EntityHanging entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
||||
|
||||
// update redstone
|
||||
if (!getHandle().generation) {
|
||||
getHandle().level().updateNeighbourForOutputSignal(getHandle().pos, Blocks.AIR);
|
||||
getHandle().level().updateNeighbourForOutputSignal(getHandle().getPos(), Blocks.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.LeashHitch;
|
||||
|
||||
public class CraftLeash extends CraftHanging implements LeashHitch {
|
||||
public class CraftLeash extends CraftBlockAttachedEntity implements LeashHitch {
|
||||
public CraftLeash(CraftServer server, EntityLeash entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
@@ -24,6 +24,17 @@ public class CraftLeash extends CraftHanging implements LeashHitch {
|
||||
return BlockFace.SELF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getAttachedFace() {
|
||||
// Leash hitch has no facing direction, so we return self
|
||||
return BlockFace.SELF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
// Leash hitch has no facing direction
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityLeash getHandle() {
|
||||
return (EntityLeash) entity;
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.world.entity.projectile.EntityThrownExpBottle;
|
||||
import net.minecraft.world.entity.projectile.EntityThrownTrident;
|
||||
import net.minecraft.world.entity.projectile.EntityTippedArrow;
|
||||
import net.minecraft.world.entity.projectile.EntityWitherSkull;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -462,14 +463,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
((EntityProjectile) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemEnderPearl
|
||||
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
||||
if (TippedArrow.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntityTippedArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW));
|
||||
launch = new EntityTippedArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
|
||||
((Arrow) launch.getBukkitEntity()).setBasePotionType(PotionType.WATER);
|
||||
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntitySpectralArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW));
|
||||
launch = new EntitySpectralArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW), null);
|
||||
} else if (Trident.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntityThrownTrident(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.TRIDENT));
|
||||
} else {
|
||||
launch = new EntityTippedArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW));
|
||||
launch = new EntityTippedArrow(world, getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
|
||||
}
|
||||
((EntityArrow) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 3.0F, 1.0F); // ItemBow
|
||||
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
|
||||
@@ -489,19 +490,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
} else if (Fireball.class.isAssignableFrom(projectile)) {
|
||||
Location location = getEyeLocation();
|
||||
Vector direction = location.getDirection().multiply(10);
|
||||
Vec3D vec = new Vec3D(direction.getX(), direction.getY(), direction.getZ());
|
||||
|
||||
if (SmallFireball.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
|
||||
launch = new EntitySmallFireball(world, getHandle(), vec);
|
||||
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
|
||||
launch = new EntityWitherSkull(world, getHandle(), vec);
|
||||
} else if (DragonFireball.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntityDragonFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
|
||||
launch = new EntityDragonFireball(world, getHandle(), vec);
|
||||
} else if (WindCharge.class.isAssignableFrom(projectile)) {
|
||||
launch = EntityTypes.WIND_CHARGE.create(world);
|
||||
((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).setOwner(getHandle());
|
||||
((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).assignPower(direction.getX(), direction.getY(), direction.getZ());
|
||||
((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).assignDirectionalMovement(vec, 0.1D);
|
||||
} else {
|
||||
launch = new EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ(), 1);
|
||||
launch = new EntityLargeFireball(world, getHandle(), vec, 1);
|
||||
}
|
||||
|
||||
((EntityFireball) launch).projectileSource = this;
|
||||
|
||||
@@ -47,6 +47,7 @@ import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
|
||||
import net.minecraft.network.protocol.common.ClientboundResourcePackPopPacket;
|
||||
import net.minecraft.network.protocol.common.ClientboundResourcePackPushPacket;
|
||||
import net.minecraft.network.protocol.common.ClientboundServerLinksPacket;
|
||||
import net.minecraft.network.protocol.common.ClientboundStoreCookiePacket;
|
||||
import net.minecraft.network.protocol.common.ClientboundTransferPacket;
|
||||
import net.minecraft.network.protocol.common.custom.DiscardedPayload;
|
||||
@@ -98,7 +99,6 @@ import net.minecraft.world.entity.EnumItemSlot;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeMapBase;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifiable;
|
||||
import net.minecraft.world.entity.ai.attributes.GenericAttributes;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.food.FoodMetaData;
|
||||
import net.minecraft.world.inventory.Container;
|
||||
import net.minecraft.world.item.EnumColor;
|
||||
@@ -111,7 +111,6 @@ import net.minecraft.world.level.border.IWorldBorderListener;
|
||||
import net.minecraft.world.level.saveddata.maps.MapIcon;
|
||||
import net.minecraft.world.level.saveddata.maps.MapId;
|
||||
import net.minecraft.world.level.saveddata.maps.WorldMap;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.bukkit.BanEntry;
|
||||
import org.bukkit.BanList;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -125,6 +124,7 @@ import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Note;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.ServerLinks;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.WeatherType;
|
||||
@@ -146,6 +146,7 @@ import org.bukkit.craftbukkit.CraftEquipmentSlot;
|
||||
import org.bukkit.craftbukkit.CraftOfflinePlayer;
|
||||
import org.bukkit.craftbukkit.CraftParticle;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftServerLinks;
|
||||
import org.bukkit.craftbukkit.CraftSound;
|
||||
import org.bukkit.craftbukkit.CraftStatistic;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
@@ -478,7 +479,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void kickPlayer(String message) {
|
||||
if (getHandle().connection == null) return;
|
||||
|
||||
getHandle().connection.disconnect(message == null ? "" : message);
|
||||
getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -562,7 +563,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) {
|
||||
if (loc == null || sound == null || category == null || getHandle().connection == null) return;
|
||||
|
||||
playSound0(loc, Holder.direct(SoundEffect.createVariableRangeEvent(new MinecraftKey(sound))), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch, seed);
|
||||
playSound0(loc, Holder.direct(SoundEffect.createVariableRangeEvent(MinecraftKey.parse(sound))), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch, seed);
|
||||
}
|
||||
|
||||
private void playSound0(Location loc, Holder<SoundEffect> soundEffectHolder, net.minecraft.sounds.SoundCategory categoryNMS, float volume, float pitch, long seed) {
|
||||
@@ -605,7 +606,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void playSound(org.bukkit.entity.Entity entity, String sound, org.bukkit.SoundCategory category, float volume, float pitch, long seed) {
|
||||
if (!(entity instanceof CraftEntity craftEntity) || sound == null || category == null || getHandle().connection == null) return;
|
||||
|
||||
playSound0(entity, Holder.direct(SoundEffect.createVariableRangeEvent(new MinecraftKey(sound))), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch, seed);
|
||||
playSound0(entity, Holder.direct(SoundEffect.createVariableRangeEvent(MinecraftKey.parse(sound))), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch, seed);
|
||||
}
|
||||
|
||||
private void playSound0(org.bukkit.entity.Entity entity, Holder<SoundEffect> soundEffectHolder, net.minecraft.sounds.SoundCategory categoryNMS, float volume, float pitch, long seed) {
|
||||
@@ -639,7 +640,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void stopSound(String sound, org.bukkit.SoundCategory category) {
|
||||
if (getHandle().connection == null) return;
|
||||
|
||||
getHandle().connection.send(new PacketPlayOutStopSound(new MinecraftKey(sound), category == null ? net.minecraft.sounds.SoundCategory.MASTER : net.minecraft.sounds.SoundCategory.valueOf(category.name())));
|
||||
getHandle().connection.send(new PacketPlayOutStopSound(MinecraftKey.parse(sound), category == null ? net.minecraft.sounds.SoundCategory.MASTER : net.minecraft.sounds.SoundCategory.valueOf(category.name())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -978,6 +979,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
getHandle().connection.send(new ClientboundHurtAnimationPacket(getEntityId(), actualYaw));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendLinks(ServerLinks links) {
|
||||
if (getHandle().connection == null) {
|
||||
return;
|
||||
}
|
||||
Preconditions.checkArgument(links != null, "links cannot be null");
|
||||
|
||||
net.minecraft.server.ServerLinks nms = ((CraftServerLinks) links).getServerLinks();
|
||||
getHandle().connection.send(new ClientboundServerLinksPacket(nms.untrust()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCustomChatCompletions(Collection<String> completions) {
|
||||
this.sendCustomChatCompletionPacket(completions, ClientboundCustomChatCompletionsPacket.Action.ADD);
|
||||
@@ -1064,7 +1076,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
entity.connection.teleport(to);
|
||||
} else {
|
||||
// The respawn reason should never be used if the passed location is non null.
|
||||
server.getHandle().respawn(entity, toWorld, true, to, true, null);
|
||||
server.getHandle().respawn(entity, true, Entity.RemovalReason.CHANGED_DIMENSION, null, to);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1127,10 +1139,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
BlockPosition bed = getHandle().getRespawnPosition();
|
||||
|
||||
if (world != null && bed != null) {
|
||||
Optional<Vec3D> spawnLoc = EntityHuman.findRespawnPositionAndUseSpawnBlock(world, bed, getHandle().getRespawnAngle(), getHandle().isRespawnForced(), true);
|
||||
Optional<EntityPlayer.RespawnPosAngle> spawnLoc = EntityPlayer.findRespawnAndUseSpawnBlock(world, bed, getHandle().getRespawnAngle(), getHandle().isRespawnForced(), true);
|
||||
if (spawnLoc.isPresent()) {
|
||||
Vec3D vec = spawnLoc.get();
|
||||
return CraftLocation.toBukkit(vec, world.getWorld(), getHandle().getRespawnAngle(), 0);
|
||||
EntityPlayer.RespawnPosAngle vec = spawnLoc.get();
|
||||
return CraftLocation.toBukkit(vec.position(), world.getWorld(), vec.yaw(), 0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -1787,7 +1799,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (getHandle().connection == null) return;
|
||||
|
||||
if (channels.contains(channel)) {
|
||||
MinecraftKey id = new MinecraftKey(StandardMessenger.validateAndCorrectChannel(channel));
|
||||
MinecraftKey id = MinecraftKey.parse(StandardMessenger.validateAndCorrectChannel(channel));
|
||||
sendCustomPayload(id, message);
|
||||
}
|
||||
}
|
||||
@@ -1914,7 +1926,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
}
|
||||
|
||||
sendCustomPayload(new MinecraftKey("register"), stream.toByteArray());
|
||||
sendCustomPayload(MinecraftKey.withDefaultNamespace("register"), stream.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user