@Override public void writeToPacketNBT(NBTTagCompound cmp) { super.writeToPacketNBT(cmp); cmp.setInteger(TAG_COOLDOWN, cooldown); cmp.setInteger(TAG_DIGESTING_MANA, digestingMana); cmp.setTag(TAG_LAST_FOOD, lastFood.writeToNBT(new NBTTagCompound())); cmp.setInteger(TAG_LAST_FOOD_COUNT, lastFoodCount); }
public CraftingLink( final NBTTagCompound data, final ICraftingCPU cpu ) { this.CraftID = data.getString( "CraftID" ); this.setCanceled( data.getBoolean( "canceled" ) ); this.setDone( data.getBoolean( "done" ) ); this.standalone = data.getBoolean( "standalone" ); if( !data.hasKey( "req" ) || data.getBoolean( "req" ) ) { throw new IllegalStateException( "Invalid Crafting Link for Object" ); } this.cpu = cpu; this.req = null; }
@Override public void readPacketNBT(NBTTagCompound cmp) { speed = cmp.getInteger(TAG_SPEED); backwards = cmp.getBoolean(TAG_BACKWARDS); }
public static NBTTagCompound toNative(CompoundTag tag) { NBTTagCompound compound = new NBTTagCompound(); for (Entry<String, Tag> child : tag.getValue().entrySet()) { compound.setTag(child.getKey(), toNative(child.getValue())); } return compound; }
private NBTTagCompound generateLinkData( final String craftingID, final boolean standalone, final boolean req ) { final NBTTagCompound tag = new NBTTagCompound(); tag.setString( "CraftID", craftingID ); tag.setBoolean( "canceled", false ); tag.setBoolean( "done", false ); tag.setBoolean( "standalone", standalone ); tag.setBoolean( "req", req ); return tag; }
@Override public void writePacketNBT(NBTTagCompound cmp) { cmp.setInteger(TAG_SPEED, speed); cmp.setBoolean(TAG_BACKWARDS, backwards); }
@Override public void writeToNBT( final NBTTagCompound data ) { super.writeToNBT( data ); data.setBoolean( "isLocked", this.isLocked ); final NBTTagCompound myItem = new NBTTagCompound(); if( this.configuredItem != null ) { this.configuredItem.writeToNBT( myItem ); } data.setTag( "configuredItem", myItem ); }
@Override public void writePacketNBT(NBTTagCompound cmp) { super.writePacketNBT(cmp); cmp.setString(TAG_SUBTILE_NAME, subTileName); NBTTagCompound subCmp = new NBTTagCompound(); cmp.setTag(TAG_SUBTILE_CMP, subCmp); if(subTile != null) subTile.writeToPacketNBTInternal(subCmp); }
@Override public void writePacketNBT(NBTTagCompound cmp) { cmp.setInteger(TAG_MANA, mana); cmp.setBoolean(TAG_OUTPUTTING, outputting); cmp.setInteger(TAG_COLOR, color.getMetadata()); cmp.setInteger(TAG_MANA_CAP, manaCap); cmp.setBoolean(TAG_CAN_ACCEPT, canAccept); cmp.setBoolean(TAG_CAN_SPARE, canSpare); cmp.setBoolean(TAG_FRAGILE, fragile); cmp.setString(TAG_INPUT_KEY, inputKey); cmp.setString(TAG_OUTPUT_KEY, outputKey); }
@Override public void writeToPacketNBT(NBTTagCompound cmp) { super.writeToPacketNBT(cmp); cmp.setString(TAG_LAST_FLOWER, lastFlower); cmp.setInteger(TAG_LAST_FLOWER_TIMES, lastFlowerTimes); }
private static void addCursor(ItemStack stack, BlockPos pos) { NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_CURSOR_LIST, false); int count = cmp.getInteger(TAG_CURSOR_COUNT); cmp.setTag(TAG_CURSOR_PREFIX + count, cursorToCmp(pos)); cmp.setInteger(TAG_CURSOR_COUNT, count + 1); ItemNBTHelper.setCompound(stack, TAG_CURSOR_LIST, cmp); }
private static String getEntityId(ItemStack stack) { NBTTagCompound tag = getSpawnerTag(stack); if(tag != null && tag.hasKey(TAG_SPAWN_DATA)) { tag = tag.getCompoundTag(TAG_SPAWN_DATA); if(tag.hasKey(TAG_ID)) { return EntityList.getTranslationName(new ResourceLocation(tag.getString(TAG_ID))); } } return null; }
public final void readFromPacketNBTInternal(NBTTagCompound cmp) { if(cmp.hasKey(TAG_TICKS_EXISTED)) ticksExisted = cmp.getInteger(TAG_TICKS_EXISTED); readFromPacketNBT(cmp); }
@Override public void writePacketNBT(NBTTagCompound par1nbtTagCompound) { super.writePacketNBT(par1nbtTagCompound); par1nbtTagCompound.setInteger(TAG_TIME, time); par1nbtTagCompound.setFloat(TAG_TIME_FRACTION, timeFraction); par1nbtTagCompound.setBoolean(TAG_FLIP, flip); par1nbtTagCompound.setInteger(TAG_FLIP_TICKS, flipTicks); par1nbtTagCompound.setBoolean(TAG_MOVE, move); par1nbtTagCompound.setBoolean(TAG_LOCK, lock); }
@Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); if(compound.hasKey("fly_stack")) { stack = new ItemStack(compound.getCompoundTag("fly_stack")); } setFire(compound.getBoolean("flare")); }
public static NBTTagCompound getSpawnerTag(ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); if(tag != null && tag.hasKey(TAG_SPAWNER)) { return tag.getCompoundTag(TAG_SPAWNER); } return null; }
@Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) { if(stack.getTagCompound() != null && stack.getTagCompound().hasKey(TAG_ITEMS)) { NBTTagList oldData = stack.getTagCompound().getTagList(TAG_ITEMS, Constants.NBT.TAG_COMPOUND); IItemHandler newInv = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(newInv, null, oldData); stack.getTagCompound().removeTag(TAG_ITEMS); if(stack.getTagCompound().getSize() == 0) stack.setTagCompound(null); } }
@Override public void readFromPacketNBT(NBTTagCompound cmp) { super.readFromPacketNBT(cmp); cooldown = cmp.getInteger(TAG_COOLDOWN); digestingMana = cmp.getInteger(TAG_DIGESTING_MANA); lastFood = new ItemStack(cmp.getCompoundTag(TAG_LAST_FOOD)); lastFoodCount = cmp.getInteger(TAG_LAST_FOOD_COUNT); }
@Override public void readPacketNBT(NBTTagCompound par1nbtTagCompound) { super.readPacketNBT(par1nbtTagCompound); time = par1nbtTagCompound.getInteger(TAG_TIME); timeFraction = par1nbtTagCompound.getFloat(TAG_TIME_FRACTION); flip = par1nbtTagCompound.getBoolean(TAG_FLIP); flipTicks = par1nbtTagCompound.getInteger(TAG_FLIP_TICKS); move = par1nbtTagCompound.getBoolean(TAG_MOVE); lock = par1nbtTagCompound.getBoolean(TAG_LOCK); }
@Override public NBTTagCompound getData( final ItemStack is ) { final NBTTagCompound c = Platform.openNbtData( is ); NBTTagCompound o = c.getCompoundTag( "Data" ); if( o == null ) { o = new NBTTagCompound(); } return o.copy(); }