Search in sources :

Example 1 with ClientboundBiomeChunkDataPacket

use of com.almuradev.almura.feature.biome.network.ClientboundBiomeChunkDataPacket in project Almura by AlmuraDev.

the class MixinPlayerChunkMapEntry method redirectSendPacketRemove.

@Redirect(method = "removePlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetHandlerPlayServer;sendPacket(Lnet/minecraft/network/Packet;)V"))
private void redirectSendPacketRemove(NetHandlerPlayServer netHandlerPlayServer, Packet<?> packetIn) {
    netHandlerPlayServer.sendPacket(packetIn);
    network.sendTo((Player) netHandlerPlayServer.player, new ClientboundBiomeChunkDataPacket(ChunkPos.asLong(this.pos.x, this.pos.z)));
}
Also used : ClientboundBiomeChunkDataPacket(com.almuradev.almura.feature.biome.network.ClientboundBiomeChunkDataPacket) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 2 with ClientboundBiomeChunkDataPacket

use of com.almuradev.almura.feature.biome.network.ClientboundBiomeChunkDataPacket in project Almura by AlmuraDev.

the class MixinPlayerChunkMapEntry method sendBiomeChunkThenRealChunkTo.

private void sendBiomeChunkThenRealChunkTo(NetHandlerPlayServer netHandlerPlayServer, Packet<?> packetIn) {
    final SPacketChunkData chunkDataPacket = (SPacketChunkData) packetIn;
    if (chunkDataPacket.isFullChunk()) {
        final IMixinChunk mixinChunk = (IMixinChunk) this.chunk;
        int[] extendedBiomeArray = mixinChunk.getExtendedBiomeArray();
        if (extendedBiomeArray == null) {
            extendedBiomeArray = mixinChunk.cacheRealBiomeIds();
        }
        final Player spongePlayer = (Player) netHandlerPlayServer.player;
        network.sendTo(spongePlayer, new ClientboundBiomeChunkDataPacket(ChunkPos.asLong(this.chunk.x, this.chunk.z), extendedBiomeArray));
    }
    netHandlerPlayServer.sendPacket(packetIn);
}
Also used : Player(org.spongepowered.api.entity.living.player.Player) SPacketChunkData(net.minecraft.network.play.server.SPacketChunkData) IMixinChunk(com.almuradev.almura.feature.biome.asm.mixin.iface.IMixinChunk) ClientboundBiomeChunkDataPacket(com.almuradev.almura.feature.biome.network.ClientboundBiomeChunkDataPacket)

Example 3 with ClientboundBiomeChunkDataPacket

use of com.almuradev.almura.feature.biome.network.ClientboundBiomeChunkDataPacket in project Almura by AlmuraDev.

the class MixinPlayerChunkMapEntry method sendBiomeChunkThenRealChunkToAll.

private void sendBiomeChunkThenRealChunkToAll(PlayerChunkMapEntry playerChunkMapEntry, Packet<?> packetIn) {
    final SPacketChunkData chunkDataPacket = (SPacketChunkData) packetIn;
    if (chunkDataPacket.isFullChunk()) {
        final IMixinChunk mixinChunk = (IMixinChunk) this.chunk;
        int[] extendedBiomeArray = mixinChunk.getExtendedBiomeArray();
        if (extendedBiomeArray == null) {
            extendedBiomeArray = mixinChunk.cacheRealBiomeIds();
        }
        final ClientboundBiomeChunkDataPacket biomePacket = new ClientboundBiomeChunkDataPacket(ChunkPos.asLong(this.chunk.x, this.chunk.z), extendedBiomeArray);
        if (this.sentToPlayers) {
            for (EntityPlayerMP player : this.players) {
                network.sendTo((Player) player, biomePacket);
            }
        }
    }
    playerChunkMapEntry.sendPacket(packetIn);
}
Also used : SPacketChunkData(net.minecraft.network.play.server.SPacketChunkData) IMixinChunk(com.almuradev.almura.feature.biome.asm.mixin.iface.IMixinChunk) ClientboundBiomeChunkDataPacket(com.almuradev.almura.feature.biome.network.ClientboundBiomeChunkDataPacket) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Aggregations

ClientboundBiomeChunkDataPacket (com.almuradev.almura.feature.biome.network.ClientboundBiomeChunkDataPacket)3 IMixinChunk (com.almuradev.almura.feature.biome.asm.mixin.iface.IMixinChunk)2 SPacketChunkData (net.minecraft.network.play.server.SPacketChunkData)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 Player (org.spongepowered.api.entity.living.player.Player)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1