Files
FindIt/src/main/java/com/gtnh/findit/service/blockfinder/BlockFoundResponse.java
T
Oleg Ivanov dad262c9cb Full mod rewrite (#3)
* Full mod rewrite

* Remove legacy code

* Remove second draw call for position particle
2022-02-15 10:10:52 +01:00

50 lines
1.4 KiB
Java

package com.gtnh.findit.service.blockfinder;
import com.gtnh.findit.util.ProtoUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.world.ChunkPosition;
import java.util.List;
public class BlockFoundResponse implements IMessage {
private List<ChunkPosition> positions;
public BlockFoundResponse(List<ChunkPosition> positions) {
this.positions = positions;
}
public BlockFoundResponse() {
}
public List<ChunkPosition> getPositions() {
return positions;
}
@Override
public void fromBytes(ByteBuf buf) {
positions = ProtoUtils.readPositions(buf);
}
@Override
public void toBytes(ByteBuf buf) {
ProtoUtils.writePositions(buf, positions);
}
public static class Handler implements IMessageHandler<BlockFoundResponse, IMessage> {
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(BlockFoundResponse message, MessageContext ctx) {
ClientBlockFindService.getInstance().handleResponse(Minecraft.getMinecraft().thePlayer, message);
return null;
}
}
}