[MECH] OtherDrops 2.8- Ultimate block/mob/player drop editing [1.5.2]

Discussion in 'Archived: Plugin Releases' started by Zarius, Jun 12, 2011.

  1. Offline

    Zarius

    [​IMG]


    Want to fix glass/stairs/boat drops? Want to gather ice/glowstone/grass in a balanced manner? Want to smelt ore with golden tools? Want to cause chaos with undead that rise again? Now you can, simply by enabling the included example files or delve into the more advanced customisation and make drops work the way you want.

    OtherBlocks aims to give you ultimate control over what item that blocks/entities drop when destroyed, depending on how they were destroyed. Compatible with WorldGuard. Lightweight! Only scans what it needs to and ignores the rest.
    Download: BukkitDev (download link on there) | Source Code

    Included Modules
    * Fix undroppables: fix drops for stairs, glass (don't use your hands - ouch), boats & bookshelves (1.8 stairs included)
    * Gold tools (basic): gold tools have a chance of dropping the complete block for grass, ice & glowstone.
    * Gold tools (smelt): gold tools have a chance of mining an ingot directly from ores.
    * Ore Extraction: using the usual tools, ingots are ripped out of ores, leaving the stone behind.
    * Leaf overhaul: adds leaf drops (apples, cocoa, leaves, sticks & a very small chance of golden apple).
    * Undead Chaos: beware the night! Zombies & skeletons rise again and even players rise back from the dead (player deaths spawn more zombies/skeletons).
    * and more...

    Custom Configuration Examples
    Code:
        # Simple glass drop fix
        GLASS:
          - drop: GLASS
     
        # Players drop Zombies on death, 50% of the time
        PLAYER:
          - drop: CREATURE_ZOMBIE
            chance: 50%
     
        # Spiders killed with any sword at night have a 10% chance to drop web,
        # otherwise they drop whatever they normally would
        CREATURE_SPIDER:
          - tool: ANY_SWORD
            time: NIGHT
            drop: WEB
            chance: 10%
     
        # Trees drop apples (or cocoa from birch trees)
        SPECIAL_LEAFDECAY@GENERIC:
          - drop: APPLE
            chance: 5%
        SPECIAL_LEAFDECAY@BIRCH:
          - drop: DYE@BROWN
            chance: 5%
    
    If you are getting errors with the word "snakeyaml" in it, your config file isn't properly formatted.
    Test it on this website (or this one).

    See the dev.bukkit page for full details on how to set up OtherDrops, a complete parameters list and further examples.


    Changelog

    Newest changelog details here.


    Main author: @Zarius
    Contributors: @Celtic Minstrel, raws
    Original author: @cyklo
     
  2. Offline

    Zarius

    Howdy :D I think I've fixed the "game-breaking" issues in beta10 - most of the remaining issues are more minor. Do you have any you consider game-breaking that I haven't fixed yet?

    Beta 10 released - changes from beta 9:

    * fix no death animation & entities removing block within
    * update to 1.0 & 1.1 (mobs/items)
    * ignore players in creative mode (onblockbreak)

    * support for enchantments very basic so far - just accepts a singe enchantment name for a tool). An example:
    Code:
      STONE:
        - tool: DIAMOND_PICKAXE
          drop: COBBLESTONE
        - tool: DIAMOND_PICKAXE@!SILK_TOUCH   # yes, you need the @!
          drop: STONE
     
    # Caveats - doesn't work with synonyms (eg. ANY_PICKAXE) and cannot exclude enchanted tools yet :(
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 15, 2016
  3. Offline

    Celtic Minstrel

    I actually made a pull request for this awhile back... it's closed now since I haven't updated it, but I think it'll still be incorporated at some point.

    Does it detect '@!' as a unit, or split on '@' and then detect '!'? The latter seems to me to be the better option.
     
  4. Offline

    tremlingrendel

    Thank you! This definitely started me in the right direction.
    I went with this for the full code:
    Code:
        SAND:
            - drop: {SAND/60%, COBBLESTONE/30%, DIRT/10%, WOOD/5%, IRON_ORE/5%}
    
    And I have gotten it to drop sand, cobble, and dirt, so I'm pretty sure it's working. However...

    I get this message on console when I break a sand block and nothing drops. Does not happen every time, but I am not sure what is causing that. I put in a second "drop:" for sand instead to "fix" it dropping nothing at all, but is there a better fix that won't fill my server log with failed roll messages?
     
  5. Offline

    Celtic Minstrel

    You won't be getting the percentages you put in there, because if they add up to more than 100 then OtherDrops won't interpret them as percentages and will instead take them as ratios. So, your 60% is actually 60/110, not 60/100, for example.

    I don't know what produces that message so I can't help with that... I suppose if all you want is to silence the message, you could decrease your verbosity setting.
     
  6. Offline

    Zarius

    Whoops - there's always one debug message I forgot - I even turned my verbosity to low and ran through the unit tests this time (but I don't have a { } drop in the unit test yet... :/).

    And no - verbosity won't fix it... I just updated the top post download link to beta10-1 which fixes that error message.

    Cool - hopefully it gets in.

    Yeah, @ first then ! So you could do DIAMOND_SWORD@50-100!DAMAGE_ALL for example. Just wanted to make it clear that item!ench doesn't work - needs to be item@!ench at the very least.

    Oh, good news too - works with SpoutMaterials - I tested the Obsidian Sword using this:

    Code:
      GRASS:
        - tool: FLINT@1026
          drop: DIAMOND
    
    I added a "/od id" command you can use in-game to determine the itemname and data (you need the "otherdrops.admin.id" permission.

    Now to sleep - let me know how the latest version goes :)

    Quadruple post FTW :D Just noticed I left in a debug message for XP drops but since they don't work anyway I'll fix it later...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 15, 2016
  7. Offline

    Celtic Minstrel

    Hm, okay. Interesting choice.
     
  8. Offline

    Zarius

    Alternatives? :) I'll probably support just the exclamation later, or even item!ench@data.
     
  9. Offline

    Celtic Minstrel

    Well, my first instinct would've been to not make a distinction between enchantments and other forms of data, so for example "item@ench" or "item@data" or "item@data/ench" or even "item@data/ench/ench/data/data" or whatever. But I haven't really looked into it yet, so there may be problems with that that I'm not aware of.
     
  10. Offline

    Zarius

    Yeah, that was my first thought, can't use / due to quantities but there's really no reason I can't use just @ and check then enchantment when first but what about when you want a specific data value too.
     
  11. Offline

    Celtic Minstrel

    I'm not quite sure what you just said... :/
     
  12. Offline

    Zarius

    I meant that for later we might want drop: iron_helmet@25-100!ench@3/2/50% (50% chance of 2 helms between 25 to 100 durability with a tier 3 enchantment). I'm open to any alternatives to this format.
     
  13. Offline

    Skirmisher

    I meant stuff like explosions not dropping the right thing and some of the other stuff you said in the "issues to work on before 2.0 release" list in your post right before mine. That being said, though, I'd be happy to test anything on my "sandbox" test server if necessary. Anything you need tested?
     
  14. Offline

    Zarius

    You could run through the unit testing config (it's in the includes folder) - start by destroying a grass block then follow the instructions (although I haven't written the instructions all the way yet and it doesn't yet test everything). I think permissions might not be working and haven't testing biome/weather conditions (though they should be still working).

    Yeah, I more meant what out the outstanding issues I have (and any other issues) do you consider most important? I'll probably work on the explosions next.
     
  15. Offline

    Celtic Minstrel

    Hm, I see your point. There's a whole lot of ambiguity in that format... hm... I shall think on it.
     
  16. Offline

    Zarius

    Basically it's: "weapon!enchantment" where both of them can have data values (@). "/" separates operators (eg. item/quant/chance%) - chance always has a % and raw numbers are quantity - extra numbers are ignored.

    I don't think there's much ambiguity but there might be better ways.
     
  17. Offline

    Skirmisher

    Explosions definitely don't drop custom drops. The regular unit test for a grass block worked as far as I could tell, but blowing up the grass block did nothing.
    Permissions seem to work fine.
    Testing weather throws a NullPointerException. (Ah, the old days of "you broke it again" :p)
    Yep. This doesn't work. (open)
    Code:
    [SEVERE] Could not pass event BLOCK_BREAK to OtherDrops
    java.lang.NullPointerException
        at com.gmail.zariust.otherdrops.event.CustomDropEvent.isWeather(CustomDropEvent.java:244)
        at com.gmail.zariust.otherdrops.event.CustomDropEvent.matches(CustomDropEvent.java:97)
        at com.gmail.zariust.otherdrops.OtherDrops.performDrop(OtherDrops.java:363)
        at com.gmail.zariust.otherdrops.listener.OdBlockListener.onBlockBreak(OdBlockListener.java:84)
        at org.bukkit.plugin.java.JavaPluginLoader$40.execute(JavaPluginLoader.java:542)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:340)
        at net.minecraft.server.ItemInWorldManager.c(ItemInWorldManager.java:205)
        at net.minecraft.server.ItemInWorldManager.c(ItemInWorldManager.java:81)
        at net.minecraft.server.EntityPlayer.y_(EntityPlayer.java:137)
        at net.minecraft.server.World.entityJoinedWorld(World.java:1257)
        at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:110)
        at net.minecraft.server.World.playerJoinedWorld(World.java:1239)
        at net.minecraft.server.World.tickEntities(World.java:1146)
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:526)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:433)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:465)
    Biomes appear to be working fine, though.

    My reaction was more stimulated by the "Beta9 scare" with indestructible blocks and stuff. :p
    But most of that seems cool now.
     
  18. Offline

    Zarius

    Skirmisher

    Cool, thanks for testing that - I'll add a weather test into the unit testing too.

    In regards to the unit testing did it take you through an "adventure" of pigs, sheep, leaves and lightning? :D If not then it didn't work. Activating the unit testing config and destroying a grass block should drop a diamond sword and a pig then ask you to kill the pig (to test creature drops) and goes through about 10 more steps from there at least.

    If I had more time I'd write a story into the unit testing - for now it's just kinda random :)
     
  19. Offline

    Skirmisher

    My copy only goes to the point where the second pig is killed and causes a lightning strike...did you put that one in the release package? Or did I download the wrong version? :p
    Oh, and I forgot to mention I don't think enchantments work either.
     
  20. Offline

    Zarius

    Yeah, that might be as far as the instructions in the unit test go... it's actually the leaves that cause a lightning strike, then breaking the glowstone should drop a saddled pig.

    Actually, just checked the file and killing the saddled pig should still give you a message about a boat (which you then place on the ground and break to test custom drops from boats)...

    Some enchantments definitely work (as a tool only at this stage) - eg:

    Code:
        - tool: DIAMOND_SWORD@!DAMAGE_ALL
          message: "Damage ALL!"
    
    Only worked for me with a enchanted sword (with "sharpness" or whatever it's called).

    What enchantment config did you test with?
     
  21. Offline

    Skirmisher

    Oh woops, I thought I'd updated to the full beta10-1 from the prelease, but apparently I missed a few files--including the JAR :p (That's what I get for staying up this late...>_<)
    So anyway, the unit test works, and so do enchantments. I don't want to bother with the other stuff right now, 'cause I'm going to bed. :p
     
  22. Offline

    Zarius

    Beta 11 -

    * remove spawn_egg alias to allow compability with Minecraft 1.0.1 Bukkit
    * clear up a couple of debug messages
    * fix NPE in weather check
    * add datavalues for magma_cube

    btw: seems XP drops are working fine - just that they get picked up instantly. Testing this works (except datavalues, ie. after "@" don't work):

    Code:
      DIRT:
        - drop: XP@50000   # the 50,000 doesn't do anything (yet - might change this later), also XP/5 just drops 1 xp orb
          quantity: 10
          delay: 40
    
     
  23. Offline

    Nuinbot

    Zarius: Picking up XP instantly is actually a plugin I am still searching for, so if this works, you will have killed a few more birds with this stone. :)
     
  24. Offline

    Zarius

    Well, let me know how it goes :)
     
  25. Offline

    Nuinbot

    Okay, here are some problems I have found with beta11 (you are going to love me):

    1. When using bows to kill (PROJECTILE_ARROW), drops work fine this way, but I get this message on console when the mob dies. Any way to turn this off? Verbosity settings on config don't work.
      Code:
      ******** CraftPlayer{name=Nuin}
    2. XP does not pick up instantly unless close to the mob. I was hoping to have the player automatically acquire it on mob death, similar to the way RPGs work. If you cannot incorporate this, no big deal.
    3. I am adding bonus drops to trees for players that use shears, but want to reduce the number of leaves blocks as they are furnace fuel (like saplings). Even if I do not configure any of the three leaf blocks to drop leaves, they still do. I think it is a property inherited from the shears themselves. Not sure if you can turn this off or not.
    I will bring more "bad news" as I find it, but to be honest, this plugin ROCKS and makes my server what it is. I cannot thank you enough for the work you have so far put into it!
     
    Zarius likes this.
  26. Offline

    Zarius

    Nuinbot

    1. Oops - another debug message dang it. Sometimes I get lazy and use System.out.print rather than the functions that the verbosity setting uses - hence you cannot remove this message - I'll remove this on next beta (hmm, perhaps a "jenkins" system can let me remote build simple changes like this...)

    2. I did look into giving the XP directly to the player and whilst doable it's a bit tricky and requires a bunch of re-coding as the "player" is not passed to the XPdrop function, just the location. Might look into it for versions past 2.0, you can get around this for now however if you have a command plugin (commandbook) with an "/xp <player> <amount>" function - eg:

    Code:
      SKELETON:
        - command: "/!*xp %p 50"  # I haven't tested this but / means command, ! means send result message to console and * means run as OP
          message: "You gain 50 XP." # or no message if you prefer
    
    Hmm... this could end up with a lot of messages going to console though, might need to make a way to suppress the command messages entirely if preferred.

    Unfortunately this would be in addition to the default XP drop as OtherDrops can't cancel that yet.

    3. It should be able to cancel the shears default action (possibly using action: LEFT_CLICK?) - I'll test it out later when I'm at home.

    I don't mind the "bad news" - thanks heaps for testing :)
     
  27. Offline

    Skirmisher

    That would be awesome :D (not to mention it would prevent me from downloading the wrong version again :p )

    Y'know, /xp is a vanilla command too :p

    Wait, what? Isn't it, like, really hard to suppress the message a command sends to a player? (At least, that's what I've heard when people have requested that for another plugin I follow.)
     
  28. Offline

    Zarius

    Hopefully Jenkins would save me time when pushing new builds too (wonder if I can get it to automatically update the top post here and dev.bukkit? :D).

    Ah - yeah, I haven't tried /xp in vanilla - I just assumed it came from commandbook. Anyway that's even better because it means everyone should be able to use that config :)

    Suppressing the message: not sure how others have tried and I'd have to look back over the code but basically what I do is use a dummy "playerwrapper" and overwrite the "getsender()" function to return either the player or the console.
     
  29. Offline

    Skirmisher

    With a bit of fancy scripting, you might get an auto post updater thingy. IDK about the features of Jenkins, though; all I know is that I've seen others edit posts via Python scripts or the like (though they were using less "advanced" forum systems than XenForo).

    This could be modified to eliminate the message entirely, right?
     
  30. Offline

    Zarius

    Skirmisher - yes, it could be modified easily to eliminate the message. The main thing to consider is what format to use for the OtherDrops config file (/#* or something... will think about it).
     
  31. Offline

    hatninja

    how do you use ecomony for this
     

Share This Page