/** * Handles tile entites that are being received by the client as part of a full chunk. */ @Override public void handleUpdateTag( NBTTagCompound tag ) { final ByteBuf stream = Unpooled.copiedBuffer( tag.getByteArray( "X" ) ); if( this.readUpdateData( stream ) ) { this.markForUpdate(); } }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); if( data.hasKey( "dots" ) ) { this.readBuffer( Unpooled.copiedBuffer( data.getByteArray( "dots" ) ) ); } }
/** * Load ROM data from the specified NBT tag. * * @param nbt the tag to load the data from. * @return the data loaded from the tag. */ public static byte[] loadFromNBT(@Nullable final NBTTagCompound nbt) { if (nbt != null) { return nbt.getByteArray(TAG_DATA); } return EMPTY_DATA; }
public static void handleNBTPacket(NBTTagCompound tagCompound) { try { INSTANCE.injectPacket(tagCompound.getByteArray("CoFH:data")); } catch (Exception e) { FMLLog.severe("Unable to handle CoFH packet!"); e.printStackTrace(); } }
@Override public void handleUpdateTag(NBTTagCompound tag) { byte[] updateData = tag.getByteArray("d"); ByteBuf backedBuffer = Unpooled.copiedBuffer(updateData); receiveInitialSyncData(new PacketBuffer(backedBuffer)); }
@Override public void handlePacketData(NBTTagCompound data) { if (data.hasKey("checkedMap")) { checkedMap = data.getByteArray("checkedMap"); refreshGui(); } }
public static byte[] getSideCacheFromNBT(NBTTagCompound tag, byte[] defaultSides) { if (tag == null) { return defaultSides.clone(); } byte[] retSides = tag.getByteArray(CoreProps.SIDE_CACHE); return retSides.length < 6 ? defaultSides.clone() : retSides; }
public static byte[] getByteArray(ItemStack stack, String key, byte[] defaultValue) { if (!keyExists(stack, key)) { return defaultValue; } return getTagCompound(stack).getByteArray(key); }
@Override public void readFromNBT(NBTTagCompound nbttagcompound) { _filterInventory.readFromNBT(nbttagcompound, ""); _isDefaultRoute = nbttagcompound.getBoolean("defaultdestination"); if (nbttagcompound.hasKey("ignoreData")) { ignoreData = BitSet.valueOf(nbttagcompound.getByteArray("ignoreData")); ignoreNBT = BitSet.valueOf(nbttagcompound.getByteArray("ignoreNBT")); } }
@Override public StatCollector read(Registry registry, Set<NBTAction> phase, NBTTagCompound nbt, Type type, String name, @Nullable StatCollector object) throws IllegalArgumentException, IllegalAccessException, InstantiationException, NoHandlerFoundException { if (object == null) { throw new IllegalArgumentException(); } NBTTagCompound tag = nbt.getCompoundTag(name); object.setPos(tag.getInteger("pos")); object.setCollectCount(tag.getInteger("count")); object.setData(tag.getByteArray("data")); return object; }
@SideOnly(Side.CLIENT) public static void readStreamableFromNbt(IStreamable streamable, NBTTagCompound nbt) { if (nbt.hasKey("dataBytes")) { byte[] bytes = nbt.getByteArray("dataBytes"); PacketBufferForestry data = new PacketBufferForestry(Unpooled.wrappedBuffer(bytes)); try { streamable.readData(data); } catch (IOException e) { Log.error("Failed to read streamable data", e); } } }
public static byte[] getSideCache(ItemStack stack, byte[] defaultSides) { if (stack.getTagCompound() == null) { return defaultSides.clone(); } byte[] retSides = stack.getTagCompound().getByteArray(CoreProps.SIDE_CACHE); return retSides.length < 6 ? defaultSides.clone() : retSides; }
public static byte[] getSideCache(ItemStack stack) { if (stack.getTagCompound() == null) { return DEFAULT_SIDES.clone(); } byte[] retSides = stack.getTagCompound().getByteArray(CoreProps.SIDE_CACHE); return retSides.length < 6 ? DEFAULT_SIDES.clone() : retSides; }
@Override public void readFromNBT(final NBTTagCompound nbt) { super.readFromNBT(nbt); load(nbt.getByteArray(TAG_MEMORY)); address = nbt.getByte(TAG_ADDRESS); state = EnumUtils.readFromNBT(State.class, TAG_STATE, nbt); }
@Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { NBTTagCompound updateTag = pkt.getNbtCompound(); NBTTagList tagList = updateTag.getTagList("d", NBT.TAG_COMPOUND); for(int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound entryTag = tagList.getCompoundTagAt(i); int discriminator = entryTag.getInteger("i"); byte[] updateData = entryTag.getByteArray("d"); ByteBuf backedBuffer = Unpooled.copiedBuffer(updateData); receiveCustomData(discriminator, new PacketBuffer(backedBuffer)); } }
public static void draw(NBTTagCompound nbt, float margeX, float margeY, String textHeader) { if (nbt == null) return; byte[] data = nbt.getByteArray("log"); if (data == null) return; draw(data, data.length, nbt.getFloat("samplingPeriod"), nbt.getFloat("maxValue"), nbt.getFloat("minValue"), nbt.getByte("unitType"), margeX, margeY, textHeader); } }
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); if (tag.hasKey("targetMap")) { targetMap = tag.getByteArray("targetMap"); } plantableInventory.deserializeNBT(tag.getCompoundTag("plantableInventory")); miscInventory.deserializeNBT(tag.getCompoundTag("miscInventory")); }
@Override protected void readFromNBTCommon(final NBTTagCompound nbt) { super.readFromNBTCommon(nbt); decompressClosed(nbt.getByteArray(TAG_LOCKED), locked); final NBTTagCompound inventoryNbt = nbt.getCompoundTag(TAG_INVENTORY); inventory.readFromNBT(inventoryNbt); final NBTTagCompound casingNbt = nbt.getCompoundTag(TAG_CASING); casing.readFromNBT(casingNbt); }
@Override public byte[] getHeraldry(ItemStack stack) { if(!stack.hasTagCompound()){ stack.setTagCompound(new NBTTagCompound()); } if(!stack.getTagCompound().hasKey(heraldryTag)){ stack.getTagCompound().setByteArray(heraldryTag, SigilHelper.getDefault()); } return stack.getTagCompound().getByteArray(heraldryTag); }
@Override public void deserialize(NBTTagCompound tag) { super.deserialize(tag); isSlave = tag.getBoolean("isSlave"); direction = EnumFacing.getFront(tag.getInteger(Constants.NBT.DIRECTION)); connectedPos = new BlockPos(tag.getInteger(Constants.NBT.X_COORD), tag.getInteger(Constants.NBT.Y_COORD), tag.getInteger(Constants.NBT.Z_COORD)); burnTime = tag.getInteger("burnTime"); ticksRequired = tag.getInteger("ticksRequired"); byte[] array = tag.getByteArray("blockedSlots"); for (int i = 0; i < array.length; i++) blockedSlots[i] = array[i] != 0; }