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

    Hell_Fire

    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: http://forums.bukkit.org/threads/34394/

    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.


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

    NOTE: IN 1.07 CREATING CONTROLLERBLOCKS CHANGED, YOU NEED TO PUT A REDSTONE TORCH OR WIRE ON TOP OF THE BLOCK BEFORE YOU LEFT CLICK ON THE BLOCK TO CREATE. (Yes, enough people have missed this change to warrant the large bold text :p)

    Source now also available up on GitHub! https://github.com/Hell-Fire/ControllerBlock

    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.

    Changelog:
    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.
    -- (YOU ONLY NEED TO DO THIS IF YOU USED THE BUGGED 1.08) --
    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).
    -- (YOU ONLY NEED TO DO THIS IF YOU USED THE BUGGED 1.08) --
    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

    apokaliptik

    Won't work for me. It shows the message on the server console, however when I place the block and bash it with another block, I recieve no message and it does not work if I try to proceed without the message. I just updated bukkit ( downloaded 10 minutes ago ).
     
  3. Offline

    Subcode

    hi, your plugin seems to bug when using it with magiccarpet.
    when i edit a block and place blocks it works,
    when i edit blocks and walk around then with magiccarpet the blocks seem to get removed from the controller block.
    also when i remove a block when editing all the blocks around it get removed as well.
     
  4. Offline

    BigMoomba

    With 168 it not working for me anymone.
    I press on it with leftklick but the Message dont come so its looks like a bug.
     
  5. Offline

    Hell_Fire

    I tested it on 168 before releasing (hence why I put the range up to 168). What other mods are you running?
     
  6. Code:
    31.1.2011 0:21:16 org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event REDSTONE_CHANGE to ControllerBlock
    java.lang.ClassCastException: org.bukkit.material.RedstoneTorch cannot be cast t
    o org.bukkit.material.RedstoneWire
            at com.bukkit.hell_fire.ControllerBlock.CBlock.doRedstoneCheck(CBlock.ja
    va:115)
            at com.bukkit.hell_fire.ControllerBlock.BlockListener.onBlockRedstoneCha
    nge(BlockListener.java:119)
            at org.bukkit.plugin.java.JavaPluginLoader.callEvent(JavaPluginLoader.ja
    va:194)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:216)
            at net.minecraft.server.BlockRedstoneTorch.a(BlockRedstoneTorch.java:115
    )
            at net.minecraft.server.World.a(SourceFile:1578)
            at net.minecraft.server.World.f(SourceFile:1480)
            at net.minecraft.server.WorldServer.f(WorldServer.java:33)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:260)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:201)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    2011-01-31 00:21:22 [INFO] hodsi1: yh i have a whole 0 credits cus im awesome
    Electroshock is not banned. Allow!
    Player count: 8
    2011-01-31 00:21:22 [INFO] Electroshock [/7.11.58.189:49359] logged in with enti
    ty id 201
    31.1.2011 0:21:31 org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event REDSTONE_CHANGE to ControllerBlock
    java.lang.ClassCastException: org.bukkit.material.RedstoneTorch cannot be cast t
    o org.bukkit.material.RedstoneWire
            at com.bukkit.hell_fire.ControllerBlock.CBlock.doRedstoneCheck(CBlock.ja
    va:115)
            at com.bukkit.hell_fire.ControllerBlock.BlockListener.onBlockRedstoneCha
    nge(BlockListener.java:119)
            at org.bukkit.plugin.java.JavaPluginLoader.callEvent(JavaPluginLoader.ja
    va:194)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:216)
            at net.minecraft.server.BlockRedstoneTorch.a(BlockRedstoneTorch.java:115
    )
            at net.minecraft.server.World.g(SourceFile:1556)
            at net.minecraft.server.World.f(SourceFile:1482)
            at net.minecraft.server.WorldServer.f(WorldServer.java:33)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:260)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:201)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    Anyway to fix this?
     
  7. Offline

    BigMoomba

    now i have 182
    at 162 it working fine but now not.

    My Plugins are:
    dynmap
    Essentials
    General
    Permissions
    SlowHealth
    WarpGate
    WorldEdit
    WorldGuard

    (plugins what i test but not working with the new version xd)

    Alchemy
    BlockDrops
    ControllerBlock
     
  8. Offline

    Omega-Assassin

    Is it possible to undo the reverse of red stone setting? Blocks only vanish when redstone is on. This makes it complicated to make quick open/close paths using pressure panels and buttons the way its set currently. And is there a way to prevent users who didn't place the control block from using it in any way? I love this mod but the recent change has made some of my little creations a little useless. Thanks in advance and please keep up the AMAZING work :D
     
  9. Offline

    Hell_Fire

    I had actually fixed a bug that was reversing it in the first place >.< As long as changing it around back the previous way doesn't cause any issues (like killing the server if wired up to itself).
    --- merged: Jan 31, 2011 1:08 AM ---
    Use a wire block on top rather than a torch as a work around, that's actually a neat way to get the inversion I hadn't thought of. I might make a specific check for a torch type, if it's able to be checked for powered/unpowered, might just have to check it's type, if it's REDSTONE_TORCH_ON or REDSTONE_TORCH_OFF.
    --- merged: Jan 31, 2011 1:10 AM ---
    I think magic carpet is one of those mods that rapidly places and removes blocks, I'll take a look at it soon.
     
  10. Offline

    RustyDagger

    Changing the CB Type seems buggy i changed it to The Lapi Block and it all seems to work up intill you give it power and nothing toggles

    I think you may of missed a place where it checks for the block type When you added in the setting. at some point in the code its looking for an iron block and its not finding it so nothing is happening.

    Also had some weird issues before that when i edited the block a sceond time some of the 1's from when i made it no longer toggled its like they were lost from the change system and the protection was gone as well...


    3rd edit turns out that it was world guard stopping the block changing witch really sucks cause
    the block i want to change is in the middle of the building and to unprotect it i would have to unprotect the whole building and i dont want that at all :(
     
  11. Offline

    Omega-Assassin

    I never noticed any problems with the way it was previously. The server and everything ran just fine. I just found it a little pointless to have it set for traps if the blocks only appear when the pressure plate it pressed down. For switch only functionality it would be great but the way it was set before gave this mod much more potential. I'm not trying to make this any more trouble then it probably already is I was just a little bummed when I found out that all my little traps and other setups were working in reverse. Sorry if this is getting annoying. Programming/Scripting can be a pain I know this from experience :p
     
  12. Offline

    Hell_Fire

    Tried to reproduce with LAPIS_BLOCK and couldn't get it to not work, but it might be because of other bugs which I'll be doing a fix for soon. There's actually only one part that checks for the block type :).
    Changing the CB type might not work properly with already initialized blocks. Hmmm, I guess I can run a quick check while it loads chunks to make sure ControllerBlocks are in the right spots and are the right types. Actually, stuff that, I'll just change the checks around so once a block gets set as a controllerblock, it'll work like one even if the type gets changed later.
    Not sure how WorldGuard does its checks, maybe it's canceling the event and I'm not checking if it's been canceled. Will take a look into it after I've slept.
     
  13. Offline

    cutman

    Keep up the good work, this is pretty powerful so I also made it the lapis block to make players work for their power :) I haven't gone out and tested it with the block yet though. BTW I have a suggestion for the trap/reverse issue if you're stuck. How about if there's no redstone on top of the block, but rather simply pointing at the block, it reverses the way it works? For example: Restone ontop of the block: Redstone on = blocks appear Restone pointing at the block: Redstone off = blocks appear
     
  14. Offline

    Hell_Fire

    I checked and having it feed back into the block still causes it to toggle every frame, but as of build 168, it no longer seems to cause the server to do a safety stop or whatever was happening before. It does cause a small CPU spike until the event limiting code kicks in and stops toggling the redstone to the block. Not sure if I want to rely on this but at least griefers can't stop your server just by feeding the torch back into the ControllerBlock anymore.

    So, might test it real quick with the latest build of Bukkit then release 1.03 :)
    --- merged: Jan 31, 2011 11:42 AM ---
    Ahh, I have a feeling his build relies on from a top down view, pressure plate, any old block, redstone wire, controller block, in a single column. That would make blocks disappear when you stood on the plate. Whereas if you put a redstone torch there instead of the wire, it doesn't toggle it :/ Is alright, doesn't seem to have too much averse affects anymore (it was just outright stopping the server when the events triggered too fast).
    --- merged: Jan 31, 2011 11:43 AM ---
    Oh, and I've made it respond to redstone torches on top of the block, so you can wire it up like that now ;)
    --- merged: Jan 31, 2011 1:01 PM ---
    And updated!

    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.

    Tested with versions 168 and 186, let me know how it goes :)
     
  15. Offline

    Merlin_Q

    Working good, Just one question...
    Where does it store the bindings?
    I ask because it is not removing them when the controller block is destroyed.
    I now have blocks I cant destroy because it says "linked to controller block", and the block doesn't exist...

    Im running Bukkit 186 with:
    Permissions
    Essentials
    WorldEdit
    WorldGuard
    AntiBuild
    KitPlugin

    Merlin_Q
    North Pole, AK
     
  16. Offline

    Hell_Fire

    ControllerBlock.dat in the main server folder, it's just a CSV, if you can find the offending block location with F3 in the client. Should match up easy enough.

    Strange that it's not unprotecting the blocks, hrmm... More problems against WorldGuard.. wonder what it's doing... >.<
     
  17. Offline

    shadydeath999

    does it work with permission so that like only admins can edit a controller block?
     
  18. Offline

    Hell_Fire

    Not yet, have preferred to try and get it working cleanly by itself before I start adding external mod code into it.
     
  19. Offline

    shadydeath999

    or can u put it in the config? like with username defined
     
  20. Offline

    Hell_Fire

    Ugh, also found a regression, minecart tracks don't save metadata properly >.< Sigh, too tired for tonight, will look more at it tomorrow.
     
  21. Offline

    shadydeath999

    ok ty for taking it consideration
     
  22. Offline

    Merlin_Q

    Awesomely fast response :)
    I answered my own question, I was just used to plugins putting files in the plugins directory

    It was in a World-Guard zone...
    I will try outside a zone and let you know.
    Thanks for the qool plugin.
     
  23. Offline

    Nevlic

    Could you make it so buckets of water/lava control the placement of water/lava blocks? So it can be used without having to have the water/lava blocks you cant get in game without /give like commands?
     
  24. Offline

    QQCucumber

    Do you think you could make it not cause a bunch of chat spam when you're trying to break it with a pick? Thanks.
     
  25. Offline

    Hell_Fire

    I tend to set it up so that another kind of block releases the flow of water/lava from a water/lava spring that doesn't get changed, has the same effect.
    --- merged: Jan 31, 2011 7:40 PM ---
    Well, technically it's not supposed to, it should only really say it once when the damage to the block starts, but bukkit fires off the damage event with damage level started multiple times.

    Ugh so tired, yay 4 hours sleep.
     
  26. Offline

    cutman

    Sweet, lapis controller is working swell.
     
  27. Offline

    Cryoffun

    When I press the iron block- nothing happends, not even in the console

    this is what i got on startup:


    ControllerBlock: 1.02 by Hell_Fire
    ControllerBlock: Using IRON_BLOCK as ControllerBlock, loaded 0 disallowed types from config
     
  28. Offline

    QQCucumber

    Right, but, couldn't you have it so hitting it with any pick item won't alert you at all as a workaround?
     
  29. Offline

    Hell_Fire

    Sure, I'll chuck that in the next release, I don't mind the spam though, kind of warns you in case you don't mean to destroy it, since you can possibly have quite a bit of work hanging off one block to redo :)
     
  30. Offline

    Wolfy9247

    I'm sure it's been answered, but will the Material.isBlock() check be fixed in any later builds? I'd love to be able to place things such as doors, but can't really do that with them being above 255.
     
  31. Offline

    Omega-Assassin

    When you say your pressing the block do you mean left click or right click?

    You have to hit the block (with the left click) once to activate it place your blocks and then hit it again (left click again) to finish the setup. I hope this helps you with your issue.
     

Share This Page