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


    19.02.2011 15:48:22 org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event BLOCK_DAMAGED to ControllerBlock
            at com.hell_fire.bukkit.ControllerBlock.CBlock.loc2str(
            at com.hell_fire.bukkit.ControllerBlock.CBlock.serialize(
            at com.hell_fire.bukkit.ControllerBlock.ControllerBlock.saveData(
            at com.hell_fire.bukkit.ControllerBlock.CBlock.editBlock(
            at com.hell_fire.bukkit.ControllerBlock.BlockListener.onBlockDamage(
            at org.bukkit.plugin.RegisteredListener.callEvent(
            at org.bukkit.plugin.SimplePluginManager.callEvent(
            at net.minecraft.server.NetServerHandler.a(
            at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(
    Craftbukkit #325
    ControllerBlock 1.10

    It happens when you try to stop editing (hit the iron block second time).
  3. Offline


    That's part of the save code... I don't even know how that Location object is null, that one that it's trying to save is the location of the controllerblock itself... Unless you edited the .dat file and left an empty line, Hmmm, wonder if that doesn't throw a parse error when it loads and just creates a invalid object...
    --- merged: Feb 19, 2011 1:30 PM ---
    I'm going to upload a test version that does some basic checks on the .dat file for empty lines, see if that helps :)
    --- merged: Feb 19, 2011 1:32 PM ---
    And uploaded, those people getting exceptions on saving the controllerblocks (second hit), give this one a shot: ControllerBlock-1.11-rc1.jar
  4. Is cb compatible with 344+ ?
  5. Offline


    I've been doing my testing on 345 and works okay :)
  6. Offline


    after some more trials i found that after making 2 seperate controllers with different blocks , and shutting down the server and restarting to find that the first block is fine but the second still not functioning so i shut down again and had a look here

    # v3

    and here

    # v3

  7. Offline


    What platform? (Windows, Linux, Mac?) Could you also check the permissions on the folder and files? That should only happen if it can't write to the .dat.

    I've counted not logging an error as a bug though, and will be fixed in the next version, thanks :)
  8. Offline


  9. Offline

    Kevin Forte

    Thanks, that worked. :D
  10. Offline


    It'll probably be a security thing, check the user account the server runs under has permissions. Sounds like an ACL problem, but not putting it off as not a bug since I haven't tested the renameTo function that moves the .tmp to the .dat file under windows platforms yet.
  11. Offline


    My server has the .dat file but it doesnt seem to save the blocks after i re-launch as well :(
  12. Offline


    Those having issues with saving, this test version has some more logging on those (and checks about the renameTo function actually succeeds). If you could test it out for me? :) ControllerBlock-1.11-rc2.jar
  13. Offline


    sure i'll give it a shot
    --- merged: Feb 19, 2011 6:12 PM ---
    heyyy it worked!! :D
  14. Offline


    Ahh, I just tested it, yeah, oddly enough, works for linux, probably for mac, but not windows, fail >.< Okay, I'll see if I can fix it up :)
  15. Offline


    It worked for me, and i have windows. hmm haha
  16. Offline


    ACK! That's a horrible bug, woops, lol, note to self, close input files after reading them >.<
    --- merged: Feb 19, 2011 6:39 PM ---
    Okay, so I don't lose track of fixes :p
    - Fixed .dat file not getting updated on Windows (bug doesn't affect linux/mac unless you've got some specific lock settings on the filesystem).
    - Fixed .dat handling of empty lines

    Two more things I want to get done, quick one is destruction of a block that has two or more controllerblocks with blocks on them. Another is destroying a controllerblock, want to make it set all controlled blocks to air so you don't have to go around destroying them yourself, and have it refund the blocks straight at the controllerblock.
    --- merged: Feb 19, 2011 7:10 PM ---
    And uploaded :) Updating first post now
    --- merged: Feb 19, 2011 7:16 PM ---
    Thanks all for helping with the bug hunting with good error reports and information :)
  17. Offline


    thankyou , all saving as they should on windows vista
    most kind
  18. Offline


    You never mention what to add to permissions :p
  19. Offline


    Oh, it shows in the .ini if you let it make a new one with all the options, anyways, the permission nodes are:
    controllerblock.admin - not restricted by block counts, distance, can modify/destroy other users blocks
    controllerblock.create - able to create blocks
    controllerblock.modifyOther - able to modify others blocks
    controllerblock.destroyOther - able to destroy others blocks

    For these to work, you'll need to set the options in the .ini to false, since they default to true (except admin). If you need to, you can get a new .ini by renaming your old one, starting up the mod so that it writes a new default, stopping it again, and configure :)
  20. Offline

    Kevin Forte

    Okay, so I just broke a controller block, and noted that it never told me I destroyed the block. I now can't break the cobble that was linked to it, what do I do?
  21. Offline


    Hmmmm....I cannot finish editing this block.... I left click it and nothing happens
  22. Offline


    i am using you latest version with 345 still every time a reload server all data is like gone.... no big errors like last time but it acts like it was never modifyed
  23. Offline


    Is it possible to add so that you have to connect the blocks you want to remove to the trigger using redstone? like an optional setting? would feel less like cheating.
    otherwise awesome mod!
  24. Offline

    Demon Boy

    so no one else is getting th <0blocks> part after the material theyre editing are they? any idea why im getting it?
  25. Offline


    Place a block back in the controllerblock spot and break it again. Don't know why sometimes events aren't firing properly :/
    --- merged: Feb 22, 2011 7:21 AM ---
    Any errors in the server console?
    --- merged: Feb 22, 2011 7:22 AM ---
    Any small errors? :)
  26. Offline

    Demon Boy

    interferes with permissions plz make compatible
  27. Offline


    actualy things have gotten much worse!
    We can start the edit proccess but not end it at all i have been using this plug for a while and realy like it!
    i will test it right now for error

    Feb 22, 2011 1:26:26 AM org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event BLOCK_DAMAGED to ControllerBlock
    at com.hell_fire.bukkit.ControllerBlock.CBlock.loc2str(
    at com.hell_fire.bukkit.ControllerBlock.CBlock.serialize(
    at com.hell_fire.bukkit.ControllerBlock.ControllerBlock.saveData(Control
    at com.hell_fire.bukkit.ControllerBlock.CBlock.editBlock(
    at com.hell_fire.bukkit.ControllerBlock.BlockListener.onBlockDamage(Bloc
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    at net.minecraft.server.NetServerHandler.a(
    at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
    at net.minecraft.server.NetworkManager.a(SourceFile:232)
    at net.minecraft.server.NetServerHandler.a(
    at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
    at net.minecraft.server.MinecraftServer.h(
  28. Offline


    Possibly, though recently I added a couple of limiting options (range and number of blocks) though disabled by default, the idea being that the cost of the controllerblock type itself is the cost to have such a powerful block, like, say, turning the controllerblock type to a solid diamond block and only letting it toggle a single block.

    Adding a redstone check out from the controller block to each individual toggle block can be a really expensive check (pathfinding/etc). Though, not saying no, I'll keep it in mind :)
    --- merged: Feb 22, 2011 7:27 AM ---
    Is a feature, any message that adds/removes/modifies a controllerblock count just tells you the number of controlled blocks :)
  29. Offline


    there u go
  30. Offline


    How so? It was compatible as of 2.0 of Permissions. It shouldn't be exporting any Permissions code at all, heck, I don't even import any permissions code, I reference the Permissions types directly.
  31. Offline


    i dont have any permisions for this mod?
    I dont see permisions at all in the error?
    are you talking to yourself kinda or im i missing somthing?

Share This Page