Jump to content

Focamacho

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by Focamacho

  1. I first transform the blocks into ItemStack and then compare them using: if(OreDictionary.itemMatches(block, blockRightClicked, false)) { return true; }
  2. That's exactly what I was looking for. Using: new ItemStack (Block blockIn, int amount, int meta) it works perfectly. Thanks for the info!
  3. I need to compare one block with another, but I do not know how to do this, because the block I need contains a subid. Example: I need to do something like this: if(blockClicked == elementiumBlock){ do this; } But I don't know how to get the correct block to comparison.
  4. Using PickBlock() is working perfectly. Many thanks to all for the help!
  5. It's working fine now with vanilla logs, but for some reason it don't works with Biomes o plenty logs. New code: public boolean checkBlockOreDict(ItemStack blockItem, NonNullList<ItemStack> oreDict) { System.out.println("OreDict: " + oreDict); System.out.println("Block right-clicked: " + blockItem); for(ItemStack item : oreDict) { System.out.println("Testing now: " + item); if(OreDictionary.itemMatches(item, blockItem, false)) { System.out.println("Match: yes"); return true; } } System.out.println("Match: no"); return false; } Console Output:
  6. I'm having trouble comparing one item and another. get right-clicked block: public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){ ItemStack itemstack = player.getHeldItem(hand); IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); ItemStack blockItem = new ItemStack(block); get oredictionary: public static final List<ItemStack> logWood = OreDictionary.getOres("logWood"); comparing right-clicked block & oredictionary: public boolean checkBlockOreDict(ItemStack blockItem, List<ItemStack> oreDict) { System.out.println("OreDict: " + oreDict); System.out.println("Block right-clicked: " + blockItem); for(ItemStack item : oreDict) { if(blockItem.isItemEqualIgnoreDurability(item)) { System.out.println("Match: yes"); return true; } } System.out.println("Match: no"); return false; } console output:
  7. I want to check if an item contains certain OreDictionary. Something like: If(ThisItem.OreDictionary.contains("oreCopper"){ } Is it possible?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.