use of net.minecraft.network.packet.s2c.play.GameJoinS2CPacket in project meteor-rejects by AntiCope.
the class ColorSigns method onPacketSend.
@EventHandler
private void onPacketSend(PacketEvent.Send event) {
if (event.packet instanceof GameJoinS2CPacket) {
checkWarning();
return;
}
if (!(event.packet instanceof UpdateSignC2SPacket))
return;
UpdateSignC2SPacket p = (UpdateSignC2SPacket) event.packet;
for (int l = 0; l < p.getText().length; l++) {
String newText = p.getText()[l].replaceAll("(?i)\u00a7|&([0-9A-FK-OR])", "\u00a7\u00a7$1$1");
p.getText()[l] = newText;
}
event.packet = p;
}
use of net.minecraft.network.packet.s2c.play.GameJoinS2CPacket in project Client by MatHax.
the class ColorSigns method onPacketSend.
@EventHandler
private void onPacketSend(PacketEvent.Send event) {
if (event.packet instanceof GameJoinS2CPacket) {
checkWarning();
return;
}
if (!(event.packet instanceof UpdateSignC2SPacket))
return;
UpdateSignC2SPacket p = (UpdateSignC2SPacket) event.packet;
for (int l = 0; l < p.getText().length; l++) {
String newText = p.getText()[l].replaceAll("(?i)\u00a7|&([0-9A-FK-OR])", "\u00a7\u00a7$1$1");
p.getText()[l] = newText;
}
event.packet = p;
}
use of net.minecraft.network.packet.s2c.play.GameJoinS2CPacket 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