mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge pull request #359 from ForceUpdate1/rain
Reset rain during respawning
This commit is contained in:
commit
0eea637aed
1 changed files with 11 additions and 0 deletions
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
package org.geysermc.connector.network.translators.java;
|
package org.geysermc.connector.network.translators.java;
|
||||||
|
|
||||||
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
|
||||||
import org.geysermc.connector.entity.Entity;
|
import org.geysermc.connector.entity.Entity;
|
||||||
import org.geysermc.connector.entity.attribute.AttributeType;
|
import org.geysermc.connector.entity.attribute.AttributeType;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
@ -35,6 +38,8 @@ import org.geysermc.connector.utils.DimensionUtils;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
|
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
|
||||||
|
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
@Translator(packet = ServerRespawnPacket.class)
|
@Translator(packet = ServerRespawnPacket.class)
|
||||||
public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket> {
|
public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket> {
|
||||||
|
|
||||||
|
@ -53,6 +58,12 @@ public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket>
|
||||||
session.getUpstream().sendPacket(playerGameTypePacket);
|
session.getUpstream().sendPacket(playerGameTypePacket);
|
||||||
session.setGameMode(packet.getGamemode());
|
session.setGameMode(packet.getGamemode());
|
||||||
|
|
||||||
|
LevelEventPacket stopRainPacket = new LevelEventPacket();
|
||||||
|
stopRainPacket.setType(LevelEventType.STOP_RAIN);
|
||||||
|
stopRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000);
|
||||||
|
stopRainPacket.setPosition(Vector3f.ZERO);
|
||||||
|
session.getUpstream().sendPacket(stopRainPacket);
|
||||||
|
|
||||||
if (entity.getDimension() != DimensionUtils.javaToBedrock(packet.getDimension())) {
|
if (entity.getDimension() != DimensionUtils.javaToBedrock(packet.getDimension())) {
|
||||||
DimensionUtils.switchDimension(session, packet.getDimension());
|
DimensionUtils.switchDimension(session, packet.getDimension());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue