Drathonix / LoadMyChunks

A server friendly chunk loading mod
MIT License
4 stars 0 forks source link

IDEA: Compatibility with CC:Tweaked (ComputerCraft) #3

Closed vico93 closed 1 day ago

vico93 commented 1 week ago

Hello!

I use CC:Tweaked (Modrinth) (fork of ComputerCraft for modern MC versions) in my modpack, but unfortunately by design computers and turtles (robots) cannot keep the chunks they are in or the ones that they are heading to, what greatly dimishes the automation potential for them.

Could you make an integration with CC:T's API to allow turtles to equip the mod's Chunk Loader block and interact with them? While the way to allow a certain item/block to be able to be equipped by a turtle is via data-driven .json files (example for regular tools), to add special funcionality (in this case, chunk loading), code is needed to make it work.

Drathonix commented 1 week ago

I like this idea. Anyways, scuffed way to do this currently would be to use turtles to place and break chunk loaders as they move, probably too complicated to be worth it though.

It'd be useful for me to know what MC version you're currently playing on. I'll try pushing an update to all available versions with CC:T as well as any future versions but I'll prioritize yours for the purposes of faster delivery.

vico93 commented 1 week ago

I like this idea. Anyways, scuffed way to do this currently would be to use turtles to place and break chunk loaders as they move, probably too complicated to be worth it though.

It'd be useful for me to know what MC version you're currently playing on. I'll try pushing an update to all available versions with CC:T as well as any future versions but I'll prioritize yours for the purposes of faster delivery.

Currently i'm on 1.21, just waiting for @SquidDev to finish his update to CC:T

Drathonix commented 1 week ago

Currently i'm on 1.21, just waiting for @SquidDev to finish his update to CC:T

I'll dev it for 1.20.4 for the time being (given that's when CC:T switched to neo)

I'll make sure to watch CC:T for updates.

Drathonix commented 1 week ago

Putting this here so that I don't miss a feature.

Feature Description Done
Add Lagometer block and expose to comparators and peripheral Figure we might as well have a non-chunk loader way to measure chunk lag and use it for world interaction. Maybe you'd want to have some sort of screen showing a lag meter.
Add "getChunkLastTickDuration()" function Returns chunk's last time in MS tick time.
Add "getChunkTickDurationLimit()" function Returns the server side chunk tick time limit.
Add "getChunkLastTickRatio()" function Returns getChunkLastTickDuration()/getChunkTickDurationLimit() range of [0-1].
Add "getChunkCooldownTime() function Returns the time left in a chunk's cooldown.
Add "isChunkOnCooldown() function Returns if the chunk is in cooldown.
Add "isChunkForced() function Returns if the chunk is force loaded.
Expose Chunk Loader blocks as a peripheral Expose Chunk Loader blocks as a peripheral
Chunk Loader peripheral extends lagometer Allows using lagometer functions in the chunkloader
Add "setActive(boolean)" function Sets whether or not the chunk loader will try to load the chunk
Add "activate()" function Macro for setActive(true)
Add "deactivate()" function Macro for setActive(false)
Add "isActive()" function Returns if the chunk loader is trying to load the chunk
Add "toggleActive()" function Macro for setActive(!isActive())
Add "getOwnerName()" function Returns the chunkloader owner's name, can be nil.
Add "getOwnerUUID()" function Returns the chunkloader owner's UUID, can be nil.
Allow Chunkloaders to be attachable to turtles Will load the chunk it is currently in and the destination if applicable
Add Config value for disabling the lagometer peripheral features Should support banning the lagometer methods in turtles only and/or in computers (I.E. using create to make a base hunting machine)
vico93 commented 5 days ago

@Drathonix just to let you know that a release for 1.21 just got dropped!

Drathonix commented 5 days ago

@Drathonix just to let you know that a release for 1.21 just got dropped!

Thanks for informing, I'll make sure to include CCT support in 1.0.4 then.

Drathonix commented 5 days ago

