(Feature) Torch Burnout for 1.18.2
FoxyFox909 opened this issue · 5 comments
Hi, is there any chance you would be willing to re-implement Megatorch burnout with a custom fuel item and fuel duration?
I ask since I am making a 1.18.2 modpack where automation is a big and powerful part of it, and I want to have Megatorches in but have the torches not protect areas for free. Thanks!
It's actually not that trivial to implement this feature - especially considering that I don't want to add any more features to 1.18.
I could implement something quick and dirty, but I won't port it to newer versions as I intent to rewrite the mod quite considerably.
Some of the constraints are:
- No GUI
- No Datapack Support
- Only Mega Torch - dreadlamp will be excluded
- Fuel Item configuration via Mod Config (Server Side)
- Fuel will only be used up while the Torch is chunk loaded (Torches work even while not chunkloaded, which would technically allow someone to place a torch outside of chunkloading range and have it work for free, not much I can do about this without a major rewrite)
The reason why I limit this so much is, there are quite a big amount of changes between 1.18 and 1.20 and learning something for an outdated MC Version just to relearn it later on is not fun.
I do have a few Ideas in mind to hint at the current fuel level of the torch:
- Additional Particles and maybe sounds when running low on fuel
- Potential support for comparators which would allow people to implement their own warning system using redstone
If this is fine with you, I can look into implementing something, but it will take a few days.
It's actually not that trivial to implement this feature
Haha no kidding... I actually attempted implementing this using a KubeJS server_script
. I thought I was all smart, creating a server.persistentData
array of JSON objects serving as a map to store "active" Mega Torches, adding a new object whenever a new arbitrary block I was gonna create: "Unlit Mega Torch" or whatever, was right-clicked with another arbitrary item, and if a player got their hands on a Mega Torch in their inventory somehow, it'd be instantly turned into an Unlit One to prevent freeloading. I made it so each object stored a fuelAmount
which was decremented every 300 or so ticks for each torchObject in the array. When a particular torch hits fuelAmount <= 0
then it just gets set to the "Unlit Mega Torch" block and cleaned up from the array of torchObjects. This was working fine and dandy, and was even letting me tick torchFuel
for unloaded torches since it was separate from the block entity, and I could also do different fuel costs for different dimeinosn but then... you've probably already seen the potential issue here. The array only stores the XYZ, dimension
, and fuelAmount
of the torch as a reference to it.
Therefore, all a player has to do is relocate an existing mega torch with any of the ways that allow block movement (which are many in my modpack) and then they'll get a free torch for life. And I'm not really sure what I could do about that one.
Sorry for the long-winded thing just wanted to share my experience with making a janky as hell script heh
As far as the constraints your are listing for your own implementation:
- It'd be nice to have some Jade support showing the % of fuel left in a torch, but I do understand that means more work for you, including having to reference the 1.18 Jade documentation. Although I do believe I could probably just implement this part myself via a Jade datapack, IF the amount of fuel in a torch is stored as an NBT tag in the block. But if all else fails, some particles when / sound when it's run out and a comparator signal would work just fine.
- No Datapack support needed here
- I am only concerned about the Mega Torch too, so this is just fine
- Will just the fuel item be configurable, or also the fuel duration?
- That is fine with me
I know this is a lot of work, so I don't want to sound like I'm demanding or begging! Just listing what would be ideal. My modpack is still in development and will be for a while so there is no rush whatsoever for this, as well. Thanks!
I don't think I will add any mod dependencies for 1.18, so Jade support wont be a thing - atleast not explicitly.
- % Fuel will be shown when rightclicking the Torch with an empty hand as either a chat message or a message above the hotbar, not sure yet.
- Fuel will be saved as NBT in the Item itself and the BlockEntity. This should even allow you to create recipes with a preloaded amount of fuel. This should also allow you to create "refill crafting recipes" so players could automate the refueling - if you want that.
- Fuel will also be displayed as a Durability Bar, as well as the tooltip
- Fuel Items will be configured using the following syntax:
modid:itemname@fuelamount
, i.e.minecraft:diamond@72000
. Fuel will be used at a rate of 1 unit per tick, so 72000 equals 1h (20 ticks * 3600 seconds). The upper limit will beInteger.MAX_VALUE
(2.14 billion, roughly 1230 realtime days). The limit is configurable in the config. There is no limit on fuel items that you can define.
Oh, that's more than I asked for even! Many thanks, and I'm looking forward to it. Again, please do take your time. My modpack will still be in development for probably months to come.