public TestLookup( final int slot, final Item item, final int dmg ) { this.slot = slot; this.ref = ( dmg << Platform.DEF_OFFSET ) | ( Item.getIdFromItem( item ) & 0xffff ); final int offset = 3 * slot; this.hash = ( this.ref << offset ) | ( this.ref >> ( offset + 32 ) ); }
@SideOnly(Side.CLIENT) @Override public void handleStatusUpdate(byte id) { if(id == 3) { for(int j = 0; j < 16; j++) { world.spawnParticle(EnumParticleTypes.ITEM_CRACK, posX, posY, posZ, Math.random() * 0.2 - 0.1, Math.random() * 0.25, Math.random() * 0.2 - 0.1, Item.getIdFromItem(ModItems.vineBall)); } } }
public AESharedItemStack( final ItemStack itemStack ) { this.itemStack = itemStack; this.itemId = Item.getIdFromItem( itemStack.getItem() ); this.itemDamage = itemStack.getItemDamage(); }
@Override public void writeToStream( final ByteBuf out ) throws IOException { int facadeSides = 0; for( int x = 0; x < this.facades; x++ ) { if( this.getFacade( AEPartLocation.fromOrdinal( x ) ) != null ) { facadeSides |= ( 1 << x ); } } out.writeByte( (byte) facadeSides ); for( int x = 0; x < this.facades; x++ ) { final IFacadePart part = this.getFacade( AEPartLocation.fromOrdinal( x ) ); if( part != null ) { final int itemID = Item.getIdFromItem( part.getItem() ); final int dmgValue = part.getItemDamage(); out.writeInt( itemID * ( part.notAEFacade() ? -1 : 1 ) ); out.writeInt( dmgValue ); } } }
public void writeToStream( final ByteBuf data ) throws IOException { int sides = 0; for( int x = 0; x < 7; x++ ) { final IPart p = this.getPart( AEPartLocation.fromOrdinal( x ) ); if( p != null ) { sides |= ( 1 << x ); } } data.writeByte( (byte) sides ); for( int x = 0; x < 7; x++ ) { final IPart p = this.getPart( AEPartLocation.fromOrdinal( x ) ); if( p != null ) { final ItemStack is = p.getItemStack( PartItemStack.NETWORK ); data.writeShort( Item.getIdFromItem( is.getItem() ) ); data.writeShort( is.getItemDamage() ); p.writeToStream( data ); } } this.getFacadeContainer().writeToStream( data ); }
@Override public int compare(PainterRecipeWrapper o1, PainterRecipeWrapper o2) { int compare = Integer.compare(Item.getIdFromItem(o1.target.getItem()), Item.getIdFromItem(o2.target.getItem())); if (compare == 0) { compare = Integer.compare(Item.getIdFromItem(o1.paints.get(0).getItem()), Item.getIdFromItem(o2.paints.get(0).getItem())); } return compare; } }
@Override public void onUpdate() { super.onUpdate(); if (supertile.getWorld().isRemote) return; Item wool = Item.getItemFromBlock(Blocks.WOOL); List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1))); int slowdown = getSlowdownFactor(); for(EntityItem item : items) { ItemStack stack = item.getItem(); if(!stack.isEmpty() && stack.getItem() == wool && !item.isDead && item.age >= slowdown) { int meta = stack.getItemDamage(); if(meta == nextColor) { mana = Math.min(getMaxMana(), mana + 2400); nextColor = nextColor == 15 ? 0 : nextColor + 1; sync(); ((WorldServer) supertile.getWorld()).spawnParticle(EnumParticleTypes.ITEM_CRACK, false, item.posX, item.posY, item.posZ, 20, 0.1D, 0.1D, 0.1D, 0.05D, Item.getIdFromItem(stack.getItem()), stack.getItemDamage()); } item.setDead(); } } }
@SideOnly(Side.CLIENT) public void handleStatusUpdate(byte id) { if (id == 3) { for (int i = 0; i < 8; ++i) { this.world.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double) this.rand.nextFloat() - 0.5D) * 0.08D, ((double) this.rand.nextFloat() - 0.5D) * 0.08D, ((double) this.rand.nextFloat() - 0.5D) * 0.08D, new int[]{Item.getIdFromItem(ModItems.hippogryph_egg)}); } } }
((WorldServer) supertile.getWorld()).spawnParticle(EnumParticleTypes.ITEM_CRACK, supertile.getPos().getX()+offset.x, supertile.getPos().getY()+offset.y, supertile.getPos().getZ()+offset.z, 10, 0.1D, 0.1D, 0.1D, 0.03D, Item.getIdFromItem(lastFood.getItem()), lastFood.getItemDamage()); item.playSound(SoundEvents.ENTITY_GENERIC_EAT, 0.2F, 0.6F); sync(); ((WorldServer) supertile.getWorld()).spawnParticle(EnumParticleTypes.ITEM_CRACK, false, item.posX, item.posY, item.posZ, 20, 0.1D, 0.1D, 0.1D, 0.05D, Item.getIdFromItem(stack.getItem()), stack.getItemDamage());
@Override public void writePacketData(PacketBuffer buf) { int itemId = Item.getIdFromItem(itemStack.getItem()); buf.writeShort(itemId); }
@Override public void writeToByteBuf(ByteBuf buf) { buf.writeInt(Item.getIdFromItem(stack.getItem())); buf.writeInt(stack.getMetadata()); ByteBufUtils.writeTag(buf, stack.getTagCompound()); buf.writeInt(available); buf.writeBoolean(missing); buf.writeInt(toCraft); }
@Override public void writeToByteBuf(ByteBuf buf) { buf.writeInt(type.ordinal()); buf.writeInt(Item.getIdFromItem(stack.getItem())); buf.writeInt(stack.getMetadata()); ByteBufUtils.writeTag(buf, stack.getTagCompound()); }
static ItemStack findItemStack(String name, int stackSize) { ItemStack stack = GameRegistry.findItemStack("Eln", name, stackSize); if (stack == null) { stack = dictionnaryOreFromMod.get(name); stack = Utils.newItemStack(Item.getIdFromItem(stack.getItem()), stackSize, stack.getItemDamage()); } return stack; }
public static void writeItemStack(ByteBuf buf, ItemStack stack) { buf.writeInt(Item.getIdFromItem(stack.getItem())); buf.writeInt(stack.getCount()); buf.writeShort(stack.getItemDamage()); ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack)); }
@Override public void writeItemIdentifier(@Nullable ItemIdentifier item) { if (item == null) { writeInt(0); } else { writeInt(Item.getIdFromItem(item.item)); writeInt(item.itemDamage); writeNBTTagCompound(item.tag); } }
public boolean equals(ItemStack itemStack) { if (itemStack != null) { return getDamage() == itemStack.getItemDamage() && getItemID() == Item.getIdFromItem(itemStack.getItem()); } return false; }
BotaniaAPI.blackListItemFromLoonium(overgrowthSeed); BotaniaAPI.blackListItemFromLoonium(blackLotus); int min = Item.getIdFromItem(Items.RECORD_13); int max = Item.getIdFromItem(Items.RECORD_WAIT); for(int i = min; i <= max; i++) BotaniaAPI.blackListItemFromLoonium(Item.getItemById(i));
public static NBTTagCompound writeItemStackToNBT(ItemStack stack, int amount, NBTTagCompound nbt) { nbt.setShort("id", (short) Item.getIdFromItem(stack.getItem())); nbt.setInteger("Count", amount); nbt.setShort("Damage", (short) getItemDamage(stack)); if (stack.hasTagCompound()) { nbt.setTag("tag", stack.getTagCompound()); } return nbt; }
private void writeItemStack(ItemStack theStack) throws IOException { if (theStack.isEmpty()) { addShort(-1); } else { addShort(Item.getIdFromItem(theStack.getItem())); addByte(theStack.getCount()); addShort(ItemHelper.getItemDamage(theStack)); writeNBT(theStack.getTagCompound()); } }
@Override public void writeData(LPDataOutput output) { super.writeData(output); if (getStack() != null) { output.writeInt(Item.getIdFromItem(getStack().getItem())); output.writeInt(getStack().getCount()); output.writeInt(getStack().getItemDamage()); output.writeNBTTagCompound(getStack().getTagCompound()); } else { output.writeInt(0); } }