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

    joshr1001

    Doesnt seem to work. :|
     
  3. Offline

    ibitmyeye3

    Doesn't for me either.
     
  4. Offline

    Hell_Fire

    Hmm, there should be a line printed on console when it enables, then messages to the player that hits the iron block (solid iron block, not iron ore). When powered from redstone, it only checks the block above it for power, so you need the redstone wire block on top of the iron block. Will probably change this later so it can be powered like any other regular redstone powered block.
    --- merged: Jan 25, 2011 11:53 PM ---
    Might be a version or mod conflict, could you guys let me know what versions you're running? I've only tested this with relatively new builds of craftbukkit.
     
  5. Offline

    joshr1001

    Im not sure what server im running as of now. I updated today so. I'll try as you stated in the above post.


    *Edit
    Could you make a video tutorial?
     
  6. Offline

    ibitmyeye3

    I'm running craftbukkit build 141
     
  7. Offline

    Hell_Fire

  8. Offline

    lucky456

    Bug report!!
    Once we done edit blocks. It works well.
    However, after the controller finish. We destroy the blocks and power the controller again. The blocks that we destroyed are back again. It duplicate the blocks!!!

    The way to solve it: make those material can't be destroy. or make those material drop no items.

    Second problem.
    If we use CACTUS as material. It will drop CACTUS every time we power on/off the controller. It also kind like duplicate stuff.

    The way to solve it: You could just limit some material that players shouldn't control.


    btw. It also have problem with plant spread mod.
    The pumpkin will be able to grow in the air if we use it as material and place in the air :O
     
  9. Offline

    Hell_Fire

    Thanks lucky! I hadn't actually handled block removal at all except for the ControllerBlock itself, I'm adding that now :)
    --- merged: Jan 27, 2011 12:03 AM ---
    And updated, should stop that duplication bug, I'll take a look at the cactus thing now :)
    --- merged: Jan 27, 2011 12:14 AM ---
    Haha, hmmm, now that's an interesting one. If the cactus is only one block high, it doesn't drop anything, but if it's two/three high, it drops from the two top ones, which is very strange. Actually, if you want to really bug it out, place them three high, dig out the bottom one and watch the other two pop, now toggle it on and off really fast, instant cactus >.< Guess I need to set up a BlockFromToEvent handler or something *ponders*
    --- merged: Jan 27, 2011 12:44 AM ---
    Okay, if you build the stack of cactus "downwards" (place two sand blocks on top of the main sand block, cactus the top, then dig out the sand under the cactus, place again, dig out, place the last bit of cactus, then toggle, it doesn't drop blocks. It doesn't work for sugar cane because the sugar cane item isn't a block, so it won't let you do the same trick. The easy fix is to just not let you build with cacti, but where's the fun in that? What I'll do is I'll make it sort the list by the Y coord when you add a block to the controller, since it doesn't seem to do it when you build the cacti from the top down, so my guess is that it's only doing the check when the block type goes from cactus to air, and not the other way.
     
  10. Offline

    Andred

    This is really cool! I was going to do something like this, but thankfully now I don't. It would be really nice if I could specify what kind of block is the controller though, because I have an entire castle built out of iron [​IMG] I'm sure you intended to set that up eventually though.
     
  11. Offline

    Hell_Fire

    Haha, wow, at one point the people on my server were going to build a space shuttle completely out of iron blocks, but it got scrapped. Yeah, I haven't done any configuration handling yet, will add it soon I think :)
    --- merged: Jan 27, 2011 12:01 PM ---
    In reply from profile:
    shadydeath999
    can u also make it work for ssp pls cus a lot of people would love that​
    since sunrise(original creator) doesnt seem to update them​

    This mod uses a lot of bukkit calls, converting it to SSP is a lot more effort than I'm willing to go into. All is not lost however, if Mojang and the Bukkit team work together like they seem to be heading towards, and singleplayer becomes a local multiplayer server kind of setup like a lot of other multiplayer games with singleplayer are (HL2/etc), then I won't actually have to do anything apart from keeping it up to date with Bukkit.

    I wouldn't even know where to start in trying to get it in singleplayer, never decompiled Minecraft ever :)

    (PS. Keeping it in the thread would be nice :) )
     
  12. Offline

    Tempelchat

    That's an amazing plugin!

    Can you add that one controller block can control more than one blocktype?
    That would be great!
     
  13. Offline

    RustyDagger

    No not as good as the origional at all what happens when i want to toggle from stone to dirt huh cant do that can it?

    Thats why the set spaces in the inventory were good. the placement stick was also good for being able to stop what ur doing and then comeback to it again (good for server owners) also with the duping issues it needs to be fixed simple way to do this is to brake the controller block if any of its blocks are missing or changed. (if the server owner don't want it screwed with and broken he will have to protect the space or some thing.

    Onto another point Multiple type of blocks with 1 control block cant be done yes so to make a bridge apear with minecart track on it i need 2 blocks not cool.

    While i like what you have done I think you should do the name justice and make it how it was.

    Also some permission nodes would be good for the permissions plugin So i can limit who can make /use them.
     
  14. Offline

    seanth

    So, could you make a redstone torch a controller block? You place it to power the iron, which makes the torch disappear, which unpowers the iron, which makes the torch appear which....
     
  15. Offline

    kilimasdb

    Oh- thanks.

     
  16. Offline

    Hell_Fire

    Next version this is fixed, using two blocks and inverting the second, it will let you toggle between (rather than the race condition that happens when both change one tick separately as it is in 1.01).


    Hitting the block mid edit will take you out of edit mode, and hitting it with the block type it's set to will start it editing again. You can go in and out of edit mode as much as you like.

    Duping issue I'm having problems solving, as there isn't any event that gets fired when other blocks are changed by the original Minecraft code (Cactus, flowers, mushrooms, and any other type that is counted as a "block" by the Material.isBlock() function (anything with an item ID less than 255 really). So, it's either wait till that code is fixed, or I filter out block types that are known buggy, which I'll probably do for now, easy enough.

    One could argue that having the extended versatility of being able to have to toggle more than one type of block on/off should have a higher cost to use. Wiring two blocks so they toggle at the same time works just fine.


    If I was porting over the original mod, then I'd have it load all the original mods files. But seeing as this is an entirely from scratch code and the original mods save data is in a undocumented binary format, not a whole lot of chance of that, sorry.


    Might look at adding it in 1.03. 1.02 isn't far away, just testing the filtering blocks now.

    Owch, that's a nasty bug, I'll add redstone torches to the list of disabled blocks. >.<
    --- merged: Jan 29, 2011 7:51 AM ---
    Hmmm, minecart tracks act funny, going to need to store more information about the blocks I think, will look into this some more.
     
  17. Offline

    RustyDagger

    No dont do that Do not Remove the ability to use Redstone torches as a changing type i love using them to make dancing floors and a wireless Transmitter Set up. While i can see the problem I don't think Blocking a perfectly good block type because of it is a good idea hell if u do that you better block levers and dust pressure pads buttons while your at it. all of witch could be used to do exactly the same thing in fact this could still be done with the original CB it was never a problem that is why you don't let stupid players make them... AKA Permissions system..
     
  18. Offline

    Hell_Fire

    I set it up like that and it knocked my server out, maybe I'll just reverse the block toggle, so powered on = visible, powered off = air, that way if it's wired to itself, it'll just short it out and leave it on, rather than toggling every frame and causing the server to stop.
    --- merged: Jan 29, 2011 10:43 AM ---
    (I'd actually added pressure plates, levers, etc to the list already, because you can dupe them since they're attached to the other blocks. Wondering how I can get away with not having those with the least amount of outside data needing to be saved. (Less data saved about blocks, the less I need to keep track of changes to keep the mod data consistent with the live data.) Will change the toggle around and allow redstone torches again.
     
  19. Offline

    RustyDagger

    Good idea also it needs to check the xyz of what it placed that is how you fix the duping bug.

    So say it had a bunch of dirt placed and 1 was missing when it went to remove it the controller block its self would turn into gravel and no longer work. every thing to do with it would be removed.

    That would stop 99% of duping bugs on its own. so if it tried to remove air some thing is wrong then brake Or that not really the best way to do it cause then they could still take out the gold replace with dirt and farm the gold..
    Just make sure each block is what it should be before removing it /placing it placing it is not so bad they could just acidently remove a chest or some thing they they wanted.
     
  20. Offline

    Hell_Fire

    If I can stop them dropping when they disappear to outside influences, that'd solve the duping issue easy, wonder if there's a hook for that.
    --- merged: Jan 29, 2011 10:51 AM ---
    Problem is I want to to kinda fit in with how the Physics stuff works, how the blocks act on other blocks. I'm looking at some of that for the minecart tracks at the moment, since it's just flat out not working at all with them, no idea why. >.<
     
  21. Offline

    r42xer

    I believe the problem is with the minecart tracks is that there is extra data needed to place them and control which way they face. The data values are therefore different, ex, minecart tracks are 66, but when you place them, it gives it a value of 66x1, 66x2, 66x3,66x4, etc.
     
  22. Offline

    Hell_Fire

    Yeah, I got the metadata bit easy, is just getData/setData calls, working out after the block placement how the tiles have been updated is what I'm needing to intercept, thankfully it looks like BlockPhysicsEvent does what I need. Will also need to write some update code, since my save format is going to need to change to store the metadata >.< Oh well.
     
  23. Offline

    shadydeath999

    can u also make the blocks directly react on preasure plates?
     
  24. Offline

    Hell_Fire

    Possibly, #166 has a isBlockIndirectlyPowered and isBlockPowered, so I'm going to replace my simple check with that instead the version after next (to give people time to update).
     
  25. Offline

    Subcode

    can you add the possibility to change the controller block type ?
    i dont really want to use iron blocks because i use them with minecraft mania a lot.
    if i could change it to diamond it would be great.
     
  26. Offline

    cutman

    This is badass. I would highly appreciate a properties file for two things: One to change the type the controller block uses, and two to specify what blocks CANNOT be used with controller block. :)
     
  27. Offline

    Hell_Fire

    Updated, bunch of changes, lost track of a lot of them, haha. Have fun guys :)
    --- merged: Jan 30, 2011 2:10 PM ---
    The save file format has changed a little, but it should load the old one up fine and convert it on next save. :)
     
  28. Offline

    shadydeath999

    maybe a gui so you can change the display of the controller block
     
  29. Offline

    person

    I'm having a problem where it wont save the controller blocks targets when i restart the server is there a way to save them or was it made so it dosent do that????[​IMG]
     
  30. Offline

    Hell_Fire

    It saves when you finish editing the controllerblock, make sure you hit the main block again after you've finished editing.
     

Share This Page