use of net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket in project MasaGadget by plusls.
the class MixinPlayerRespawnS2CPacket method redirectOnPlayerRespawn.
@Inject(method = "apply*", at = @At(value = "RETURN"))
void redirectOnPlayerRespawn(ClientPlayPacketListener clientPlayPacketListener, CallbackInfo ci) {
if (!Configs.Minihud.COMPACT_BBOR_PROTOCOL.getBooleanValue()) {
return;
}
PlayerRespawnS2CPacket packet = (PlayerRespawnS2CPacket) (Object) this;
if (!BborProtocol.enable) {
return;
}
RegistryKey<World> oldDimension = Objects.requireNonNull(MinecraftClient.getInstance().player).world.getRegistryKey();
RegistryKey<World> newDimension = packet.getDimension();
if (oldDimension != newDimension) {
// reload minihud struct when dimension change
// BborProtocol.bborRefreshData();
}
}
use of net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket in project Hypnotic-Client by Hypnotic-Development.
the class Search method receivePacket.
@EventTarget
public void receivePacket(EventReceivePacket event) {
if (event.getPacket() instanceof DisconnectS2CPacket || event.getPacket() instanceof GameJoinS2CPacket || event.getPacket() instanceof PlayerRespawnS2CPacket) {
reset();
} else if (event.getPacket() instanceof BlockUpdateS2CPacket) {
BlockUpdateS2CPacket packet = (BlockUpdateS2CPacket) event.getPacket();
queuedBlocks.add(Pair.of(packet.getPos(), packet.getState()));
} else if (event.getPacket() instanceof ExplosionS2CPacket) {
ExplosionS2CPacket packet = (ExplosionS2CPacket) event.getPacket();
for (BlockPos pos : packet.getAffectedBlocks()) {
queuedBlocks.add(Pair.of(pos, Blocks.AIR.getDefaultState()));
}
} else if (event.getPacket() instanceof ChunkDeltaUpdateS2CPacket) {
ChunkDeltaUpdateS2CPacket packet = (ChunkDeltaUpdateS2CPacket) event.getPacket();
packet.visitUpdates((pos, state) -> queuedBlocks.add(Pair.of(pos.toImmutable(), state)));
} else if (event.getPacket() instanceof ChunkDataS2CPacket) {
ChunkDataS2CPacket packet = (ChunkDataS2CPacket) event.getPacket();
ChunkPos cp = new ChunkPos(packet.getX(), packet.getZ());
queuedChunks.add(cp);
queuedUnloads.remove(cp);
} else if (event.getPacket() instanceof UnloadChunkS2CPacket) {
UnloadChunkS2CPacket packet = (UnloadChunkS2CPacket) event.getPacket();
queuedUnloads.add(new ChunkPos(packet.getX(), packet.getZ()));
}
}
Aggregations