@Drathonix just to let you know that a release for 1.21 just got dropped!

Thanks for informing, I'll make sure to include CCT support in 1.0.4 then.

Drathonix commented 4 days ago

@vico93

I have released a beta version for MC 1.21 on CF and MR for both Neoforge and Fabric. with all the requirements I listed earlier, I'd appreciate if you tried it out!

Issue will be closed once functionality is fully backported to all currently supported MC vers.

vico93 commented 3 days ago

@vico93

I have released a beta version for MC 1.21 on CF and MR for both Neoforge and Fabric. with all the requirements I listed earlier, I'd appreciate if you tried it out!

Issue will be closed once functionality is fully backported to all currently supported MC vers.

will test asap!

vico93 commented 3 days ago

Er.. tried to drop the latest release on modrinth to my modpack, when i tried to load an existing world, this happened crash-2024-06-25_08.53.49-server.txt

Drathonix commented 3 days ago

Er.. tried to drop the latest release on modrinth to my modpack, when i tried to load an existing world, this happened crash-2024-06-25_08.53.49-server.txt

Literally never seen this error before, as far as I can tell its an issue with the library itself.

I might be able to diagnose the problem if you send me a file from your world directory. Send me the file "loadmychunks_manager.dat" in saves//data. You may also want to try deleting this file and starting the world, just chunk loaders will lose ownership, but that has no impact on gameplay right now and you can fix them by breaking and replacing.

vico93 commented 3 days ago

er... this file doesn't exist in the data directory of the world i tried to load the mod with image

Drathonix commented 3 days ago

er... this file doesn't exist in the data directory of the world i tried to load the mod with image

Have you never placed any chunk loaders in that world then?

Drathonix commented 3 days ago

Possibly related to https://github.com/vigna/fastutil/issues/42, likely caused by chunks being loaded on a different thread.

Will solve with a solution similar to: https://github.com/ValkyrienSkies/Valkyrien-Skies-2/commit/9160005d31de4749fa9a4d72d090b55ed605d2c9

@vico93

