Filled [Request] Magnet mode

Discussion in 'Archived: Plugin Requests' started by CatzFuriousSpeed, May 12, 2014.

  1. Offline


    Fortune is already in it, xp is glitched so it was dropped and I'll add obsidian.
  2. Fortune doesnt seem to be working, exp wasnt dropping either.

    (I Re-Posted it, with a proper request)
  3. Offline


    Like I said XP doesnt work it glitches, and fortune works mine a block diamond without it and try with it
  4. Oh, sorry for the stupidity of mine, My players were complaining that it didnt work also would you be able to make XP just drop out from the ores with XP? (I think you should maybe read my other post, my request on this thread is poor and has no secure answer into what I want exactly.)

    Sorry for the recent inconvenience all, if possible could you please add it so that the fortune on the players pickaxe's work as intended and also if players hit a ore like diamond ore or emerald ore and coal ore (Not Gold or iron) the exp just drops out the block?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 8, 2016
  5. Offline


    Whats the highest fortune level u have
  6. Offline


    Onlineids to stop the protected blocks bit, check this before executing all code;

    if(!e.isCancellled()) {}
  7. Offline

    timtower Administrator Administrator Moderator

    @EventHandler(ignoreCanceled = true)
    Garris0n likes this.
  8. Offline


    For the third time -_- ive already fixed that
  9. The highest is 50
  10. Offline


    so you want me to replicate fortune on 50 fortune levels..
  11. If you could that'd be awesome.
  12. Offline


    That was sarcasm, you do realize that's not some easy task....50 levels of fortune with different drops for each one... jeez good luck your on your own there.
  13. Oh :I I do realize oh well.
  14. Offline


    When you say "replicate"...are you doing the check manually?

    Edit: Actually, that method is misleading. I'll search for a proper nms method in a bit.
  15. Offline



    Hey I made a plugin at one point called personal pickup that did what the guy asked and what you're making. Here are a few pointers:
    • Container blocks like chests, brewing stands, and furnaces are all accessible and you can support them and get their inventory on block break
    • Inventory.addItem() returns a hashmap of overflow items that you can drop on the ground if the player can't hold all the items from a drop
    • A lot of your custom drop code (which you will see I will talk about below) can start with a silk touch check and just return the block broken for the drop
    • You will need to add a random chance of seed drops when they break fully grown wheat
    • You can account for fortune through a built in nms function that I found in the NMS block class
    The nms function to get the number of your drops is getDropCount(loot bonus int, random)
    you can use it similar to what I have below. The tile entity skull check in the code below was mimicking something that nms code did, can't remember exactly what it was there for, but im sure it has to do with player heads being broken correctly.

    Here is a function that I used that took the Bukkit block and the item in the players hand and returned a fairly good result for the items that would come out. I made this because of the fact that the bukkit break block event doesn't give you anything reliable based on the item being used to break said block. It isn't perfect and I haven't used or maintained this code in a while. It is also obfuscated because I don't have my source anymore but fairly easy to follow.
    2. private Collection<org.bukkit.inventory.ItemStack> a(org.bukkit.block.Block block, org.bukkit.inventory.ItemStack item) {
    3. if (block.getDrops(item).isEmpty())
    4. return Collections.emptyList();
    5. if (item.containsEnchantment(Enchantment.SILK_TOUCH)) {
    6. List blodro = new ArrayList();
    7. blodro.add(new org.bukkit.inventory.ItemStack(block.getType()));
    8. return blodro;
    9. }
    10. List drops = new ArrayList();
    11. if ((block.getType() == Material.CROPS) && (block.getData() == 7)) {
    12. org.bukkit.inventory.ItemStack seeds = new org.bukkit.inventory.ItemStack(Material.SEEDS, new Random().nextInt(3));
    13. drops.add(seeds);
    14. }
    15. net.minecraft.server.v1_5_R2.Block b = net.minecraft.server.v1_5_R2.Block.byId[block.getTypeId()];
    16. if (b != null) {
    17. byte data = block.getData();
    18. int count = b.getDropCount(item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS), ((CraftChunk)block.getChunk()).getHandle().world.random);
    19. for (int i = 0; i < count; i++) {
    20. int ite = b.getDropType(data, ((CraftChunk)block.getChunk()).getHandle().world.random, 0);
    21. if ( == block.getTypeId()) {
    22. net.minecraft.server.v1_5_R2.ItemStack nmsStack = new net.minecraft.server.v1_5_R2.ItemStack(ite, 1, b.getDropData(((CraftChunk)block.getChunk()).getHandle().world, block.getX(), block.getY(), block.getZ()));
    23. TileEntitySkull tileentityskull = (TileEntitySkull)((CraftChunk)block.getChunk()).getHandle().world.getTileEntity(block.getX(), block.getY(), block.getZ());
    24. if ((tileentityskull.getSkullType() == 3) && (tileentityskull.getExtraType() != null) && (tileentityskull.getExtraType().length() > 0)) {
    25. nmsStack.setTag(new NBTTagCompound());
    26. nmsStack.getTag().setString("SkullOwner", tileentityskull.getExtraType());
    27. }
    28. drops.add(CraftItemStack.asBukkitCopy(nmsStack));
    29. } else {
    30. drops.add(new org.bukkit.inventory.ItemStack(ite, 1, (short)b.getDropData(data)));
    31. }
    32. }
    33. }
    34. return drops;
    35. }
    CatzFuriousSpeed likes this.
  16. Offline


  17. I think I know the solution to this, could you only make it so they can only pick the blocks? and not the ores?. ((Also add Obsidian))


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 8, 2016
  18. Offline

    timtower Administrator Administrator Moderator

  19. I have found a alternative to what I wanted, sorry for all the inconvenience and confusion and thanks all for be a great sport
  20. Offline


    this doesnt work anymore.
  21. Offline

    timtower Administrator Administrator Moderator

    Able to prove that?

Share This Page