Inactive [MECH] ControllerBlock v1.18 - Toggle blocks on/off with redstone [740]

Discussion in 'Inactive/Unsupported Plugins' started by Hell_Fire, Jan 24, 2011.

  1. Offline


    ControllerBlock - Toggle blocks on and off with redstone

    I've stopped work on this plugin due to other work, please see Zero9195s continuation of this plugin here:

    Pretty simple, there was a version of this for hmod, so the inspiration comes from that.

    Iron blocks can be turned into controller blocks. Drop the block down, drop a redstone wire or torch on top, switch to the type of block you want to toggle and smack the iron block with it. (Can remove redstone on top after it's been set as a ControllerBlock).

    Place those blocks down where you want them to be, you can work from multiple piles of it, where it is in the inventory doesn't matter, as long as you place the block of that type.

    Once you're done placing blocks, wack the iron block again and it'll save the block locations and ready to go. Power the block they'll appear, remove the power and they'll disappear again. Invert the control with a redstone torch on top of the block. To remove the binding, just remove the block.

    Source is included in the .jar file in case I disappear. Tested on my local server but other than that, not much else. Sure you guys will find me bugs :)

    A smallish howto of how to make blocks, and change between types.

    • Redstone toggleable blocks
    Download ControllerBlock (recommend using the recommended build of craftbukkit here, previous version available below in the changelog, tested up to 733).


    Source now also available up on GitHub!

    Some builds done with ControllerBlock:
    Treasure Quest 3 (dungeon game inside MineCraft) (by neoguy21)
    Xtreme HowTo controller blocks (by mrgreaper)
    :getout: frog animation (by Gorbachev, sup goons :V)
    gravity mob trap (by Arolathe)
    hidden staircase/entrance (by narrowtux)

    And a couple by me:
    Real simple on/off example/howto
    Item elevator
    Portcullis/castle gate build/howto (long >.<)

    Known Issues:
    - Placing a block in snow/flowing water/lava doesn't register.
    - Occasionally block hits/places/destroys don't register.
    - Liquids being directly controlled don't work properly.

    Version 1.18
    - Updated for craftbukkit #733
    Version 1.17
    - Fixed config loading of BlockFlowProtectMode and BlockPhysicsProtectMode
    Version 1.16
    - Fixed for changes to bukkit/craftbukkit #602
    - Changed some messages, added some config options, haven't slept much, so forgotten a bit of what's changed, find bugs! :)
    Version 1.15
    - Fixed up multiworld, also loads the data file after all the other plugins have loaded.
    Version 1.14
    - Changed world to use name instead of the ID in data file, should fix multiworld stuff when ControllerBlock loads before other multiworld initializing plugins.
    - Not much else that I recall, will be another version soon
    Version 1.13
    - New config patcher, new options get added into the ControllerBlock.ini automatically.
    - Added a whole lot of currently disabled debug lines (They're spammy... really spammy).
    - Added option to disable the edit dupe check all together.
    - Added protection against water/lava flows (and dupe checks, that are disable-able with the above new option).
    - Added ability to disable the checks against Permissions (and clones) completely, if you want to just use my inbuilt controls only (not mandatory to set if you don't have Permissions, this is in addition to, if Permissions isn't installed, it won't use it anyway).
    - Fixed Grass/Dirt and Redstone Torch On/Off in the edit dupe checks. No other blocks are coming to mind that change automatically.
    - Added a bunch of error checking on the loading of the ControllerBlock.dat, hopefully will give me some clues as to what's going on there.
    Version 1.12
    - Removed plugin constructor for craftbukkit-419+ (wasn't needed anyway)
    - Fixed Permissions mod checking stuff (haven't tested it actually works with permissions, but doesn't seem to throw any errors on loading anymore)
    Version 1.11
    - Fixed a bug that mostly affected Windows users with .dat handling (wasn't closing the file on reading, so it couldn't overwrite it when saving).
    - Added some sanity checking to reading the .dat file (empty lines ignored rather than creating null controllerblocks that make the mod unable to save).
    - Destroying a block in edit mode that has more than one controllerblock controlling it will replace the block with the type from the enabled controllerblock.
    - Destroying a controllerblock now destroys all the controlled blocks and refunds them all at the controller block itself.
    Version 1.10
    - New antidupe code, a lot more reliable!
    - Fixed permissions check (uninitialized objects are a pain :p)
    Version 1.09
    - Fixed a rather critical bug that was saving the new data format with the old identifier.
    If affected by this (getting NumberFormatException on loading), edit ControllerBlock.dat with a text editor and change the first line from "# v2" to "# v3" (That's <hash><space>v3).
    Version 1.08 - critically bugged, don't use, use 1.09 instead
    - Added a builtin permissions support, also supports Nijikokuns Permissions on top of it
    - Removing the controller block with WorldEdits superpick, and possibly any of the "stick" plugins that cancel/set to air on hit will now remove the controller block.
    - Added configurable limits on number of blocks and block distance from controllerblock (is a "sphere" around the controllerblock, rather than a cube, might add another option to change it later).
    - Probably some more random little bugfixes/refactoring, but I can't remember >.<
    Version 1.07
    - Updated for API changes (bukkit-144/145 and craftbukkit-323, tested with 326)
    - Config file format change, old config files will convert automatically
    - ControllerBlocks need a redstone "thing" (wire/torch) on top to create a ControllerBlock
    - Added per-tick, per-controllerblock .isBlockPowered() check for more natural redstone integration (power feeds into the block rather than needing wire on top), more CPU hungry, toggleable with old quick REDSTONE_CHANGE event method in config (quickRedstoneCheck=true for fast version that needs wire on top of block)
    Version 1.06
    - Updated for API change (bukkit-128/craftbukkit-281, only tested with 289)
    - Added counts on block add/remove messages
    - Added notice if a block gets removed by the anti-dupe code while editing
    Version 1.05
    - Updated for API change (bukkit 122/craftbukkit-265)
    - If you're running a version prior to this, you can still find 1.04 at here. I won't be supporting it anymore though, so any bug fixes, etc, won't find there way backported there.
    Version 1.04
    - Moved config/data to plugins/ControllerBlock (or whatever getDataFolder() is). Should make it multi-server usable as long as each server has a different plugins dir.
    - Sorted out minecart track metadata storing, this should make dynamic minecart tracks actually stay how you put them out now.
    - Stacked fences should work again now.
    - Probably some other small bugfixes that I've lost track of.
    Version 1.03
    - More refactoring
    - Inverted blocks again, blocks on when redstone wire off, reads from torches now, blocks on when redstone torch on.
    - Added some error handling in the config file loading
    - Fixed a metadata handling bug when a block has more than one controller.
    - Listen to event cancellations, no longer processes canceled events.
    - Changed a bunch of the edit mode handling, still similar to how it was, just with some nice changes (no longer need to exit editing one block to edit another, will save/finish the previous block for you).
    - Can now edit/modify ControllerBlocks that were made with a different Material before a configuration change took place, Material only matters for creation of new blocks.
    Version 1.02
    - Whole lot of code refactoring
    - Blocks on when redstone on (can still use torches)
    - Block protection for controlled blocks (Physics events can't modify controlled blocks anymore, fixes duping issues, but allows some odd builds, might implement a "break" feature like the original had, where block changes cause the controllerblock to disable)
    - Added configuration file (creates on first load, in main folder, ControllerBlock.ini). First line is ControllerBlock material type, other lines are disallowed materials.
    - Saves block metadata, allows toggling of minecart tracks.
    - Probably some other stuff I'm forgetting.
    Version 1.01
    - Added controlled block checks, need to edit block before removing controlled blocks
    Version 1.0
    - Release
  2. Offline


    Hi again, Hell_Fire! Any news on MoveCraft compatibility? I've been eagerly awaiting it since you mentioned you liked the idea a while ago. I can see you've been kept busy with the new multiworld support and general bugfixing/updating, but I hadn't seen any mention of the subject recently, so I thought I'd ask.
  3. Offline


    Multiworld is native bukkit/craftbukkit, movecraft isn't, that's why I needed to support it. I haven't looked any further into movecraft yet, I think it's going to need quite a bit of work on movecraft to send custom events to implement it.
  4. Offline


    Ladders are invisible,
    also is it possible to edit the in-game text?
  5. Offline


    Strange error :
    Crash after... 1000 errors :'(
  6. Offline


    I'm using Craftbukkit version 516 (at least, that's what I think it is, reading the message from my server console "This server is running Craftbukkit version git-Bukkit-0.0.0-516-gdf87bb3-b531jnks") and ControllerBlock does not seem to be working. It prints no errors to the console, and it states that it's using GLOWSTONE (the block I set, so as to not possibly conflict with MCCMMO's iron blocks for anvils). Even though it prints no errors, however, the GLOWSTONE block is unresponsive. Is my version of Craftbukkit unsupported?
  7. Offline


    I've been using this for a few days, and I noticed it doesnt work with ladders. Can you make it work with ladders please?
  8. Offline


    In the config, try changing QuickRedstoneCheck to false.
    Will take a look at ladders soon, thanks :)

    Not currently possible to edit the in game text unless you edit the mod and manually change it there. I might add reading in the text from external files so I can do localization soon :)

    I'm not aware of any problems with the latest recommended build, but I haven't personally tested it yet (though, yours is the first report of problems). I'll take a look, thanks :)
  9. Offline


    Thank you.
  10. Offline


    While using the mod I suddenly got:
    15:59:42 [SCHWERWIEGEND] java.lang.NullPointerException
    15:59:42 [SCHWERWIEGEND]        at java.util.LinkedList.addBefore(Unknown Source
    15:59:42 [SCHWERWIEGEND]        at java.util.LinkedList.addFirst(Unknown Source)
    15:59:42 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.util.SoftMap.fastGet(S
    15:59:42 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.util.SoftMap.get(SoftM
    15:59:42 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.CraftChunk.getBlock(Cr
    15:59:42 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.CraftWorld.getBlockAt(
    15:59:42 [SCHWERWIEGEND]        at net.servfire.hellfire.bukkit.ControllerBlock.
    15:59:42 [SCHWERWIEGEND]        at net.servfire.hellfire.bukkit.ControllerBlock.
    15:59:42 [SCHWERWIEGEND]        at net.servfire.hellfire.bukkit.ControllerBlock.
    15:59:42 [SCHWERWIEGEND]        at org.bukkit.craftbukkit.scheduler.CraftSchedul
    15:59:42 [SCHWERWIEGEND]        at net.minecraft.server.MinecraftServer.h(Minecr
    15:59:42 [SCHWERWIEGEND]        at
    15:59:42 [SCHWERWIEGEND]        at net.minecraft.server.ThreadServerApplication.
    15:59:42 [SCHWERWIEGEND] Unexpected exception
            at java.util.LinkedList.addBefore(Unknown Source)
            at java.util.LinkedList.addFirst(Unknown Source)
            at org.bukkit.craftbukkit.util.SoftMap.fastGet(
            at org.bukkit.craftbukkit.util.SoftMap.get(
            at org.bukkit.craftbukkit.CraftChunk.getBlock(
            at org.bukkit.craftbukkit.CraftWorld.getBlockAt(
            at net.servfire.hellfire.bukkit.ControllerBlock.Util.getBlockAtLocation(
            at net.servfire.hellfire.bukkit.ControllerBlock.Util.getBlockAtLocation(
            at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(C
            at net.minecraft.server.MinecraftServer.h(
    (server crashed)
    damn, I was so happy about this mod :(
  11. Offline


    That looks like a CraftBukkit bug, not good, what build?
  12. Offline

    Demon Boy

    finally got it working i think it was because i had an old bukkit. thanks for the plugin though its really good
  13. Offline


    I have a suggestion. Perhaps if a player were to hit a controller block twice, it will enable two material mode, so a trigger block can toggle two different types of materials instead of one. It would be used similar to the way you have it setup now, but instead of finish editing after you click the controller block the second time, it would go into the second material block mode.

    Example: Build trigger block, hit trigger block twice with wood, place wood, switch to stone, hit trigger block once with stone, place stone, hit trigger block to finish.
  14. Offline


    I'm just going to add a config option to allow however many materials you want, like 0 = infinite, 1 = default, 2, 3, etc. Will need a bit of restructure though, but is on the todo list.
    PS, thanks to the moderator who marked this as inactive, I haven't updated the thread title since nothing implemented is actually needed for this mod, so the minimum version still stands (which if they actually read the first post, they'd know >.>)
  15. Offline


    I love the plugin! But maybe you could look into this, because now, people can get free (redstone) torches from using controllerblocks.

    EDIT: A bunch of other items can be spawned infinitely with this method too. Levers, buttons, paintings, mushrooms, flowers, etc.
  16. Greetings, your plugin has to work very hard on our server, since we use the controller blocks in a lot of situations.
    So first: Thanks for the awesome work.
    But I have kind of a feature request.

    When I build gates, bridges or anything like it with the controller block, it looks awesome when they open, but not when they close.
    Obviously it looks like this:

    gate opens:
    ---     ---     ---
    ---     ---
    gate closes:
    ---   ---   ---
          ---   ---
    Of course that doesn't look very realistic.
    I have to admit that I'm no redstone expert. So I don't know of a way to make it work better.
    So, what if you could set a sign on the side of a controller block and on the sign is written a number. This number determines a delay with wich the block reacts to a change in the redstone current. So the last block in the row will be actually the first one to turn off, because it has the lowest delay set.

    I don't know if this would be easy or hard to code, or if it is even possible. It's just an idea i had.
    Again: Great work you do with this plugin.

  17. Offline


    Use WorldGuard and deny the breaking of redstone torches?
  18. Offline


    This can be done with some clever redstone circuitry. Have a look at the new repeater/delay block. I do warn you, getting realistic gate open and gate close animations will take some clever work.
  19. Offline


    i have already done so on the old version of the controller block, the gates i made open in stages from top to bottom then a seperate system which activates to reverse the system so it opens bottom to top.

    another reason why i cant update, there are delays, the gates wont work with my current system and the new blocks -.-
  20. Offline


    To be honest, that's not a reasonable solution. As I already stated, it's not only torches. It's a really long list of things you can duplicate using this method. Even Minecart rails is infinite with this. And I don't think preventing breaking them even works, I think you can still dupe them without having to break them. Also, preventing breaking them obstructs a lot of other players too.
  21. Offline


    Hey i was just wondering if there is anyway you can make it so it tells you the x, y, and z of a controller block on a block it controlls because some of my noob server members lost their controller blocks and that would be alot of help. Thnaks alot.
  22. Offline


  23. Offline


    The OP title suggests you need CB #531
  24. Offline


    Oh i'm not complaining just letting the developer know ;)
  25. Offline


    I am getting the exact same error. It seems to happen randomly when people activate redstone, even if its not connected to a controllerblock.

    I am running craftbukkit 531 and controllerblock 1.15
  26. Offline


    For anyone getting issues like this, do what I did.
    Open your .db file with notepad++ and use the replace tool to instantly replace all your world IDs to your world folder name.

    XXXXXXXXXXXXXX = Some random number that your worlds ID used to be...
    I simply had notepad ++ replace that number with "gaia", my world name.
    Remember, remove the "-" as well.

    I ended up with something like this:
    Then copy/paste it back.

    Then I launhced my server and it gave me some random error (story of my life...) but after looking it over, it seemed to have an error with QuickRedstoneCheck. So I went in and changed my .ini to QuickRedstoneCheck=true

    After that, it fired right up. I'm sorry if anyone pointed all this out already. I just wanted to offer the fix too~ At least now it will be on the last page. (for now)

    Thanks, I <3 this small plugin.
    - Nate
  27. Offline


    That's interesting.. maybe the BLOCK_PHYSICS event isn't getting thrown for those things anymore when they're changed. I'll take a look at it :)

    (Edit: On a side note, you can add those blocks that are acting funny to the disallowedTypes section of the ControllerBlock.ini till it's fixed)

    Hrmm, looks like something has changed at a lower level, setting the block data looks like it throws that event again or something, and causes it to infinite loop, does it still do it with QuickRedstoneCheck=false? (note, QuickRedstoneCheck is only really less expensive then the scheduled version until you get a fair chunk of redstone wiring down, then the scheduled check is less expensive, it's actually not a significant hit to just do the scheduled check, so I'm thinking of removing the other one all together.

    Hehe, sure, I'll add it to the "destroy" message that tells you that it's controlled by one.

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


    Is there any way to make this not neuter TNT? I love the plugin and would really like to use it to load my cannons automatically, but it breaks tnt. If this isn't possible, would it be possible to do with craftbook or something?
  29. Offline


    Ahh, thanks for the reminder, I had coded, but then commented out that for the block protect mode for some reason. Think I was going to add an extra option, one for edit mode, one for running mode. Will sort this out next version :)
  30. Offline


    You rule, thanks!
  31. Offline


    @ Hell_Fire: Thanks for your hard work on the plugin. :)

    It seems that Redstone Wires can't be added to Controller Blocks.
    Well, of course the Item itself (ID 331) can't be added to a Controller Block as it's not a block. XD
    I do can add Redstone Wire (ID 55) to a Controller Block, I can place it and it even appears and disapperars. But it doesn't get powered, no matter what.

    Is there a way for you to fix that?
    I'd like to build a lava pit trap. XD

Share This Page