[INACTIVE][MECH] TorchBurn v1.2 - Carry torches rather than placing them [556,565]

Discussion in 'Inactive/Unsupported Plugins' started by Ryan Carretta, Feb 25, 2011.

  1. Offline

    Ryan Carretta

    Cripes, I was inactive for ~1 week while a friend was visiting and the plugin gets moved to inactive. :p

    Interesting. Yes this would be a bug. The 'best' way to fix this is with more Bukkit inventory event hooks, but I can think of something that might fix it as well as a sort of hack. Thanks for the feedback.

    That'll teach you to exploit! :p

    I can add the shift+mousebutton by checking if the player is sneaking before calling the code to light a torch. I'll work on this - it will likely be a server configuration option.

    Strictly speaking this is not limited to underwater, though it may be more prevalent if the light level is very low (i.e. no sun exposure).

    I may add a server config option to disallow torches under water. I decided not to touch this for the v1.0 release, though. As a side note, any time there are lighting bugs, placing a torch will force a recalculation.

    This is almost certainly client lag due to the new lighting engine. You could try turning off this option to test, or get a better machine. :p

    I've never seen nor heard of this behavior, and I'm not able to reproduce.

    Yes. A lot of this has to do with how I am storing the data about the blocks you are lighting with the torch. I intend to revisit this at some point, but it is not a priority.
     
  2. Offline

    wildshoetwt

    Is it really too much to ask for a simple config file with adjustable time, when you can place a torch and have it last an infinite amount of time, the 20 seconds or so holding it in your hand is pretty meager, my server strives for realism, and no decent torch lasts 20 seconds, maybe a sparkler, but not a torch.
     

  3. Although not intentional from the plugin author, have you tried the exploit described in this post by @pizzaboy ? ..... that will give you what you want.
     
  4. Offline

    wildshoetwt

    nah I'm not looking for exploits for infinite torches that deletes your hotkeyed items, i'm looking for a configuration file...it can't be that hard
     
  5. Offline

    Ryan Carretta

    No, it's not too much to ask. I do have a full-time job though, and in my off time I like to sometimes do things other than code for free for a Minecraft plugin. :) If you're on a time crunch, the source is out there. Nothing is stopping you from implementing this yourself. Otherwise it will have to wait until I'm ready to put it in.
     
    willurd likes this.
  6. Offline

    FuzzeWuzze

    Amazing plugin, pretty much exactly what i want....

    I may take a look at the code tonight and see if i can atleast modify your version to extend it longer.

    Does anybody know if this works with the last recommended Bukkit #531?

    I really need this plugin because i have my new world set so that people cant place torches in the wild outside of towns...but its too dark to mine...
     
  7. Offline

    Shenlong

    Works for me on latest RB (#556). Except that I could never get it to light things on fire. That might be something with my config and I really don't care about that part of the plugin personally.
     
  8. Offline

    FuzzeWuzze

    Im working on modifying this and will post it here hopefully tonight, thanks for the initial starting point Ryan. I wouldnt even know where to begin in writing the lighting algorithm...

    Things im going to change to better fit my world...
    -Players swing a torch it is lit and 1 is removed from the stack
    -Players dont have to keep the torch equipped, they basically have a floating light on them. In theory it'd be optimal if you could equip items in both hands in minecraft and force them to have a torch in their left, but sinc eyou cant this allows people to use a torch and mine deep down at the same time.
    -Various removal of code that causes it to extinguish like throwing your equipped item
    -Removed setting people on fire...
    -If i can figure out how it works ill add a config file..

    This is literally the first bukkit plugin ive ever looked at, i'm a C developer and done some basic Java so its all starting to make some sense now looking at the bukkit API...

    http://dl.dropbox.com/u/2798684/TorchBurn-FuzzeRev2.zip
    Well here it is for what its worth, its not 100% but its pretty close. Maybe Ryan can contact the bukkit guys to get this mod reactivated? If not and with Ryans permission to use his lighting maybe ill just branch this into a seperate plugin.

    Here is my modified version, i gutted some of the stuff Ryan had but used the main algorithm behind the lighting which was genius and would have taken me forever to figure out.

    Things that were changed
    - Config file, alter the lightTime to change how long it stays lit. Its in server ticks, so you may need to play with it. 400 for me is about 20 seconds.
    - Right clicking in air with a torch in hand removes one torch and enables the light. You dont need to keep the torch equipped to get the lighting effect. You can go about mining and placing blocks and torches on the walls, there are some bugs regarding this ill post below.
    - Sneaking kills your torch light if its active. This is the easiest way to deal with it for now if someone right clicks air on accident with the light and wants to turn it off.
    -Light is no longer additive, Ryan had this in and really it doesn't add anything of value to the mod IMO. It caused a lot of issues. Basically if player 1 lights a torch, the mod gets the light state of all the blocks before it modifies them. This way when it goes out it can revert them back. The problem came when another player would turn on a light in the same area as player 1, so their "baseline" lighting of all the blocks had them lit. So when player 1's torch went out, then player 2's torch went out he reverted back to the light he saw when player 1 was there...hopefully that makes sense. Regardless its gone now so each player has their own light.
    -If your light is enabled and you place a torch, it will disable your light. This is to prevent a possible bug from above where a player has their torch on in a area with zero light, then places a torch on the wall. When the players light source is disabled, it reverts the entire area back to pitch black even though there's a torch on the wall.

    Known bugs:
    It still works underwater, but i havent been able to get it 'stuck' ...the light goes out and the water gets dark again...
    Every once in awhile for an unknown reason light does get stuck on, simply placing a torch or removing a block should fix this.
    Placing a block when your torch is on will cause it to go out..simply moving will turn it back on. For some reason when i trigger off the block placement to have it relight the area it flicks it on then back off? Maybe Ryan has an idea...but for now it works.

    *edit* uploaded V2, for some reason the properties i had setup worked on my windows bukkit server but not my linux box...so i rewrote it real fast using some other plugins code.

    Tested on CraftBukkit 531
    http://dl.dropbox.com/u/2798684/TorchBurn-FuzzeRev2.zip

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 10, 2016
  9. You need to update your download link to this :
    http://dl.dropbox.com/u/2798684/TorchBurn-FuzzeRev2.zip
    underneath, the link is still pointing to this :
    http://dl.dropbox.com/u/2798684/TorchBurn-Fuzze.zip

    I shall see if your changes assist with my previous problems ........... many thanks for the update.

    A quick note to users trying this - there is a 'Torchburn' directory in the zip file. I tried, and this doesn't get created automatically, so just drag it out of the zip directly into your plugins directoryalong with the torchburn.jar & job done.
    Configurable option :

    lightTime=2400 (default)

    Just given this a very quick testing (bukkit #560) - the only thing I couldn't see happening is that if you light a torch and then you plant another torch on a rock / dirt, etc. your torch goes out - moving doesn't bring it back on (as the spider that killed me will attest to). Other than that, it works great - and I'm going to give it another try on my server, since you can still plant torches if you have one lit - which you couldn't before. I like it working underwater - hope you are NOT thinking of stopping that - or if some people want that, could you make it configurable, if possible please ?
    .......... many thanks for a great update .........

    [Edit} Misread your instructions - I realise now that once you place a torch the light goes out - my fault for not reading it properly - its only when placing a block that it comes back on when you move ..... I'll try to read more slowly in future ....... :oops:

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

    FuzzeWuzze

    Thanks for the heads up fixed the link...ill probably be branching this off into my own plugin here in the next few days and work on further enhancements.

    But yes, your citing is actually on purpose. Because when you light your torch it basically stores all the lighting information for the blocks around it. So if its 100% dark it writes all that darkness for each block. If you then place a torch it effects the lighting as it normally does for the surrounding area. But then once your actual LIT torch goes out, it reverts its light back to the state it stored...which is pitch black...so you get these wierd cases where there sa torch on a wall and everythings pitch black.
     
  11. Offline

    Ryan Carretta

    You're more than welcome! I'm happy somebody is putting my code to good use.

    I released another version (post below) and asked them to move this back to releases. As far as releasing your own plugin, that's up to you. Right to fork and all that. Only thing I would politely ask is that you credit this plugin in some way so a server admin can choose whichever is right for them, but of course I can't force you to do anything. :)

    A correction here....the light isn't additive, as such. The way my mod works is to track the area a player is lighting, and then also to track all blocks lit by this mod. When a player moves, it only recalculates the light of the block if the player would make the block itself brighter. So if you have a level of 15, and a falloff of 3, a block 3 tiles away from two players, both with torches lit, would have a light value of 6, (not 12).
    Have you tested your plugin with multiple users playing? I suspect you'll see some issues doing this. If not I'd be interested to see exactly what you are doing.

    Released version 1.1! (Finally....)

    In this version:
    There is a configuration file. The plugin doesn't ship with one, because I don't like mucking around with file archives and such. Rather, the plugin will create its own directory and configuration file with default values on initialization. Also, I overhauled a lot of the code as far as class/method visibility. Everything appears to be working fine, but there were substantial changes, so please report any bugs in this thread, as always.

    The configuration file looks like this:

    Code:
    BurnDuration=120
    LightIntensity=15
    LightFalloff=3
    RequireSneaking=true
    AllowUnderwater=false
    SetFire=false
    FastServer=false
    
    I'll go over each configuration option individually.

    BurnDuration - This is the number of seconds you should expect a torch to burn. Setting this to 0 (zero) will cause a torch to burn indefinitely. Default is 120 (2 minutes).

    LightIntensity - This is how much light a held torch puts out on the player square. It is worth noting that the default here is 15, which is the maximum intensity (the intensity of sunlight). Regular torches put out a light of 14. This was done intentionally because of how falloff works.

    LightFalloff - This is the decrease in light level for each tile away from the player with a lit torch. Default is 3. So, with a light level of 15 and a falloff of 3, you should expect the light levels radiating out from the player to be 15, 12, 9, 6, 3

    WARNING: Setting this to a low number almost certainly will cause your server to lag.
    Consider that with the default values of 15 intensity and 3 falloff, the number of blocks updated on every player move is:
    radius = 15/3 = 5, diameter = 5*2 = 10, blocks = 10^3 = 1,000 blocks/move
    With the way torches normally work, intensity = 14 and falloff = 1:
    radius = 14/1 = 14, diameter = 14*2 = 28, blocks = 28^3 = 21,952 blocks/move

    I recommend using the default values of 15/3 here, but if you have a supercomputer, feel free to tweak. :) Your mileage may vary.

    RequireSneaking - This is now true by default. When set to true, the player must sneak (hold shift) in order to ignite a torch.

    AllowUnderwater - Set to false by default. When set to true, a lit torch will extinguish when the player submerges in water or lava.

    SetFire - Set to false by default. When set to true, a player or mob struck by a player with a lit torch will be set on fire for 5 seconds. There is no way that I'm aware of to force the animation on the client, so while the mob will burn for 5 seconds, the client won't display any flames, sadly.

    FastServer - Set to false by default. Only use this if your torch radius (intensity/falloff) is very small, or if you have a very, very capable server. The standard algorithm TorchBurn uses for calculating light level is represented as a cube, with light 'falling off' as it radiates away from the source. Setting FastServer=true will change this behavior such that the light falloff is represented as a sphere. This is much more computationally intense, but looks a little nicer.

    The next things I will look at:
    . Allowing a configuration to left-click to light rather than right-click.
    . Making a torch extinguish if the user moves it from the active 'held' inventory slot. That this doesn't happen is a bug.
    . Revisiting putting in permissions support :-\
    . Adding admin commands to change settings while the server is up, rather than being forced to modify the configuration file and reload. This will likely be released as v1.2 before anything else.

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

    FuzzeWuzze

    Yes yes, thats what i meant but hard to type it out :) I was seeing some very wierd effects with 2 players lighting torches on top of each other.

    Basically torches wouldn't go out properly when two people started a torch within eachothers radius.
    Literally all i did was comment out the code if If(previousIntensity!=Null) so it doesnt attempt to take control of the other players light. I could see logically why this would act wierd as player Y isnt necessarily lighting the area around him if Player X already owns it, but in reality with the default radius and falloff you had set its not really noticable...people just notice light..or no light..not degree's of light ;)

    I did start a plugin called Portable Torch, unfortunately i didnt fork off your github because ive never used Github and had no idea you could do that...more of a SVN guy myself ;)
     
  13. Offline

    Olat

    @Ryan Caretta
    I really wish you would look at the abilitiy to place lit torches on the wall. The durability issue aside. It doesnt seem logical that you cant place a lit torch and light a new one. I want to use this plugin as it will greatly increase my cave spelunking immersion and seem very unique but if I wanted to place my torch to mine some Ore or something then pick it back up. I cant with out a huge hassle.

    Armor and everything else has a set durability that lasts through being dropped. I know that you had to add this functionality to torches so its gunna be quite difficult. You stated earlier that its a small benefit. I disagree anything that makes mechanics more intuitive for players is a HUGE benefit, in the eyes of the server admin and player base that will be using it. I shouldnt have to jump three times do 2 spins and left click 5 times to swing a sword. You expect to click and swing. When you right click a lit torch, you expect it to be placed on the wall lit. Just my 2 cents. I will be watching this plugin, and when you add the ability to place lit torches. I will definately donate some to ya and be using it hence forth.
     
  14. Although you are probably aware, but above build #560, this plugin (both current versions) breaks ........
    If there's any chance of a fix for this please ..... many thanks ......

    error :

    >22:29:00 [SEVERE] PLAYER_ITEM loading TorchBurn v1.0 (Is it up to date?)
    java.lang.NoSuchFieldError: PLAYER_ITEM
    at com.gmail.rcarretta.torchburn.TorchBurn.onEnable(TorchBurn.java:41)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:453)
     
  15. Offline

    Ryan Carretta

    On the surface, I agree with you, Olat. The problem right now is that, unlike armor, a placed torch is a block placed in the world. As such, right now when you place it the durability resets entirely, making it possible to constantly reset your torch by placing/breaking it. What I will do is add this as a configuration option in the next release for your purposes. Just be aware that durability will not persist through place/break.

    Yes, sadly. I just posted a v1.2 build. It's very important that you use v1.1 if you are running a recommended CraftBukkit build (which IMO all server admins should be...ahem), and v1.2 if you are using a beta build.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 10, 2016
  16. Normally I would, but one of the later builds, there's mention of a fix for the dissappearing minecarts - which is something I've wanted for a while - its a pain keep having to bump into them to find them again ...... many thanks for the post .......
     
  17. Offline

    Kainzo

    Here's 1.0 with Permission requirement if you want to give this to only VIP on your servers...

    <font color="rgb(51, 153, 102)">Permission Node:</font>
    torchburn.light

    Download Torchburn 1.0 + Permissions (<Edit by Moderator: Redacted mediafire url>

    In now way am I posting this out of disrespect to the original author - credit for the work can go to Squallseed for adding permissions to it)
     
    Last edited by a moderator: Dec 15, 2016
  18. Depending on how bukkit/minecraft renders the lighting, maybe a less intensive lighting mode could be to define the max radius of the lighted area with zero falloff. Depending on how the calculations are done, you would be able to light quite a large area without having to recalculate anything but the squares at the far edges of movement.

    Also how about allowing the placement of torches OTHER than the one your holding. So if you have a stack of 10 torches and your holding one, you place one of the remaining 9 (that would have full durability).
     
  19. Offline

    Ryan Carretta

    Hi KHobbits, thanks for the suggestion. It would be possible to do what you suggest, but the performance gained over the 'standard' TorchBurn lighting mechanism would be negligible. It would still have to go through each affected block and light individually. Additionally the lighting falloff would appear quite drastic - probably enough to be sort of ugly. You can play around with what I mean by setting light to something like 14-15 and falloff to 8-15.

    I don't allow placing torches for a technical reason, not just because I don't like the user. :) Because the mod 'saves' the light in order to relight as you move away, it breaks things considerably if you place torches or remove them with a lit torch. I am considering removing the ability to break torches as well when a lit torch is held, but I don't want to break immersion too much....it's a trade off.

    I could probably figure out a way around both of these but it would require substantial code additions, so won't be soon.
     
  20. If you opted for a coverage area of something like 20 squares with 0 falloff, you would only have to modify 2x20x20 (800) squares per square moved, rather than modifying 8400 squares, which would still be far less than the current system for that coverage? Ugly but would be useful for lighting a large area which would be almost impossible atm, with little performance drop?

    Actually merging both ideas would be quite interesting... for example allowing a 15x15 square of 15 brightness around you, and then a falloff outside of that area.... the area in the inside wouldn't need modifying only the area in the falloff area... You could probably opt for a quick falloff in that case, something like 4-8.
     
  21. Offline

    PlannedBoredom

    02:36:19 [SEVERE] PLAYER_INTERACT loading TorchBurn v1.2 (Is it up to date?)
    java.lang.NoSuchFieldError: PLAYER_INTERACT
    at com.gmail.rcarretta.torchburn.TorchBurn.onEnable(TorchBurn.java:41)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:414)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:187)
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:83)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:61)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:204)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:191)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:131)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:246)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)



    PLZ HELP! Here's my config -
    BurnDuration=0
    LightIntensity=15
    LightFalloff=3
    RequireSneaking=false
    AllowUnderwater=false
    SetFire=false
    FastServer=false


    It just doesn't work for me...
     
  22. Offline

    Ryan Carretta

    You are using a recommended CraftBukkit build with the latest TorchBurn, which isn't supported. CraftBukkit changed some things beyond my control. Either run the 1.1 version of TorchBurn, or upgrade CraftBukkit on your server and this will go away.

    Light has to be updated in 3d space. I'm not sure where that 2 is coming from. Assuming a radius of 20, which is quite large, this is 40 blocks to update in every direction = 40*40*40 = 64000

    Edit: just in case you meant a radius of 10, this is still 20*20*20 = 8000 blocks to update per move.

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

    guvvo

    How about just turn underground light on and off?
    One command that removes ALL darkness.
    Or perhaps allow daylight through to ALL areas underground.
    Incidently there is daylight from under the bedrock, so replacing the bedrock with glass gives light down the bottom during the day.
    I only want to build stuff and don't care about survival, that's why I use world edit and plg no health.
     
  24. Offline

    Ryan Carretta

    This is doable, if not (in my opinion) a little boring. It is, however, completely outside the scope of this plugin.
     
  25. With the 20x20x20 square of light around the player, if the player makes 1 step in one direction with all light levels being uniform the only light that needs to change is that in which the blocks leave this area and the blocks that join the area. Thus for a 20x20 square, moving 1 square forward produces a 20x20x1 crossection infront of the player and a 20x20x1 crossection behind the player which needs updating.
     
  26. Offline

    LucidLethargy

    This flat out wont work on my server, been troubleshooting for 20 minutes : /
    I am on recommended Build 556.

    I just saw that in the thread this was mentioned... please make it more bold in the OP. -.-

    Just tried it at any rate, and freaking awesome work man. I love that the torch is used up as it makes for more of a cost to using this, and that durability meter is absolutely fantastic. This is EXACTLY what I was looking for, and nothing less.
     
  27. Offline

    PlannedBoredom

    When I change to the latest build though it makes all the best plugins: WorldEdit, Stackable, Spyer, Tombstone...etc.
    You should really attempt to make it available on the recommended version.
     
  28. Offline

    emoknight

    Code:
    2011-03-26 21:18:53 [SEVERE] PLAYER_INTERACT loading TorchBurn v1.2 (Is it up to date?)
    java.lang.NoSuchFieldError: PLAYER_INTERACT
        at com.gmail.rcarretta.torchburn.TorchBurn.onEnable(TorchBurn.java:41)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:451)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:217)
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:92)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:70)
        at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:204)
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:191)
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:131)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:246)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:366)
    when u goin up 2 date to make it work for CB 556?
     
  29. Offline

    NinjaGrinch

    Version 1.1 is for build 556, version 1.2 is for 565+. :)
     
  30. Offline

    Ryan Carretta

    Please read the OP, or the post before this one, or the post several back where I announced the new version.

    v1.1 and v1.2 are exactly the same, functionally. The only difference is that for 556 you will need v1.1, and for more recent CB versions you will need v1.2. When v1.3 is released I'll only have one download link again. Don't blame me for this; I'm as frustrated as you are. It's a sudden change in the Bukkit/CraftBukkit API.

    Good idea. Did that.

    Thank you for your glowing review of my plugin. :) I am glad it is working for you.

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

Share This Page