本文整理汇总了Java中net.minecraftforge.fml.common.network.ByteBufUtils.readTag方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufUtils.readTag方法的具体用法?Java ByteBufUtils.readTag怎么用?Java ByteBufUtils.readTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.fml.common.network.ByteBufUtils
的用法示例。
在下文中一共展示了ByteBufUtils.readTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
healingCfg = new FirstAidConfig.ExternalHealing();
healingCfg.allowNaturalRegeneration = buf.readBoolean();
healingCfg.allowOtherHealingItems = buf.readBoolean();
healingCfg.sleepHealing = buf.readFloat();
healingCfg.otherRegenMultiplier = buf.readDouble();
healingCfg.naturalRegenMultiplier = buf.readDouble();
damageCfg = new FirstAidConfig.DamageSystem();
damageCfg.maxHealthHead = buf.readByte();
damageCfg.maxHealthLeftArm = buf.readByte();
damageCfg.maxHealthLeftLeg = buf.readByte();
damageCfg.maxHealthLeftFoot = buf.readByte();
damageCfg.maxHealthBody = buf.readByte();
damageCfg.maxHealthRightArm = buf.readByte();
damageCfg.maxHealthRightLeg = buf.readByte();
damageCfg.maxHealthRightFoot = buf.readByte();
scaleMaxHealth = buf.readBoolean();
playerDamageModel = ByteBufUtils.readTag(buf);
}
示例2: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
super.fromBytes(buf);
type = IDescSynced.Type.values()[buf.readByte()];
int dataAmount = buf.readInt();
types = new byte[dataAmount];
values = new Object[dataAmount];
for (int i = 0; i < dataAmount; i++) {
types[i] = buf.readByte();
values[i] = PacketUpdateGui.readField(buf, types[i]);
}
extraData = ByteBufUtils.readTag(buf);
}
示例3: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
super.fromBytes(buf);
if (buf.readBoolean())
settingStack = new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
settingIndex = buf.readInt();
}
示例4: getFluidOrItemStack
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
public static Object getFluidOrItemStack(ByteBuf buf) {
if (buf.readByte() == 0) {
return ByteBufUtils.readItemStack(buf);
} else {
return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
}
}
示例5: readField
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
public static Object readField(ByteBuf buf, int type) {
switch (type) {
case 0:
return buf.readInt();
case 1:
return buf.readFloat();
case 2:
return buf.readDouble();
case 3:
return buf.readBoolean();
case 4:
return ByteBufUtils.readUTF8String(buf);
case 5:
return buf.readByte();
case 6:
return ByteBufUtils.readItemStack(buf);
case 7:
if (!buf.readBoolean()) return null;
return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
case 8:
try {
PacketBuffer packetBuffer = new PacketBuffer(buf);
NBTTagCompound tag = packetBuffer.readCompoundTag();
if (tag == null) return EmptyHandler.INSTANCE;
ItemStackHandler handler = new ItemStackHandler();
handler.deserializeNBT(tag);
return handler;
} catch (IOException e) {
return EmptyHandler.INSTANCE;
}
}
throw new IllegalArgumentException("Invalid sync type! " + type);
}
示例6: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
NBTTagCompound compound = ByteBufUtils.readTag(buf);
for(int i = 0; i < compound.getInteger("size"); i++)
objects[i] = HarshenUtils.deserialize(compound.getByteArray("byte" + i));
}
示例7: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf){
this.x=buf.readInt();
this.y=buf.readInt();
this.z=buf.readInt();
this.tag=ByteBufUtils.readTag(buf);
}
示例8: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
this.energy = buf.readLong();
NBTTagCompound tag = ByteBufUtils.readTag(buf);
NBTTagList list = tag.getTagList("infos", Constants.NBT.TAG_COMPOUND);
this.infos = new ArrayList<>();
for(int i = 0; i < list.tagCount(); i++) {
infos.add(AccumulatorInfo.readFromNBT(list.getCompoundTagAt(i)));
}
}
示例9: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
windowId = buf.readByte();
tank = buf.readByte();
NBTTagCompound fluidNbt = ByteBufUtils.readTag(buf);
fluid = FluidStack.loadFluidStackFromNBT(fluidNbt);
}
示例10: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
layout = ByteBufUtils.readTag(buf);
}
示例11: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
processorData = ByteBufUtils.readTag(buf);
pos = BlockPos.fromLong(buf.readLong());
name = ByteBufUtils.readUTF8String(buf);
}
示例12: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
tag = ByteBufUtils.readTag(buf);
}
示例13: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
this.compound = ByteBufUtils.readTag(buf);
}
示例14: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
this.compound = ByteBufUtils.readTag(buf);
this.entityId = buf.readInt();
}
示例15: fromBytes
import net.minecraftforge.fml.common.network.ByteBufUtils; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
NBTTagCompound nbt = ByteBufUtils.readTag(buf);
handler = HarshenUtils.getHandler(nbt);
handler.deserializeNBT(nbt);
}