[INACTIVE][MECH] BlockDrops v2.31 - Add and customize the items anything drops! [185+]

Discussion in 'Inactive/Unsupported Plugins' started by Snowl, Jan 25, 2011.

  1. Offline

    Snowl

    BlockDrops - Add and Customize the items your blocks ANYTHING drops!
    Version: 2.31
    By Request of http://forums.bukkit.org/threads/custom-drops-please.1198/#post-24213

    Ever wanted your dirt to drop a chainmail helmet? Want your sand to drop diamonds? Here's the answer!

    BlockDrops is a plugin that allows you to customize what your vehicles/blocks/mobs drop.

    Features (open)

    Features:
    • *Infinite* Block Drops per block
    • Any block is customize-able
    • Percentage System
    • Drop damaged blocks (different dyes dropped, different cloths)
    • Drop on break of boat/minecart
    • Drop on Creeper Explode
    • Drop on mob death



    Thanks to http://forums.bukkit.org/threads/kitplugin-v1-02-dispense-kits-to-your-players.1201/ for the properties help.

    Available blocks/mobs/vehicles to drop from:
    Blocks (open)

    All blocks, past and future.
    Monsters (open)

    • CreeperExploded
    • Spider
    • Skeleton
    • Zombie
    • Player
    • Cow
    • Chicken
    • Giant
    • Ghast
    • Pig
    • Creeper
    • Sheep
    • Slime
    Vehicles (open)


    • Boat
    • Minecart
    • PoweredMinecraft
    • StorageMinecraft


    How to use BlockDrops:
    How to Use (open)

    Create a file in the directory where CraftBukkit is, called "blockdrops.properties". This is where you adjust what drops what.
    Open up blockdrops.properties
    Add your custom drops. The format for adding drops is
    [Block/Monster/Vehicle];[Block/Item you want to drop]:[Chance for drop (Range 0.0001 to 1.0)]

    Extra options (only for blocks) are
    [Block/Monster/Vehicle];[Block/Item you want to drop]:[Chance for drop (Range 0.0001 to 1.0)]:[Damage the item has (Range from -127 to 127. Normal is 0)]:[Block/Item held to make Block/Item drop]
    You require the damage option if you have the Block/Item option, but both are optional.

    To make a Vehicle/Block/Mob not drop it's normal blocks add [Vehicle/Drop/Mob]=0 to override it.

    An example blockdrops.properties:
    Code:
    #blockdrops.properties
    #Overwrite stone's drops
    1=0
    #Always drop a cake
    1;92:1.0
    #Drop a broken wooden pickaxe 0.1% of the time
    1;270:0.001:100
    #Make a note block drop a boat
    25;333:1.0
    #Make a creeper drop a stone
    Creeper;1:1.0
    #Make a boat return a boat
    Boat=0
    Boat;333:1.0
    

    Changelog (open)
    Changelog:
    Version 2.31:
    • Fixed the WorldGuard and any other protected blocks issue.
    Version 2.3:
    • Fixed a bug where breaking a block but not breaking it at the last millisecond caused it to drop the item
    • Fixed a bug where breaking a block while protected by WorldGuard made it drop the item
    • Added creation of blockdrops.properties on startup
    Version 2.2:
    • Added overwrite for mobs
    Version 2.1:
    • Fixed version issues
    • Fixed Override issues
    Version 2.0:
    • Added dropping from every mob and animal, PoweredMinecraft and StorageMinecraft
    Version 1.5:
    • Added dropping from a boat or minecart when destroyed (besides when broken by itself)
    Version 1.45:
    • Added drops when using a certain tool
    Version 1.4:
    • Fixed a critical bug that would crash the client, stop saving of players data and NPE's after prolonged usage (again PropertiesFile >_<)
    Version 1.3:
    • Added damage for blocks so you can drop different wool colours and wool dyes (An example drop with damage is 1:351:1.0:11
    Version 1.2e:
    • Fixed a bug where propertiesfile overwrit the file.
    • Uploaded new version where fake lag is introduced to fix a bug.
    Version 1.2d:
    • Fixed a bug where destroying a block that had it's normal drop overwritten caused the next block to break slightly faster with a shovel.
    • Changed overwrite setting to [BLOCK]=0
    Version 1.2c:
    • Actually fixed a bug where destroying a block that had its normal drop overwritten destroyed a block next to it properly
    Version 1.2b:
    • Fixed a bug where destroying a block that had its normal drop overwritten destroyed a block next to it
    Version 1.2:
    • Adding 0:0.0 now overrides the normal blocks drop.
    Version 1.1:
    • You can now customize what a creeper drops once it explodes.
    Version 1.0:
    • Infinite block drops per block
    • Drops now drop at the block
    Version 0.7:
    • Bugfixes and in-ability to spawn air (as that corrupts the world)
    Version 0.6:
    • Percentage system implemented
    Version 0.5:
    • One custom drop per block
    Version 0.1:
    • Dropping blocks working
    • Initial Release
     

    Attached Files:

  2. Offline

    Snowl

    Sadly, yes. Itemstack won't take a short which is what I want :( only a byte which is -127 to 127)
     
  3. Offline

    Beatkidz

    Version in plugin still says 1.2
     
  4. Offline

    Snowl

    Updated.
     
  5. Offline

    Beatkidz

    and i would LOVE to change all mob drops on death. like "MobDrops" for Hmod
     
  6. Offline

    Snowl

  7. Offline

    Euphoriant

    Well, at least its something!

    On a different note, I decided to mess around and give myself some diamond tools to test out how even faster digging responded and it seemed to get a little buggy. Not nearly as bad as it was before, but I did notice adjacent block breakage, and even slight block disappearing in general. That was on dirt, though, which breaks pretty quick anyways. On blocks that take longer no matter what kind of tools, like ore or wood, it seemed to behave just fine. Does this have something to do with your code (the way that you're able to get blocks to drop), or perhaps something in the client or the craftbukkit?
     
  8. Offline

    Snowl

    It's just the way craftbukkit handles it. BlockDamage reports BROKEN a millisecond or so before/after it actually is broken, and to override the drop I have to change the block ID to air. This is also how CustomDrops worked. It almost always reports before the block breaks (which is what you want), but when it reports after its broken, if you have targeted a new block, it gets that block and converts it to air and drops the custom drops.
    Infact, I think I may have solved this. I'll do some testing with the lag off and my other fix.
    EDIT: nope :( oh well hahah
     
  9. Offline

    Euphoriant

    I seeeeee. That actually makes a lot of sense, considering my total lack of any coding language. So is this something that would most effectively be resolved in a future CraftBukkit release, as opposed to wacky fake lag work-arounds on your end?
     
  10. Offline

    Snowl

    Actually, it was some error on my end as well :L I had the getBlock outside of the thing that detected if the block was broken. Try updating now, the wacky lag fix is gone and I tried with a diamond shovel and it worked fine :D

    FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUuuuuuuuuuu i just had it quick break again >_< i'll reupload 1.4 >_<
     
  11. Offline

    Euphoriant

    I think you still have 1.5 up, unless youre testing something before uploading.
     
  12. Offline

    Snowl

    Recompiled with 1.4 and the bug fix.
     
  13. Offline

    HotelErotica

    @david Diaz
    Love the plugin getting this error with the latest version randomly.

    Code:
    Jan 26, 2011 3:37:49 AM org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event BLOCK_DAMAGED to BlockDrops
    java.lang.NumberFormatException: empty String
            at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
            at java.lang.Double.valueOf(Unknown Source)
            at com.Snowl.bukkit.blockdrops.BlockDropsBlockListener.onBlockDamage(BlockDropsBlockListener.java:65)
            at org.bukkit.plugin.java.JavaPluginLoader.callEvent(JavaPluginLoader.java:176)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:201)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:334)
            at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:65)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:261)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:197)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    
     
  14. Offline

    Snowl

    Post/inbox your blockdrops.properties
     
  15. Offline

    HotelErotica

    Code:
    #blockdrops.properties
    #Layout is [Block that is destroyed];[What item to drop]:[Percentage (1.0 is everytime)]
    #If you want to drop more than one block you do [Block that is destroyed];[What item to drop]:[Percentage (1.0 is everytime)];[Another item to drop]:[Percentage (1.0 is everytime)]
    #If grass is destroyed, drop a note block and a piece of stone.
    
    ######
    #####MISC
    ######
    
    #Glass Drop
    20;20:0.3
    #Break Lightstone might get it back
    89;89:0.09
    #Harvest Ice
    79;79:0.4
    
    ######
    #####Grass Drops
    ######
    
    #Stone Sword
    2;272:0.004
    #Stone Shovel
    2;273:0.004
    #Stone Pickaxe
    2;274:0.004
    #Stone Axe
    2;275:0.004
    #Iron Sword
    2;267:0.003
    #Iron Shovel
    2;256:0.003
    #Iron Pickaxe
    2;257:0.003
    #Iron Axe
    2;258:0.003
    #Diamond Sword
    2;276:0.002
    #Diamond Shovel
    2;277:0.002
    #Diamond Pickaxe
    2;278:0.002
    #Diamond Axe
    2;279:0.002
    #String
    2;287:0.03
    #Bucket
    2;325::0.003
    
    ######
    #####Dirt Drops
    ######
    
    #LightStone
    3;348:0.03
    #Clay
    3;337:0.05
    
    ######
    #####Stone Drops
    ######
    
    #Diamond
    1;264:0.002
    #Coal
    1;263:0.03
    #RedStone
    1;331:0.007
    
    ######
    #####Sand Drops
    ######
    
    #Fishing Rod
    12;346:0.003
    #Stick
    12;280:0.015
    #Arrow
    12;262:0.015
    #Wooden Sword
    12;268:0.006
    #Wooden Shovel
    12;269:0.006
    #Wooden Axe
    12;271:0.006
    #Wooden PickAxe
    12;270:0.006
    --- merged: Jan 27, 2011 11:48 AM ---
    Ohh i see an error on bucket now that i look at it
     
  16. Offline

    Snowl

    Code:
    #Bucket
    2;325::0.003
    should be
    Code:
    #Bucket
    2;325:0.003
     
  17. Offline

    HotelErotica

    Yeah i saw that right after i posted it
     
  18. Offline

    Snowl

  19. lol, theres a bug when i put 89;89:1.0 and reload the plugin IG. when i destroy the lightstone it explodes and out it pops 10 + lightstone and one lightstonedust but its ok if i reload the plugin again.

    Also can you make so a lightstone block drops a lightstone block without that annoying lightstone dust to prevent item farming ?
     
  20. Offline

    barghest

    It works great; I was able to use this to implement SSP's much-less-cruel lapis dye rarity in about 2 minutes. Thanks. :)
     
  21. Offline

    Snowl

    Type this into your blockdrops.properties:
    89=0
     
  22. Offline

    uldamoc

    Hey there! Thanks for actively working on this plugin! This is exactly what I have been waiting for. Now that we can do the 1=0 command to make blocks have a "clean slate", I started going back to edit the blocks to my specifications. But I have now ran into a problem.

    Heres an example:

    # Diamond
    56=0
    56;264:1.0
    56;264:0.01
    56;57:0.005
    56;1:1.0

    As you can see here I have a Diamond Ore Block that has the possibly to drop some extra goodies. I pull out my iron/diamond pickaxe, break it, and it works perfectly. But I noticed that when I break the Diamond Ore Block with my FIST (or any tool for that matter) and STILL get the items to drop.. instead of being limited to using an iron/diamond pick to do the job like normal. This causes a problem as I think you can tell lol..

    NOW with that being said. Since my diamond ore block has extra goodies, is there any way to make one drop override another? Such as.

    If 56;57:0.005 (Diamond Block) drops could it be made to cancel out the normal 56;264:1.0 (Diamond)? Since a Diamond Block is a "super rare" drop, it would be rather overkill to drop a Diamond Block AND a Diamond along with it (and possibly the second diamond too lol).

    Something like..

    # Diamond
    56=0
    56;264:1.0
    56;264:0.01
    56;57:0.005(cancel 56;264:1.0,56;264:0.01)
    56;1:1.0

    If that could be pulled off I would be the happiest Minecrafter in history :p.

    Either way.. KEEP UP THE GREAT WORK!
     
  23. Offline

    Snowl

    So you would like
    • Drop item when broken with a pickaxe/axe/shovel etc (configurable per item)
    • Override the overrides so if drop is dropped thats the only drop? :p
     
  24. Offline

    uldamoc

    That sounds perfect.

    Because it kinda ruins the point of changing what drops out of a Coal Block, if it makes the drops obtainable via fist punching and not through the normal means via the correct type of pickaxe.

    But ya, being able to configure any tool/item aswell would be amazing because you then could make certain blocks obtainable ONLY if you use a certain tool/item.

    Crappy example:
    If I were to use a stick to break a block of glass. I could make it so it would give me the glass block back (based on the drop rate of course). Whereas, breaking it without a stick would just destroy the block like normal.

    One could get really creative with this.

    And ya.. I'd LOVE to override the overridden blocks lol.

    Just to clarify..

    Example:
    #randomblock
    item 1 (100% drop)
    item 2 (50% drop)
    item 3 (10% drop)

    If item 3 dropped, I'd like to be able to make it so that item 1 and 2 on the list WONT have a chance to drop regardless of their drop rates.
     
  25. Offline

    Snowl


    Added item, but you also have to have the block damage variable
    so you can't have
    1;4:1.0:278 (diamond pickaxe)
    you have to have
    1;4:1.0:0:278
    of course you can edit the damage variable.
    Looking into over-riding over ridden blocks, though I don't know how to implement that in the current properties :S want me to upload the version that has tools added aswell?
    Would having something like 1;4:1.0:0:eek:verride be ok (if tool is set to 0 then it ignores it)
     
  26. Offline

    uldamoc

    Sure i wouldnt mind messing around with that. :)

    Ill just have to see how the damage variable effects what im doing. I dont seem to quite understand it.
     
  27. Offline

    Snowl

    0 is no damage (the usual) it goes up to 127 which is around 127 uses, and to -127 which is an extra -127 uses. Notch also uses this to change what dyes and wools are. I'm just implementing the override code now.
    --- merged: Jan 28, 2011 5:17 AM ---
    What happened while I was coding the override: a typo made an infinite spawn of the override block:
    [​IMG]

    Froze my server because it spawned too much :(
     
  28. Offline

    uldamoc

    oh jeez! lol
     
  29. Offline

    Snowl

    Updated for the tools btw. Add an extra :[item/block id] and it will only drop when equipped that item.
     
  30. Offline

    Euphoriant

    Right on. Getting ready to test this.
    --- merged: Jan 28, 2011 8:41 AM ---
    Works!

    Any way to make it so you can specify multiple required tools? Like this:

    56;264:1.0:0:257,278

    The current format works just fine, but it kinda forces you to double some sections of the properties file to support multiple tools for single block drops.
     
  31. Offline

    Snowl

    i'm going to be looking at adding that with the next update :p (and also with block id's)
     

Share This Page