[On Hold] [MISC] ClockSign v1.2 - Clock generator for timed redstone circuits [1060]

Discussion in 'Inactive/Unsupported Plugins' started by weeknie, Jul 10, 2011.

  1. Offline

    weeknie

    ClockSign - Clock generator for timed redstone circuits
    Version: v1.2

    See also:
    IC Generator

    This plugin can produce a clock for timed redstone circuits.
    By clock I mean a control signal, like digital circuit clock (usually known as the CLK signal), not a 24 hour clock.

    The reason I made this plugin was because we needed a clock for some circuits, but there was no way to keep it running after a server reboot and it would often change it's duration when the server lagged.
    This plugin gives a clean 50/50 duty cycle (50% of the time high, 50% of the time low) and will work as soon as the chunk the clock is in is loaded

    To build a clock do the following:
    1. Place a block (I would suggest cobblestone)
    2. Place a sign on top of that block with atleast the text "clocksign" (without the quotes) on the first line
    3. Add a number on the second line to indicate how much time (1 = 0.1 seconds, 2 = 0.2 seconds...) there have to be between switching from high to low/visa versa
    4. Add the text "sync" (without the quotes) on the third line to sync the clock with any other synced clocks (globally)
    5. Add lever(s) to the side of the block you placed at #1 (it/they can be on the north, east, south and/or west side of the block)
    NOTE: this has to be the block the sign is standing on, not next to the sign itself!

    The clocks will be registered with the plugin when the chunk they're in is loaded and unregistered when the chunk is unloaded.
    This means that only clocks that are in currently loaded chunks will actually work.

    You can disable a clock using redstone by placing redstone wire right next to the sign (that is north, west, south or east of the sign), on the same level, and power the redstone. Either place it before you place the sign or do /clocksign reload to make sure the sign sees the redstone wire.

    Features:
    • Generate a clock for timed redstone circuits
    • Synchronize with any other clock registered
    • Tap the lever to swap the levels (when it was going to be high before, it will now be low and visa versa)
    • Use 2 or more levers to get the clock and it's inverse directly, instead of with 1 torch delay
    • Keeps working after a server reboot
    • Disable clocks with redstone wire, the wire has to be placed before the sign is built, or you have to do /clocksign reload after you've placed the redstone
    • Reload clocks manually when required with /clocksign reload
    • Use /cs, /csign and /clock as aliases for /clocksign
    Download: http://dl.dropbox.com/u/5202392/ClockSign.jar

    Sources are included in the .jar

    Todo:
    • Check whether the disable redstone is on as soon as the sign is registered, to ensure the sign is disabled after a server reboot or /clocksign reboot while the disable wire is high.

    Changelog:
    v1.2:
    • Added a command to manually reload all clocks in your current world, i.e. the world the command was executed from (the command will *not* work from the server console!)
    • Added a way to disable the clock signs by redstone, simply put redstone on the *same* level as the sign itself, next to the sign, and turn the redstone on to disable the sign
    v1.1:

    • Fixed the ConcurrentModificationException and the IllegalStateException
    v1.0.1:

    • Fixed a bug that caused all levers belonging to the same clock sign to be forced into the same state. Now they will only be forced into the same state when the sign is placed and it's a synced clock
    v1.0:

    • Released my plugin
     
  2. Offline

    ratman150

    tried it love it i was wondering if anyone would come out with something like this.
     
  3. Offline

    weeknie

    Glad to have been of service, we had been troubled by this for a few weeks now, so I thought let's just write it myself:p

    Any suggestions for features?
     
  4. Offline

    mxE333xm

    It would be good to have the ability to set a frequency in Hertz ;)
     
  5. Offline

    weeknie

    The server simply isn't fast enough for that, the most I could give you is a pulse ever 0.05 sec, but circuits will only start to pick up at around 0.15 sec
    I don't really think hertz will be useful, something with 6.66666667 Hertz isn't really usefull is it:p
     
  6. Offline

    ratman150

    oh i got a idea what if say you have a switch on each side of the block it sequences those. all you would have to do is have 2 or more switches or make the sign with something like sqer on a line.
     
  7. Offline

    MasterMeNL

    I really love this plugin, but could you make it that you can turn off the sign with a redstone current somehow (it will simple 'pause' the clock if it's not synced and will stop it when it's synced?)
    You could make it that when the block where the sign is on gets input from the side (or only from below since the sides are already for levers?) to stop/pause the clock.

    Greetings,
    MasterMe.
     
  8. Offline

    weeknie

    That sounds like a good idea, it's easily doable, but at the moment I'm working on another redstone plugin.
    I think it should be done tonight though, watch this thread for updates;)
    And btw, Netherlands ftw!:D
     
  9. Offline

    MasterMeNL

    Ahaha lol Nederlands xD
    I shall watch this thread like a pro since I really love this plugin.
    BTW, check your PM.

    It seems like this plugin is causing this error when my backupplugin tries to refresh the cache (causes lagg).
    Code:
    2011-07-15 21:46:07 [SEVERE] java.lang.IllegalStateException: TickNextTick list out of synch
    2011-07-15 21:46:07 [SEVERE]     at net.minecraft.server.World.a(World.java:1944)
    2011-07-15 21:46:07 [SEVERE]     at net.minecraft.server.World.doTick(World.java:1705)
    2011-07-15 21:46:07 [SEVERE]     at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:441)
    2011-07-15 21:46:07 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    2011-07-15 21:46:07 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    2011-07-15 21:46:07 [SEVERE] Unexpected exception
    java.lang.IllegalStateException: TickNextTick list out of synch
        at net.minecraft.server.World.a(World.java:1944)
        at net.minecraft.server.World.doTick(World.java:1705)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:441)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    It can only be fixed by restarting the server.
    BTW: I'm using only 1 clock atm:
    clocksign
    18
    sync

    I will try to remove the sync and see if that fixes it.

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

    Sneaky420

    Here is my error, and I have changed out plugins and if it was not Pailstone, it was Autoclear, then it was Streetlamps, all plugins on bukkit all updated to current


    Code:
    2011-07-15 18:07:46 [SEVERE] java.util.ConcurrentModificationException
    2011-07-15 18:07:46 [SEVERE]     at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
    2011-07-15 18:07:46 [SEVERE]     at java.util.HashMap$KeyIterator.next(HashMap.java:828)
    2011-07-15 18:07:46 [SEVERE]     at java.util.AbstractCollection.toArray(AbstractCollection.java:124)
    2011-07-15 18:07:46 [SEVERE]     at java.util.ArrayList.<init>(ArrayList.java:131)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:42)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.World.k(World.java:451)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.World.applyPhysics(World.java:427)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.BlockDiode.c(SourceFile:212)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.Chunk.a(Chunk.java:265)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.World.setRawTypeIdAndData(World.java:289)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.World.setTypeIdAndData(World.java:382)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.BlockDiode.a(SourceFile:69)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.World.a(World.java:1965)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.World.doTick(World.java:1705)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:441)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    2011-07-15 18:07:46 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    2011-07-15 18:07:46 [SEVERE] Unexpected exception
    java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
        at java.util.HashMap$KeyIterator.next(HashMap.java:828)
        at java.util.AbstractCollection.toArray(AbstractCollection.java:124)
        at java.util.ArrayList.<init>(ArrayList.java:131)
        at net.minecraft.server.BlockRedstoneWire.g(BlockRedstoneWire.java:42)
        at net.minecraft.server.BlockRedstoneWire.doPhysics(BlockRedstoneWire.java:286)
        at net.minecraft.server.World.k(World.java:451)
        at net.minecraft.server.World.applyPhysics(World.java:427)
        at net.minecraft.server.BlockDiode.c(SourceFile:212)
        at net.minecraft.server.Chunk.a(Chunk.java:265)
        at net.minecraft.server.World.setRawTypeIdAndData(World.java:289)
        at net.minecraft.server.World.setTypeIdAndData(World.java:382)
        at net.minecraft.server.BlockDiode.a(SourceFile:69)
        at net.minecraft.server.World.a(World.java:1965)
        at net.minecraft.server.World.doTick(World.java:1705)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:441)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    This is a great idea and I hope the bugs can be worked out, it is perfect for a lot of applications. Please let me know if there is more info you need to resolve this bug for now I have had to disable the plugin to keep the server up
     
  11. Offline

    kimitsu_desu

    Sorry, can't provide detailed info on this issue, since I'm not an admin on that server, but apparently clocks fail to start when chunk is loading. The only way to restart it which i could find is to remove the sign and place it again. But when you disconnect from the chunk where the clock is and reconnect again, the clock stops.
    Here is the list of plugins on the server, if that helps:
    plugins.jpg
    Please, help us to find some workaround or please fix the bug, if this is the case here...
     
  12. Offline

    weeknie

    I'm currently quite busy, I'll try to confirm your bug, but I'll need more info if I can't find it myself
     
  13. Offline

    kimitsu_desu

    An admin reported me a console message which is most likely associated with the issue:
    13:43:46 [SEVERE] Could not pass event CHUNK_LOAD to Clock Sign
    java.lang.NullPointerException
     
  14. Offline

    weeknie

    Please include the complete stack trace*
    Or at least the last 2 or so function calls, that would be very much appreciated
     
  15. Offline

    mutiny

    00:17:24 [SEVERE] Could not pass event CHUNK_LOAD to Clock Sign
    java.lang.ClassCastException
    00:17:24 [SEVERE] Could not pass event CHUNK_LOAD to Clock Sign
    java.lang.ClassCastException: net.minecraft.server.TileEntityChest cannot be cast to net.minecraft.server.TileEntitySign
    at org.bukkit.craftbukkit.block.CraftSign.<init>(CraftSign.java:16)
    at org.bukkit.craftbukkit.block.CraftBlock.getState(CraftBlock.java:203)
    at org.bukkit.craftbukkit.CraftChunk.getTileEntities(CraftChunk.java:107)
    at me.weeknie.clocksign.api.ClockSignWorldListener.onChunkLoad(ClockSignWorldListener.java:21)
    at org.bukkit.plugin.java.JavaPluginLoader$47.execute(JavaPluginLoader.java:570)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:332)
    at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:90)
    at net.minecraft.server.ChunkProviderServer.getOrCreateChunk(ChunkProviderServer.java:118)
    at net.minecraft.server.World.getChunkAt(World.java:274)
    at net.minecraft.server.World.getTypeId(World.java:221)
    at org.bukkit.craftbukkit.PortalTravelAgent.findPortal(PortalTravelAgent.java:63)
    at org.bukkit.craftbukkit.PortalTravelAgent.findOrCreate(PortalTravelAgent.java:27)
    at net.minecraft.server.ServerConfigurationManager.f(ServerConfigurationManager.java:294)
    at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:243)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:294)
    at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:85)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    00:17:24 [SEVERE] Could not pass event CHUNK_LOAD to Clock Sign
    java.lang.ClassCastException
     
  16. Offline

    weeknie

    I'm sorry mutiny, but this is an error in CraftBukkit, I can't help you with that.
    Maybe you should update your CraftBukkit?
     
  17. Offline

    MasterMeNL

    I removed the test sings on my server and it seems build #1000 is doing strange things with sings, minecart mania doesn't work on build #1000 and I guess many more plugins.
     
  18. Offline

    weeknie

    Already started to notice that, thanks for confirming it though.
     
  19. Offline

    kimitsu_desu

    On the server I play on, after updating to #1000 and disabling Minecart Mania, the issue with the clock stopping seems to be gone...
     
  20. Offline

    weeknie

    Updated my main post to recommend against updating to 1000, thanks for the help guys!
     
  21. Offline

    shanecraft

    I have a suggestion/request: Would it be possible to make it so that on the 4th line you can specify the duty cycle manually rather than have 50/50? There are a few cases where having it off for most of the cycle would be very useful (ex. in very long delays, have only a short high time). I'm looking to achieve a similar effect to using redstone repeaters in a long loop to give power only once per time it circles around, since /time breaks redstone repeaters...
     
  22. Offline

    weeknie

    Although this would be possible, I don't really have time to add this anywhere soon.
    I would suggest you take a look at http://www.minecraftwiki.net/wiki/Redstone_circuits#Pulse_Limiter or a so called "edge trigger".

    Thanks for the suggestion though, I'll keep it in mind and see if I can get to it;)
     
  23. Offline

    shanecraft

    Thanks for the reply, never knew about those. Good luck with the development, clock generators are a key part of my challenge rooms. Pistons + clock generators = epicness.
     
  24. Offline

    MasterMeNL

    The 3-line fix for minecart mania works, I updated to #1000 since bukkit kept download BukkitContrib which crashed my server and I failed to find the plugin that caused it.
    The plugin works good, except that when the server reboots, the chunks needs to load, unload and load again for it to work or you need to replace the sign.
    I don't see any errors, but perhaps you could try something similar to MM's fix?
     
  25. Offline

    mutiny

    altho you recommend not updating, 1000 is the rb so people will update.

    10:22:34 [SEVERE] Could not pass event CHUNK_LOAD to Clock Sign
    java.lang.NullPointerException
    at org.bukkit.craftbukkit.block.CraftSign.getLine(CraftSign.java:24)
    at me.weeknie.clocksign.api.ClockSignWorldListener.onChunkLoad(ClockSignWorldListener.java:26)
    at org.bukkit.plugin.java.JavaPluginLoader$47.execute(JavaPluginLoader.java:570)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:332)
    at net.minecraft.server.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:90)
    at org.bukkit.craftbukkit.CraftWorld.getChunkAt(CraftWorld.java:96)
    at org.bukkit.craftbukkit.CraftWorld.getBlockAt(CraftWorld.java:64)
    at org.bukkit.craftbukkit.block.CraftBlock.getRelative(CraftBlock.java:121)
    at org.bukkit.event.block.BlockFromToEvent.getToBlock(BlockFromToEvent.java:39)
    at com.gmail.nossr50.listeners.mcBlockListener.onBlockFromTo(mcBlockListener.java:328)
    at org.bukkit.plugin.java.JavaPluginLoader$30.execute(JavaPluginLoader.java:448)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:332)
    at net.minecraft.server.BlockFlowing.a(BlockFlowing.java:134)
    at net.minecraft.server.World.j(World.java:1951)
    at net.minecraft.server.World.doTick(World.java:1723)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:441)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
     
  26. Offline

    weeknie

    Mutiny I get that, but seeing as these are errors created by craftbukkit itself, there's not really much I can do about them.

    Thanks for the exception though, I'll look into it

    EDIT: confirmed, this is an internal exception, this is nothing I can fix
    I'll tell you again, just don't upgrade, I don't know why they even made this a release build
     
  27. Offline

    Farew311

    What is the maximum period you can put on the signs? I was hoping I could do almost a clock that turns on for the day and off at night.
     
  28. Offline

    weeknie

    You can use any period you want, but what you want to do won't work.
    For instance, if your server shut down in the middle of the day, the clock would start counting like it's the beginning of the day on the next boot
    Perhaps I can make an option to sync the clocks with daylight though, I'll look into that
     
  29. Offline

    weeknie

    I will not be adding the sync with daytime feature, apparently time is very unstable in minecraft, this would create too much trouble for me
     
  30. Offline

    weeknie

    You can now disable signs by redstone wire and manually reload signs in case they stop working (/reload seems to do that a lot)
     

Share This Page