-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce the first two plugin messages sent by MCCI
- Loading branch information
Showing
4 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...src/main/java/com/noxcrew/noxesium/network/clientbound/ClientboundMccGameStatePacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.noxcrew.noxesium.network.clientbound; | ||
|
||
import com.noxcrew.noxesium.network.NoxesiumPackets; | ||
import net.fabricmc.fabric.api.networking.v1.PacketSender; | ||
import net.fabricmc.fabric.api.networking.v1.PacketType; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
|
||
/** | ||
* Sent by MCC Island whenever the game state changes. | ||
* Possible values for the phase type: | ||
* - LOADING | ||
* - WAITING_FOR_PLAYERS | ||
* - PRE_GAME | ||
* - PLAY | ||
* - INTERMISSION | ||
* - POST_GAME | ||
* <p> | ||
* Values for the stage key differ based on the game. | ||
*/ | ||
public class ClientboundMccGameStatePacket extends ClientboundNoxesiumPacket { | ||
|
||
public final String phaseType; | ||
public final String stage; | ||
|
||
public ClientboundMccGameStatePacket(FriendlyByteBuf buf) { | ||
super(buf.readVarInt()); | ||
this.phaseType = buf.readUtf(); | ||
this.stage = buf.readUtf(); | ||
} | ||
|
||
@Override | ||
public void receive(LocalPlayer player, PacketSender responseSender) { | ||
// This packet is sent to be handled by any other users of the MCC Island API. | ||
// TODO Set up a public packet handler API here? | ||
} | ||
|
||
@Override | ||
public PacketType<?> getType() { | ||
return NoxesiumPackets.CLIENT_MCC_GAME_STATE; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ic/src/main/java/com/noxcrew/noxesium/network/clientbound/ClientboundMccServerPacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.noxcrew.noxesium.network.clientbound; | ||
|
||
import com.noxcrew.noxesium.network.NoxesiumPackets; | ||
import net.fabricmc.fabric.api.networking.v1.PacketSender; | ||
import net.fabricmc.fabric.api.networking.v1.PacketType; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
|
||
/** | ||
* Sent by MCC Island whenever you switch servers. All values are dynamic and may change over time. | ||
*/ | ||
public class ClientboundMccServerPacket extends ClientboundNoxesiumPacket { | ||
|
||
public final String type; | ||
public final String subType; | ||
public final String associatedGame; | ||
|
||
public ClientboundMccServerPacket(FriendlyByteBuf buf) { | ||
super(buf.readVarInt()); | ||
this.type = buf.readUtf(); | ||
this.subType = buf.readUtf(); | ||
this.associatedGame = buf.readUtf(); | ||
} | ||
|
||
@Override | ||
public void receive(LocalPlayer player, PacketSender responseSender) { | ||
// This packet is sent to be handled by any other users of the MCC Island API. | ||
// TODO Set up a public packet handler API here? | ||
} | ||
|
||
@Override | ||
public PacketType<?> getType() { | ||
return NoxesiumPackets.CLIENT_MCC_SERVER; | ||
} | ||
} |