blob: f9a581a4c1ce742f1653bca4beec301c6cdf752e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package jp.plusplus.fbs.packet;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import io.netty.buffer.ByteBuf;
import jp.plusplus.fbs.entity.EntityMagicArrowFlexible;
import net.minecraft.nbt.NBTTagCompound;
import java.util.UUID;
/**
* Created by plusplus_F on 2015/10/17.
*/
public class MessageMagicFlexible implements IMessage {
public int shooterId;
public int entityId;
public NBTTagCompound data;
public MessageMagicFlexible(){}
public MessageMagicFlexible(EntityMagicArrowFlexible entity){
shooterId=entity.shootingEntity.getEntityId();
entityId=entity.getEntityId();
data=new NBTTagCompound();
entity.writeMagicsToNBT(data);
}
@Override
public void fromBytes(ByteBuf buf) {
shooterId=ByteBufUtils.readVarInt(buf, 4);
entityId=ByteBufUtils.readVarInt(buf, 4);
data = ByteBufUtils.readTag(buf);
}
@Override
public void toBytes(ByteBuf buf) {
ByteBufUtils.writeVarInt(buf, shooterId, 4);
ByteBufUtils.writeVarInt(buf, entityId, 4);
ByteBufUtils.writeTag(buf, data);
}
}
|