Breaking Blocks

Discussion in 'Programming' started by Penagwin, 20 October 2014.

  1. Penagwin

    Penagwin Linux Servers are better then windows!

    Joined:
    10 February 2013
    Messages:
    114
    Likes Received:
    45
    I am developing the mod industrial energetics, I took over the development from Fireball. How should a have a machine break blocks in a way that respects chunk claims? Harvest?
     
    Brodolon likes this.
  2. Siioh

    Siioh If you can read this, you're too far

    Joined:
    29 May 2013
    Messages:
    333
    Likes Received:
    118
    I'll be honest, there doesn't seem to be a way - unless you can somehow check the person who placed the machine against the chunk ownership of any soon to broken blocks. That would require ridiculous amounts of effort and also a way to access the claims, even after they update. I say it's not worth it and just avoid making anything that can be easily used for griefing. If you want to keep it in the main version of the mod and just not have that part on SKC, we can arrange for certain blocks to be disabled.
     
  3. Penagwin

    Penagwin Linux Servers are better then windows!

    Joined:
    10 February 2013
    Messages:
    114
    Likes Received:
    45
    The method for harvesting (As in block harvesting, not only plants) requires a player entity. Depending on how sk89q checks who is breaking the block this might be enough. I'll have a stable version of the mod tomorrow if you would like to review it.

    Side note: What is with my grammar? I swear I think through the sentences correctly, it just doesn't come out right.
     
  4. Drzego

    Drzego New Member

    Joined:
    1 October 2014
    Messages:
    24
    Likes Received:
    4
    Do autonomous activators work on claimed chunks? Maybe there's something there that could be useful.
     
  5. sk89q

    sk89q Administrator
    Staff Member

    Joined:
    1 December 2011
    Messages:
    2.490
    Likes Received:
    1.504
    You need to throw a Bukkit event.

    But you need to do so in a way without requiring that Bukkit be installed, which is easy. Simply toss all the Bukkit calls in a separate class, and wrap around the code that accesses the class with an exception handler and you're good to go. NOTE: Exceptions are slow so you should set a flag if Bukkit is not found so you aren't repeatedly catching exceptions.
     
    kerjava likes this.
  6. Penagwin

    Penagwin Linux Servers are better then windows!

    Joined:
    10 February 2013
    Messages:
    114
    Likes Received:
    45
    What event needs to be thrown?
     
  7. sk89q

    sk89q Administrator
    Staff Member

    Joined:
    1 December 2011
    Messages:
    2.490
    Likes Received:
    1.504
    BlockBreakEvent
     
  8. Siioh

    Siioh If you can read this, you're too far

    Joined:
    29 May 2013
    Messages:
    333
    Likes Received:
    118
    I don't usually throw events, but when I do throw things, it tends to include items ranging from bricks and noobs to cards and biscuits.