What other mods do you have installed? (EDIT: nvm they're in the crash report)

Drathonix commented 3 days ago

@vico93 Cause is likely a conflict with: https://www.curseforge.com/minecraft/mc-mods/c2me-fabric

I will need to find a fix for this but for now your only option is to either disable my mod or disable CCME.

Drathonix commented 3 days ago

@vico93 I haven't been able to replicate the problem on my system, but I am confident that the I have mod I have provided in the zip here will fix your crashing problem. Make sure c2me is enabled.

loadmychunks-1.0.5-alpha2+1.21+fabric.zip

vico93 commented 3 days ago

@vico93 Cause is likely a conflict with: https://www.curseforge.com/minecraft/mc-mods/c2me-fabric

I will need to find a fix for this but for now your only option is to either disable my mod or disable CCME.

Hm i see. Maybe @ishland (c2me author) could give some insight about this.

vico93 commented 3 days ago

@vico93 I haven't been able to replicate the problem on my system, but I am confident that the I have mod I have provided in the zip here will fix your crashing problem. Make sure c2me is enabled.

loadmychunks-1.0.5-alpha2+1.21+fabric.zip

sorry, didnt saw this comment. Do you want my profile folder for better testing? Can zip it and send to you

Drathonix commented 3 days ago

@vico93 I haven't been able to replicate the problem on my system, but I am confident that the I have mod I have provided in the zip here will fix your crashing problem. Make sure c2me is enabled. loadmychunks-1.0.5-alpha2+1.21+fabric.zip

sorry, didnt saw this comment. Do you want my profile folder for better testing? Can zip it and send to you

I replicated your modpack nearly exactly, the only difference between us is CPU and JVM brand, which are both things I can't control. See if the file I provided there solves the problem with C2ME and report back.

vico93 commented 3 days ago

Didnt crash this time. I still need to test the mod's features. Thanks!

vico93 commented 3 days ago

Just noticed that, after installing LoadMyChunks, the movement of my turtle become accelerated and choppy.

Without the mod it was more fluid and slower.

https://github.com/Drathonix/LoadMyChunks/assets/3485505/c9539382-6df3-47d4-abd7-286ca3daace8

vico93 commented 3 days ago

Without the mod, for reference

https://github.com/Drathonix/LoadMyChunks/assets/3485505/26ac1c8e-5105-4c34-a9ab-2d02711eb4ac

Drathonix commented 3 days ago

Just noticed that, after installing LoadMyChunks, the movement of my turtle become accelerated and choppy.

Without the mod it was more fluid and slower.

Minecraft_.1.21.-.Um.jogador.2024-06-25.18-11-54-lite.mp4

Can you send me your script? There's definitely an issue here

vico93 commented 3 days ago

Here:

term.write("how Long should the tunnel be?")
local lol = read()
while turtle.getFuelLevel() < lol*7 do
 local q = turtle.getFuelLevel()
  if turtle.getFuelLevel() < lol*7 then
   term.write("Fuel Level is at "..q.." But needs to be "..lol*7)
   term.write("Please put Fuel in 1st slot")
   os.sleep(5)
   turtle.refuel()
  end
end
   term.write("Mining a "..lol.." block long tunnel")

   for a = 1,lol do
      turtle.dig()
      turtle.forward()
      turtle.digUp()
      turtle.digDown()
      turtle.turnRight()
      turtle.dig()
      turtle.forward()
      turtle.digUp()
      turtle.digDown()
      turtle.back()
      turtle.turnLeft()
      turtle.turnLeft()
      turtle.dig()
      turtle.forward()
      turtle.digUp()
      turtle.digDown()
      turtle.back()
      turtle.turnRight()
     end
    for b = 1,lol do
     turtle.back()
    end
   for c = 1,16 do
    turtle.select(c)
    turtle.dropDown(64)
   end
 turtle.select(1)
Drathonix commented 3 days ago

@vico93 I may have fixed the issue. In my game they seem to be running normally now. See if this file makes the turtles work normally on your system. If it does I'll publish to CF and MR with the fixes in place. Thanks for your cooperation!

loadmychunks-1.0.5-alpha2+1.21+fabric.zip

Drathonix commented 3 days ago

@vico93 sorry to bother you like this, but I have another file I can't test on my own system that attempts to fix the C^2ME issue better. I'd appreciate if you could test this one out. Thank you. loadmychunks-1.0.5-alpha3+1.21+fabric.zip

vico93 commented 2 days ago

will test and get back to you

vico93 commented 2 days ago

I still didnt tested the turtles, but i already noticed that regular furnaces are burning items very fast compared to without the mod.

Drathonix commented 2 days ago

I still didnt tested the turtles, but i already noticed that regular furnaces are burning items very fast compared to without the mod.

You are right. Block Entities are actually ticking 2 times faster in your pack (which is also why the turtles were moving at 2x speed).

Its not a problem with LMC at base though, so its another mod conflict that I have to find. Good news is that C^2ME didn't crash you though so that's all good. I'll open a separate issue for the block entity 2x speed problem.

Drathonix commented 2 days ago

Cause is not a mod conflict, but a mixin issue. The bug will mostly just affect recently placed block entities. I'll get a patch out by the end of the day.

Drathonix commented 2 days ago

Published an Alpha file on MR and CF that should be stable now. Will close multiple relevant issues once 1.0.5 release is published.

vico93 commented 1 day ago

@Drathonix with the same code i send above, i got an error when i made a turtle finished placing the items on the chest:

crash-2024-06-27_11.07.58-server.txt

Drathonix commented 1 day ago

@Drathonix with the same code i send above, i got an error when i made a turtle finished placing the items on the chest:

crash-2024-06-27_11.07.58-server.txt

Likely just another incompatibility with C^2ME, its a very easy patch though so not worth reporting on my side. I'll get the release out today.

Drathonix commented 1 day ago

Released in 1.0.5