当前位置: 首页>>代码示例>>Java>>正文


Java PacketBuffer.readCompoundTag方法代码示例

本文整理汇总了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);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:34,代码来源:PacketUpdateGui.java

示例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);
  }
}
 
开发者ID:ToroCraft,项目名称:Minecoprocessors,代码行数:10,代码来源:MessageBookCodeData.java

示例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();
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:14,代码来源:PacketNotebookOpened.java

示例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();
	}

}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:16,代码来源:PacketItemAnimaChanged.java

示例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();
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:12,代码来源:ClientToServerPacket.java

示例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);
	}
}
 
开发者ID:Arez0101,项目名称:Dynamic-GUIs,代码行数:13,代码来源:PacketToServer.java

示例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);
	}
}
 
开发者ID:Arez0101,项目名称:Dynamic-GUIs,代码行数:14,代码来源:PacketToClient.java


注:本文中的net.minecraft.network.PacketBuffer.readCompoundTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。