13
0
geforkt von Mirrors/Paper

SPIGOT-6579: DragonFireBall movement with setDirection jumps around a lot

By: DerFrZocker <derrieple@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-07-11 09:34:35 +10:00
Ursprung 81ee774c37
Commit cae78fadd8
3 geänderte Dateien mit 19 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -12,6 +12,8 @@ import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.PlayerChunkMap;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityAreaEffectCloud;
@ -1035,6 +1037,22 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return nbttagcompound;
}
// re-sends the spawn entity packet to updated values which cannot be updated otherwise
protected void update() {
if (!getHandle().isAlive()) {
return;
}
WorldServer world = ((CraftWorld) getWorld()).getHandle();
PlayerChunkMap.EntityTracker entityTracker = world.getChunkProvider().chunkMap.entityMap.get(getEntityId());
if (entityTracker == null) {
return;
}
entityTracker.broadcast(getHandle().getPacket());
}
private static PermissibleBase getPermissibleBase() {
if (perm == null) {
perm = new PermissibleBase(new ServerOperator() {

Datei anzeigen

@ -57,6 +57,7 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
public void setDirection(Vector direction) {
Validate.notNull(direction, "Direction can not be null");
getHandle().setDirection(direction.getX(), direction.getY(), direction.getZ());
update(); // SPIGOT-6579
}
@Override

Datei anzeigen

@ -1,12 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.core.EnumDirection;
import net.minecraft.server.level.PlayerChunkMap;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.decoration.EntityHanging;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Hanging;
@ -74,19 +71,4 @@ public class CraftHanging extends CraftEntity implements Hanging {
public EntityType getType() {
return EntityType.UNKNOWN;
}
protected void update() {
if (!getHandle().isAlive()) {
return;
}
WorldServer world = ((CraftWorld) getWorld()).getHandle();
PlayerChunkMap.EntityTracker entityTracker = world.getChunkProvider().chunkMap.entityMap.get(getEntityId());
if (entityTracker == null) {
return;
}
entityTracker.broadcast(getHandle().getPacket());
}
}