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

    weirdbeard

    @Hell_Fire Also discovered an odd one: If water is touching blocks when they are placed, they will not switch off. If you setup your blocks with a controller and THEN add your water, the blocks will switch on and off fine. So, if there is moving water that you damn-up, for instance, with blocks that are being added to the controller, the controlled blocks will not switch-off and on. They just stay there regardless.

    Thanks again for a very fun plugin. :)
     
  3. Offline

    Phanku

    Feature request:

    I might have missed it while reading the four pages here so if I did please excuse me.

    First, how many blocks can you add to a controller block?
    Second, is there way to set a limit?
    Third, if there is a way where would I look for that?

    The reason I ask is because I could see some users building giant domes and turning them on and off with controller block. I would imagine this would cause some serious lag doing that or am I being too worried?

    Thank you for your time.
    --- merged: Feb 8, 2011 2:11 AM ---
    Another feature request:

    A set range for controlling block.
    An option to turn the range off and on.
    An option to give people on a list the ability to ignore that range and the limit on the number of blocks that can be used.

    I.E.: The max range away from the controller block the disappearing blocks can be.
     
  4. Offline

    RustyDagger

    Iv had some problems with making changing blocks where old changing blocks used to be like make 1 then destroy it and then make another 1 in the same place and it wont change :/ infact the whole block fails even if some are not in the same place much frustrating

    also water as in id 8 dose not work at all. you should be able to make lava and water bukkits work by just add id 8 and 11 to the data storage when placed (lava works fine atm) ( i think the water has issues with its value)
     
  5. Offline

    skyeyemachine

    Not sure if this is possible, but would it be feasible to make this mod compatible with MoveCraft ( http://forums.bukkit.org/threads/mech-fun-movecraft-v0-6-5.1007/ )? As in, is it possible to make a controllerblock built on a vehicle update its position and the positions of its child blocks after a vehicle has been moved? This currently doesn't work, last I checked.

    If you could implement this, it would be exceedingly awesome; my mobile fortress's launch bay doors will thank you forever ( http://www.minecraftforum.net/viewtopic.php?f=1020&t=169293&p=2437186#p2437186 ). Thanks in advance. :D
     
  6. Offline

    Hell_Fire

    Thanks for the report, I'll have a look at it, have a feeling it's probably because of leftover metadata values or something.



    No limit, currently no way to set a limit (though is a planned thing), as for lag, the block toggles get applied pretty quickly in the event (doesn't load from file or anything, all data structures are in memory and it's just list iterations), so not really more so than someone running about the world loading chunks. But then that chunk loading you can get with any larger redstone contraptions, or even long minecart tracks. (I've got a in game digital clock on my server that does quite well at lagging people, but it's network lag, not server lag).

    No limits on range at the moment either, not even technically across worlds (when minecraft gets multiple world support, the mod should "just work" between worlds, and even possible to control blocks from across worlds, but might have problems with unloaded chunks (though, have that problem now if you're too far away, just don't notice it for the distance)).


    I've noticed sometimes placing a block doesn't fire off a BlockPlacedEvent properly, thus, the mod fails to catch it, I'll be changing the message that gets shown on screen to show a count of blocks placed every time you add/remove a block. Water is tricky since it's got a lot of MC dynamic code that controls it as well, so there might be extra data structures bukkit doesn't reveal, but I have to look at it closer.



    The dev of MoveCraft actually PMed me some time ago, but I never got around to replying, will have a look into it, I like the idea a lot :)
     
  7. Offline

    skyeyemachine

    Yay! I'll be looking forward to it then!
     
  8. Offline

    ShadowFile

    Any chance of this becoming compatible with Nijikokun's (something like that) permissions?
     
  9. Offline

    TheYellowAnt

    I get this with Bukkit 289. I get the "You're now editing this block with..." and "Added block to controller" messages, but when I hit the Controller Block again to finish editing I get this error message.

    SEVERE: Could not pass event BLOCK_DAMAGED to ControllerBlock
    java.lang.NullPointerException
    at com.bukkit.hell_fire.ControllerBlock.CBlock.loc2str(CBlock.java:247)
    at com.bukkit.hell_fire.ControllerBlock.CBlock.serialize(CBlock.java:199)
    at com.bukkit.hell_fire.ControllerBlock.ControllerBlock.saveData(ControllerBlock.java:176)
    at com.bukkit.hell_fire.ControllerBlock.BlockListener.onBlockDamage(BlockListener.java:69)
    at org.bukkit.plugin.java.JavaPluginLoader$21.execute(JavaPluginLoader.java:226)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:60)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:214)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:339)
    at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
    at net.minecraft.server.NetworkManager.a(SourceFile:232)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:310)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:225)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
     
  10. Offline

    Hell_Fire

    Probably a change in the Location object, will take a look at this later tonight :)
    --- merged: Feb 9, 2011 7:19 AM ---
    Apparently there's been a change in the redstone event too, ugh. Just keeping up with bukkit updates is a hassle too :p
     
  11. Offline

    QQCucumber

    It's been a little hectic because of the changes to the code needed for multi-worlds. ControllerBlock is the last plugin I'm waiting on to update to a 272+ build. :)
     
  12. Offline

    Kevin Forte

    Yeah, something definitely happened with build 289 and now it isn't functioning properly ): I'm still waiting on MonsterHunt to update desperately along with this one.
     
  13. Offline

    Hell_Fire

    I can't replicate the Location thing, dunno what's going on there :( And redstone toggle is definately broken, looks like the event isn't firing :/
    --- merged: Feb 9, 2011 8:29 AM ---
    It was firing, just with the wrong type (they fixed a bug I'd worked around in the first place). Uploading a new version now, haven't done too much with this one.
     
  14. Offline

    ZezadasPT

    Thank you so much for uploading this! Finally a good gate![​IMG]
     
  15. Offline

    mughi

    I've managed to lose a controller block somewhere. I created a control block, assigned some other blocks to it, and then accidentally destroyed the control block with a pickaxe, while still in add mode. now, whenever i place blocks of the type i was trying to assign, it says added to control block, but there is no control block. I cannot create any new control blocks either due to being stuck in edit mode. I assume that if I knew what to look for, I could fix it in the .dat file. Can you describe the layout of that file?

    note: using v1.04 due to waiting on CB to settle down a bit. If this is bug which has been fixed, let me know, and i'll figure out how to get everything updated to a newer version

    EDIT: I stopped and restarted the server, which dropped me out of edit mode and it is working now. Is there any other way to get out of edit mode if you destroy the block?
     
  16. Offline

    Hell_Fire

    Haha, sounds like a bug to me, hmmm, guess when I did some refactoring of the blockdamage code, I left that bit out. I'll fix that in the next version, thanks :)

    The layout of the .dat file is pretty simple, first line is a version line (so I can migrate data if I change the format), then there's one line per controller block (use an editor that shows the newlines separate from where it splits it on the screen, I'm a vim junkie, so I tend to use that), each line is a CSV in the format of:
    ControllerBlockWorldID,CBX,CBY,CBZ,MaterialType,FirstBlockWorldID,FBX,FBY,FBZ,SecondBlockWorldID,SBX,SBY,SBZ,etc,etc
    If you go through the file just checking the starts of the lines and matching it up with where the block was in-game (F3 will show your player characters location), then you can just delete the line and it'll disappear. Might want to stop the server first, if you're editing that file and someone else saves a ControllerBlock in world after you've saved, it'll overwrite your change (the mod doesn't load the file each time it checks if it needs to do something, just keeps it all in memory and commits to disk when it has a change to save).
     
  17. Offline

    NFFPokemon


    I also got this when i updated. tho i manage to solve the problem for me atleast.. when i updated i only replaced the jar, and not the folder too. when i deleted the folder and started up with only the jar everything worked perfect :)

    i dont know anything about this stuff really but im just saying this worked for me.
     
  18. Offline

    RustyDagger

    I bet things would get pretty weird if i was to have 2 blocks from the 1 controller on 2 different worlds. but srsly who would need that lol.

    so from the format of your file it seems this will handle multi verse just fine?
     
  19. Offline

    Hell_Fire

    It should, yeah, I haven't tested any of it yet though.
     
  20. Offline

    QQCucumber

    Are you still planning on making it so hitting the block with a mine pick won't return a controller block message?
     
  21. Offline

    Pookie21

    hey hell_fire,
    im really glad you did this ha, its great.

    Everything works smoothly until i wire it up and power the wire, where nothing happens. The change blocks dont change.

    Here's something else kind of squiffy: when the iron block is powered, and i go and click on it to edit it with my change block(in this case its just dirt), the other blocks that are in the set appear, and when i click it again to exit editing the control block (its still being powered at this point), the change blocks already in the set dissapear. So essentially this mod works, if i stand there and enter and exit editing mode every time i want to toggle my change blocks.

    When i cut power from the block, click it to edit it, the change blocks reappear, and stay showing no matter if im in edit mode or not (this is with the iron block NOT powered).

    also, it wont save the target blocks after server restart. Resets count of control block to 0.

    sorry if this was already covered in a previous thread!
     
  22. Offline

    Hell_Fire

    What server version?
     
  23. Offline

    Pookie21

    build 312
     
  24. Offline

    Hell_Fire

    Next version :)
    --- merged: Feb 12, 2011 7:14 AM ---
    Will take a look at it, I've only tested up to 289.

    Edit: Seems to be working okay for me, make sure you're running the wire on top of the block.
     
  25. Offline

    Pookie21

    yes i am. Maybe it just doesn't like some of my other mods. i experiment. thanks
     
  26. Offline

    captainbinary

    The controller block works fine untill you leave the area, or it seems to leave the memory of the server. Then it acts like nothing had been done to it.

    I am using craftbukkit 312 and the newest version of this mod. No error report.
     
  27. Offline

    RustyDagger

    Builds 297 and 303 i can confirm as not working it crashes the plugin loader as its loading and stops all plugins that would normaly load after it to not load. i would give you the error but my server host is fag and wont send me a copy of the server console :/ i only worked this out thanks to a friend.
     
  28. Offline

    QQCucumber

    ControllerBlock doesn't seem to detect when a controller block is destroyed very well anymore, after I destroy it I have to set down another block on the same spot and destroy it for it to register.

    You might want to take advantage of the new 323 feature:
    Code has been updated by Meaglin .
    • [​IMG]
      Meaglin

      Implementation of BlockBreakEvent (version f77e79e55bac124632a9b01e88cd50c4e6c4b415)
     
  29. Offline

    ark3typ3

    In all version (v1.06 is the latest I've used) a couple things I noticed:

    1) Stairs sometimes don't save in the right direction.

    2) if you place a block where the controller block was invisible. That block becomes immortal and controlled, but is not linked to the controller block. Seems that placing a block on one of it's faces smacks it back into shape, but it's kinda an annoying occurrence.

    3) The controller block can't stand to be around other blocks of the same type that aren't linked to the controller block. When placed next to same type blocks, the controlled blocks when switched off and back on may or may not reappear. Seems like they're still part of the count and still listed in the DAT file, but they do not show back up. If they ~do show back up, then they are no longer controlled and can be destroyed.

    build version: 302
     
  30. Offline

    LiaraAlis

    Hi,

    would it possible to replace blocks with others instead of switching off the blocks (replace with air)?
     
  31. Offline

    narrowtux

Share This Page