Burning logs -> 33% chance to drop charcoal

Discussion in 'Archived: Plugin Requests' started by MrMontor, Jan 3, 2013.

  1. Offline


    Plugin category: Fixes/Fun/General

    Suggested name: RealisticLogBurner

    What I want:
    What I want I pretty allready said in the title.
    I want a plugin that makes logs drop charcoal on an editable percentage when burned.

    BUT it should really NOT be possible when just chopping the logs with tools.
    (Like the gold axes or something i saw when i browsed the requests)

    Ideas for commands:
    /burnlogpercent XX (chance to drop)
    /burnlogamount XX (amount of dropped items)

    Ideas for permissions: player.cangetcc

    When I'd like it by: Saturday
  2. Offline


    It's possible. I just don't know how to do it with a percentage at the moment.
  3. Offline


    Good to hear :)
  4. Offline


    ThunderWaffeMC here, this should work:
    MaterialData charcoal = new MaterialData(Material.COAL, (byte)1);    // should be charcoal's data, but this is untested.
    public void onWoodChop(BlockBreakEvent e) {
        if (e.getBlock().getType() == Material.WOOD && e.getPlayer().getItemInHand() == null && onFire(e.getBlock()) && Math.random() < .33) {    // change .33 to whatever's in the config
            e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), charcoal.toItemStack(1));
    private boolean onFire(Block block) {
        return block.getRelative(BlockFace.UP).getType() == Material.FIRE ||
                block.getRelative(BlockFace.NORTH).getType() == Material.FIRE || block.getRelative(BlockFace.SOUTH).getType() == Material.FIRE ||
                block.getRelative(BlockFace.EAST).getType() == Material.FIRE || block.getRelative(BlockFace.WEST).getType() == Material.FIRE;
    Well that was dumb. I completely forgot to make it check if the block is burning or not. Fixed it now.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 8, 2016
    Borlea, MrMontor and ThunderWaffeMC like this.
  5. Offline


    Oh god great!

    Could you guys please turn this into a plugin??
  6. Offline


    Will do.

    Edit1: Since I have some family things to do. I couldn't do your full request but this of what I have here is just a 33% chance to do what you requested with no config or commands. I will keep working on it when I get back and make a bukkitdev Post


    Edit2: Just before I go I have no idea if this works. Im sorry if it doesn't just wait 1-3 hours and I'll be back
    MrMontor likes this.
  7. Offline


    im just going to try it :)

    //Edit after trying:

    So now there appears to be a problem.
    I cant even check if the plugin works because of the fire itself.
    Right after a log block would drop a piece of charcoal after disappearing, the dirt located right under the block starts to burn for a few seconds and destroys every single drop.

    Is there a way to make those charcoals non-affected by fire?
  8. Offline


  9. Offline


    Borlea just found a solution.
    Thanks for your helpful answer.
  10. Offline


    Are you sure? Store the UUID into a list, then on the (it may be ItemDespawnEvent, not sure)
    if(list.contains(event.getEntity().getUniqueId())) although I'm not sure if the event is cancellable

    Edit: It is cancellable
    MrBluebear3 likes this.
  11. Offline


    Borlea made the plugin, but it still doesnt drop charcoal.
    If you have the time, it would be nice if you could make it :)
  12. Offline


    I will look into it soon
    MrMontor likes this.

Share This Page