Archived
0

Change Game State

This commit is contained in:
2018-07-27 13:03:38 +03:00
parent e22b32b9fb
commit 983e79d325
2 changed files with 37 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ public enum State {
.put(BossBarPacket.class, 0x0C)
.put(ChatMessageServerPacket.class, 0x0F)
.put(PluginMessagePacket.class, 0x18)
.put(ChangeGameState.class, 0x1E)
.put(KeepAlivePacket.class, 0x1F)
.put(JoinGamePacket.class, 0x23)
.put(PlayerAbilitiesPacket.class, 0x2C)

View File

@@ -0,0 +1,36 @@
/*
* DmitriyMX <dimon550@gmail.com>
* 2018-07-27
*/
package mc.core.network.proto_1_12_2.packets;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import mc.core.network.NetOutputStream;
import mc.core.network.SCPacket;
@Setter
public class ChangeGameState implements SCPacket {
@RequiredArgsConstructor
public enum Reason {
INVALID_BED(0), // Would be used to switch between messages, but the only used message is 0 for invalid bed (wat?)
RAINING_END(1),
RAINING_BEGIN(2),
CHANGE_GAMEMODE(3), // 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
ARROW_HITTING_PLAYER(6), // Appears to be played when an arrow strikes another player in Multiplayer
FADE_VALUE(7), // The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
FADE_TIME(8), // Time in ticks for the sky to fade
GUARDIAN_APPEARANCE(10); // Play elder guardian mob appearance (effect and sound)
private final int id;
}
private Reason reason;
private float value;
@Override
public void writeSelf(NetOutputStream netStream) {
netStream.writeUnsignedByte(reason.id);
netStream.writeFloat(value);
}
}