本文整理汇总了Java中net.minecraft.network.PacketBuffer.readCompoundTag方法的典型用法代码示例。如果您正苦于以下问题:Java PacketBuffer.readCompoundTag方法的具体用法?Java PacketBuffer.readCompoundTag怎么用?Java PacketBuffer.readCompoundTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.network.PacketBuffer
的用法示例。
在下文中一共展示了PacketBuffer.readCompoundTag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readField
import net.minecraft.network.PacketBuffer; //导入方法依赖的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);
}
示例2: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(final ByteBuf buf) {
final PacketBuffer buffer = new PacketBuffer(buf);
try {
nbt = buffer.readCompoundTag();
} catch (final IOException e) {
Minecoprocessors.proxy.logger.warn("Invalid packet received.", e);
}
}
示例3: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
PacketBuffer pbuf = new PacketBuffer(buf);
try
{
notebookInfo = pbuf.readCompoundTag();
} catch (IOException e)
{
e.printStackTrace();
}
}
示例4: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
PacketBuffer pbuf = new PacketBuffer(buf);
slot = pbuf.readInt();
try
{
cap = pbuf.readCompoundTag();
stack = pbuf.readItemStack();
} catch (IOException e)
{
e.printStackTrace();
}
}
示例5: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
PacketBuffer beef = new PacketBuffer(buf);
try {
handler = PacketHandler.HANDLERS.get(buf.readInt());
data = beef.readCompoundTag();
} catch(Exception e) {
Solar.LOG.error("[Packet] Failed to receive packet");
e.printStackTrace();
}
}
示例6: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
PacketBuffer buffer = new PacketBuffer(buf);
try {
this.tag = buffer.readCompoundTag();
this.handler = ButtonHandler.GUI_BUTTON_HANDLER;
}
catch (Exception e) {
DynamicGUIs.LOGGER.error("An error occured trying to read a server packet.", e);
}
}
示例7: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
PacketBuffer buffer = new PacketBuffer(buf);
try {
this.tag = buffer.readCompoundTag();
int id = buffer.readInt();
this.handler = ButtonHandler.GUI_BUTTON_HANDLER;
}
catch (Exception e) {
DynamicGUIs.LOGGER.error("An error occured trying to read a client packet.", e);
}
}