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

    hyperch

    hmm.... good question.... I thought there was silver also...
     
  3. Offline

    Kartus

    does this work with actual bukkit recommended build 432+ ?
     
  4. Offline

    ShadowDrakken

    Yup, using it for light switches in #432 right now
     
  5. Offline

    Hell_Fire

    It was working fine, I did an update that gets rid of that nag message anyway, also fixed up the Permissions mod check (doesn't error at least with the changes to the mod loading system or linked against 2.1, so I'm guessing it's okay)
     
  6. Offline

    starbuck4619

    Sweet plugin, I made the fastest (and most stable) clock generator possible using this. I'd upload a video, but Fraps has been killing my frames per second lately.
     
  7. Offline

    Orangenpresse

    Nice Plugin, but only works in my mainworld after Serverrestart.
    Multiworldable would make it awesome :)
     
  8. Offline

    Taxen0

    This was using a "lava source" block, given via admin command. when i tried to add it i got a message saying that the block was removed because it changed or something like that. (worked with a solo "still lava" block tho).

    I am also using minecart mania but I can usually find plenty of gold, its (so far) not used for anything but watches,
    so it seems like a fair price. and like you said, default it to off and its good.
     
  9. Offline

    turtlelink2

    build #429
    Code:
    2:32:07 [SEVERE] Could not pass event BLOCK_DAMAGED to ControllerBlock
    java.lang.NullPointerException
        at com.hell_fire.bukkit.ControllerBlock.CBlock.loc2str(CBlock.java:306)
        at com.hell_fire.bukkit.ControllerBlock.CBlock.serialize(CBlock.java:257)
        at com.hell_fire.bukkit.ControllerBlock.ControllerBlock.saveData(ControllerBlock.java:181)
        at com.hell_fire.bukkit.ControllerBlock.CBlock.editBlock(CBlock.java:138)
        at com.hell_fire.bukkit.ControllerBlock.BlockListener.onBlockDamage(BlockListener.java:128)
        at org.bukkit.plugin.java.JavaPluginLoader$23.execute(JavaPluginLoader.java:242)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:225)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:346)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.a(SourceFile:230)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:70)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:338)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:253)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    this happens when trying to finish editing a block
     
  10. Offline

    Wernesgruner

    Code:
    [SEVERE] Could not pass event BLOCK_DAMAGED to ControllerBlock
    java.lang.NullPointerException
        at com.hell_fire.bukkit.ControllerBlock.CBlock.loc2str(CBlock.java:306)
        at com.hell_fire.bukkit.ControllerBlock.CBlock.serialize(CBlock.java:257)
        at com.hell_fire.bukkit.ControllerBlock.ControllerBlock.saveData(ControllerBlock.java:181)
        at com.hell_fire.bukkit.ControllerBlock.CBlock.editBlock(CBlock.java:138)
        at com.hell_fire.bukkit.ControllerBlock.BlockListener.onBlockDamage(BlockListener.java:128)
        at org.bukkit.plugin.java.JavaPluginLoader$23.execute(JavaPluginLoader.java:242)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:225)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:346)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.a(SourceFile:230)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:70)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:338)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:253)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    Hello! Thank you for your wonderfull plugin! Only problem is that it seems to have problems with build [440].
    I get no reactions at all from the block. I had a reaction when i first used a block after updating then the error I posted up there popped and now it doesn't react anymore. Even restarting doesn't seem to alllow me to reproduce the bug.

    Thank you again !
    And good luck with the plugin :D
     
  11. Offline

    ShadowDrakken

    Does it still do it when you roll back to the recommended plugin development build (432)?
     
  12. Offline

    audhen

    Nag nag :)
    Code:
    [WARNING] Using the stupidly long constructor com.bukkit.hell_fire.ControllerBlock.ControllerBlock(PluginLoader, Server, PluginDescriptionFile, File, File, ClassLoader) is no longer recommended. Go nag the plugin author of ControllerBlock to remove it! (Nothing is broken, we just like to keep code clean.)
    Awesome plugin btw :)
     
  13. Offline

    Wr47h

    hello, I am sorry I use a translator.

    I noticed a bug, if I add a torch to controllerblock, then that I break the torch with water.
    When I activate the controllerblock, the torches are duplicated.
     
  14. Offline

    Hell_Fire

    I fixed that up in 1.12, could you check the version you downloaded was the right one? I have a feeling that my file is getting cached for some people and they're ending up with old versions.

    Thanks! I'll add it to the known bugs and will take a look at it later :)

    Been going through and adding a HEAP of debug log messages, hopefully it'll give you guys the information I need to fix some of the odder issues I'm seeing here :)

    Interesting you mention this. Any errors on the console when it loads up?

    I'll probably be changing away from using the world ID to the world name, not sure if it's as static for an id as it would be suggested.

    Am wondering if the locations fail to load properly because the chunks aren't loaded.. both my live server and my test one only really have controllerblocks around the initial spawn area.

    Anti-dupe code, the lava source block probably changes to stationary_lava after being placed, which throws the code that checks for block changes off. Liquids in general are a pain :p Current workaround for this I've been suggesting is use other blocks to control the flow/exposure rather than controlling the liquid block itself. Will add to the known issues as well :)

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

    turtlelink2

    After finishing editing any block I cannot finish and get this error,
    Code:
    2:32:07 [SEVERE] Could not pass event BLOCK_DAMAGED to ControllerBlock
    java.lang.NullPointerException
        at com.hell_fire.bukkit.ControllerBlock.CBlock.loc2str(CBlock.java:306)
        at com.hell_fire.bukkit.ControllerBlock.CBlock.serialize(CBlock.java:257)
        at com.hell_fire.bukkit.ControllerBlock.ControllerBlock.saveData(ControllerBlock.java:181)
        at com.hell_fire.bukkit.ControllerBlock.CBlock.editBlock(CBlock.java:138)
        at com.hell_fire.bukkit.ControllerBlock.BlockListener.onBlockDamage(BlockListener.java:128)
        at org.bukkit.plugin.java.JavaPluginLoader$23.execute(JavaPluginLoader.java:242)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:225)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:346)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.a(SourceFile:230)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:70)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:338)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:253)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    this is with build 432
     
  16. Offline

    Silvo

  17. Offline

    ark3typ3

  18. Offline

    ShadowDrakken

    Yeah, it kind of sucked when I accidentally removed a controller block and everything it controlled just vanished :\
     
  19. Offline

    Hell_Fire

    Sure, will keep it in mind for the next release, redoing some of the config stuff anyway :)

    Hehe >.< You'd need to replace everything that was down anyway, but I guess it helps to have the old reference.

    Sounds like FenceStack has some other problems other than the event stuff at the moment. Might see if I can help on the event stuff at least. How events are called might have changed on them.

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

    ShadowDrakken

    the issue is we're not using inventory hacks, so when stuff vanishes, we have to re-find/remake it... on things like metals and obsidian, that can be painful :)
     
  21. if i choose a material for my controller block, will it make all instances of that block be controller blocks? For example if i used sand, or dirt, or gold ore, would all dirt, sand, or gold ore be turned into controller blocks?
     
  22. Offline

    ShadowDrakken

    it will cause any new one placed to be a controller block, but will not effect existing blocks of the same type... for instance, if you make a controller with an iron block and then go edit the config to note blocks... the iron block will continue to function but no new iron blocks will be controllers, and note blocks placed prior to the config edit will not be controllers
     
  23. Does anyone have a default configuration file? Cause my notepad makes it all one line and generally unreadable
    Didn't realize that it was in the first post >_>
     
  24. Offline

    ShadowDrakken

    it's best to use PSPad or Notepad++ with ANY Bukkit plugin config files
     
  25. Offline

    Hell_Fire

    It's not refunding items? When you destroy the controllerblock, it should drop all the blocks tied to that controller out of the controller. If it's not, it's a bug, let me know! :)
     
  26. Offline

    ShadowDrakken

    I took down a ControllerBlock yesterday and lost 9 wood planks and a torch, not sure why it didn't refund it, there was no error output on the console.
     
  27. Offline

    sk8r2k11

    Had an idea. Maybe you should be able to link up a button to the controller block without redstone? so, like elevators, you type in a command like "/cb link" then right click the button you want to link then right click the controller block, this would be pretty epic :D. also any chance you could add an option so that the blocks are there when the controller block has not got power (redstone torch on top of controller block is lit)?
     
  28. Offline

    ShadowDrakken

    Yeah, it'd be nice if ControllerBlock had a two-state setup. If the redstone wire was lit when items are placed, they'd be there anytime it's lit, and if the redstone wire was dark when the items are placed, they'd be there anytime it was dark, rather than only being there when the wire is lit regardless of when they're placed :)
     
  29. Offline

    kovarex

    It would be really very helpful if there was way to transfer controller-block assigned blocks from one controller block to another (I can do it by editing the dat file manually, but it isn't very user-friendly), so when you need to move/reorganise circuits connected with those blocks, you wont have to rebuild all blocks connected to the controller-block
     
  30. Offline

    ShadowDrakken

    yes... oh lord yes... lol
    this could maybe be done by right-tapping the controller block with another controller block then placing that new block? It'd then auto-transfer all the circuits (but not be editable until you placed a new redstone wire on top of course)
     
  31. Offline

    kazeen

    does this work on latest cb builds
     

Share This Page