本文整理汇总了Java中cpw.mods.fml.common.network.ByteBufUtils.readTag方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufUtils.readTag方法的具体用法?Java ByteBufUtils.readTag怎么用?Java ByteBufUtils.readTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpw.mods.fml.common.network.ByteBufUtils
的用法示例。
在下文中一共展示了ByteBufUtils.readTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
player = tag.getString("player");
switch (tag.getInteger("type")) {
case 0:
buttonType = EnumButtonType.DISTRIBUTE;
break;
case 1:
buttonType = EnumButtonType.SMART_ASSIST;
break;
case 2:
buttonType = EnumButtonType.REMOVE;
break;
}
world = WorldUtils.getWorldFromDimensionId(tag.getInteger("dim"));
}
示例2: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
NBTTagCompound data = ByteBufUtils.readTag(buf);
x = data.getInteger("x");
y = data.getInteger("y");
z = data.getInteger("z");
once = data.getBoolean("once");
}
示例3: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
entityId = ByteBufUtils.readVarInt(buf, 4);
entitySyncDataCompound = ByteBufUtils.readTag(buf); // this class is very useful in general for writing more complex objects
// DEBUG
System.out.println("fromBytes");
}
示例4: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
startTime = tag.getLong("startTime");
time = tag.getInteger("time");
profile = new GameProfile(UUID.fromString(tag.getString("uuid")), tag.getString("name"));
}
示例5: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
world = WorldUtils.getWorldFromDimensionId(tag.getInteger("dim"));
x = tag.getInteger("x");
y = tag.getInteger("y");
z = tag.getInteger("z");
updateData = tag.getCompoundTag("tag");
}
示例6: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
configName = tag.getString("configName");
config = tag.getString("config");
isRevert = tag.getBoolean("isRevert");
}
示例7: handle
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void handle(ByteBuf data, EntityPlayer player) {
int dimension = data.readInt();
int xPos = data.readInt();
int yPos = data.readInt();
int zPos = data.readInt();
NBTTagCompound nbt = ByteBufUtils.readTag(data);
WorldClient proxyworld = ProxyWorldManager.getProxyworld(dimension);
if (proxyworld == null) return;
if (proxyworld.provider.dimensionId != dimension) return;
if (proxyworld.blockExists(xPos, yPos, zPos)) {
TileEntity tileentity = proxyworld.getTileEntity(xPos, yPos, zPos);
if (tileentity != null) {
tileentity.readFromNBT(nbt);
} else {
//Create tile entity from data
tileentity = TileEntity.createAndLoadEntity(nbt);
if (tileentity != null) {
proxyworld.addTileEntity(tileentity);
}
}
proxyworld.markTileEntityChunkModified(xPos, yPos, zPos, tileentity);
proxyworld.setTileEntity(xPos, yPos, zPos, tileentity);
proxyworld.markBlockForUpdate(xPos, yPos, zPos);
}
}
示例8: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
world = WorldUtils.getWorldFromDimensionId(tag.getInteger("dim"));
isEntity = tag.getBoolean("isEntity");
if (isEntity)
entityId = tag.getInteger("entityId");
else {
x = tag.getInteger("x");
y = tag.getInteger("y");
z = tag.getInteger("z");
}
player = (EntityPlayer) world.getEntityByID(tag.getInteger("player"));
}
示例9: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
world = WorldUtils.getWorldFromDimensionId(tag.getInteger("dim"));
x = tag.getDouble("x");
y = tag.getDouble("y");
z = tag.getDouble("z");
}
示例10: decodeInto
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
NBTTagCompound data = ByteBufUtils.readTag(buffer);
ptm = new PortalTextureManager();
if (data.hasKey("Texture"))
ptm.readFromNBT(data, "Texture");
name = data.getString("name");
glyphs = data.getString("glyphs");
}
示例11: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound data = ByteBufUtils.readTag(buf);
player = MinecraftServer.getServer().worldServerForDimension(data.getInteger("dim")).func_152378_a(UUID.fromString(data.getString("player")));
fixed = data.getBoolean("fixed");
mode = data.getInteger("mode");
}
示例12: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
location = new int[3];
for (int i=0;i<3;i++)
{
location[i] = ByteBufUtils.readVarInt(buf,5);
}
tagCompound = ByteBufUtils.readTag(buf);
}
示例13: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tagCompound = ByteBufUtils.readTag(buf);
try {
this.playerUUID = UUID.fromString(tagCompound.getString("playerUUID"));
this.guiID = tagCompound.getInteger("guiID");
}
catch (IllegalArgumentException ex) {
LogHelper.info("Converting UUID from Bytes failed.");
ex.printStackTrace();
}
}
示例14: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound tag = ByteBufUtils.readTag(buf);
if (tag != null && tag.hasKey("KnownItems", 9)) {
NBTTagList tagList = tag.getTagList("KnownItems", 10);
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound itemTag = tagList.getCompoundTagAt(i);
this.knownTransmutations.add(ItemStack.loadItemStackFromNBT(itemTag));
}
}
}
示例15: fromBytes
import cpw.mods.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes ( ByteBuf buf ) {
try {
if ( buf . readBoolean ( ) ) {
NBTTagCompound data = ByteBufUtils . readTag ( buf ) ;
is = ItemStack . loadItemStackFromNBT ( data ) ;
data = null ;
}
} catch ( Exception ex ) {
ex . printStackTrace ( ) ;
}
}