forked from GeyserMC/Geyser
Remove effects on world/server change (Fixes #467)
The server re-sends these effects upon joining the new world or server.
This commit is contained in:
parent
7f5414cdef
commit
3d0dbff87b
1 changed files with 11 additions and 0 deletions
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.geysermc.connector.utils;
|
package org.geysermc.connector.utils;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.entity.Effect;
|
||||||
import com.nukkitx.math.vector.Vector3i;
|
import com.nukkitx.math.vector.Vector3i;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
import org.geysermc.connector.entity.Entity;
|
import org.geysermc.connector.entity.Entity;
|
||||||
|
@ -59,6 +60,16 @@ public class DimensionUtils {
|
||||||
session.setSpawned(false);
|
session.setSpawned(false);
|
||||||
session.setLastChunkPosition(null);
|
session.setLastChunkPosition(null);
|
||||||
|
|
||||||
|
for (Effect effect : session.getPlayerEntity().getEffectCache().getEntityEffects().keySet()) {
|
||||||
|
MobEffectPacket mobEffectPacket = new MobEffectPacket();
|
||||||
|
mobEffectPacket.setEvent(MobEffectPacket.Event.REMOVE);
|
||||||
|
mobEffectPacket.setRuntimeEntityId(session.getPlayerEntity().getGeyserId());
|
||||||
|
mobEffectPacket.setEffectId(EntityUtils.toBedrockEffectId(effect));
|
||||||
|
session.sendUpstreamPacket(mobEffectPacket);
|
||||||
|
}
|
||||||
|
// Effects are re-sent from server
|
||||||
|
session.getPlayerEntity().getEffectCache().getEntityEffects().clear();
|
||||||
|
|
||||||
//let java server handle portal travel sound
|
//let java server handle portal travel sound
|
||||||
StopSoundPacket stopSoundPacket = new StopSoundPacket();
|
StopSoundPacket stopSoundPacket = new StopSoundPacket();
|
||||||
stopSoundPacket.setStoppingAllSound(true);
|
stopSoundPacket.setStoppingAllSound(true);
|
||||||
|
|
Loading…
Reference in a new issue