Mod code fixes and tweaks

Greedseed

New Member
Jul 29, 2019
1,107
0
0
In this post i will add any fix for mods in the pack that i can find to make your server just that bit more secure.

Tip of the day!
If you like looking into configs and messing with Settings, try NotePad++. It will give you a lot cleaner overview and a way better way to edit your flatfiles! Download
If you are on a max you can use Sublime Text.

"MineCraftServer" is your minecraft server root folder.

ComputerCraft Redstone crash and Startup workaround.
This will fix the problem of a CC computer having no limit on minimum timing when switching Redpower.
Also the workaround on a protected Computer fix will be added here.

Open startup in the folder ./MineCraftServer/Minecraft/mods/ComputerCraft/lua/rom/startup
Open it with NotePadd++ and at the bottom add these lines:

Code:
# For the No time limit on Redstone Switch. Add this line to the bottom.
oldRedstoneFunction = rs.setOutput
rs.setOutput = function(side, bool)
    sleep(0.05)
    oldRedstoneFunction(side, bool)
end

change both "oldRedstoneFunction" words to a secret word so one one finds your program and cant go around It.

Code:
# For the start up workaround. Add this to the top of your config (Line 2)
os.reboot = nil

Code:
# Your config will now look like this.
os.reboot = nil
local sPath = ".:/rom/programs"
if turtle then
    sPath = sPath..":/rom/programs/turtle"
else
    sPath = sPath..":/rom/programs/computer"
end
if http then
    sPath = sPath..":/rom/programs/http"
end
 
shell.setPath( sPath )
help.setPath( "/rom/help" )
 
shell.setAlias( "ls", "list" )
shell.setAlias( "dir", "list" )
shell.setAlias( "cp", "copy" )
shell.setAlias( "mv", "move" )
shell.setAlias( "rm", "delete" )
 
if fs.exists( "/rom/autorun" ) and fs.isDir( "/rom/autorun" ) then
    local tFiles = fs.list( "/rom/autorun" )
    table.sort( tFiles )
    for n, sFile in ipairs( tFiles ) do
        if string.sub( sFile, 1, 1 ) ~= "." then
            local sPath = "/rom/autorun/"..sFile
            if not fs.isDir( sPath ) then
                shell.run( sPath )
            end
        end
    end
end
oldRedstoneFunction = rs.setOutput
rs.setOutput = function(side, bool)
    sleep(0.05)
    oldRedstoneFunction(side, bool)
end


IdustrialCraft 2 Information panel Refresh limit.
This will change the refresh time on the Industrial panels. Less data refresh less lag. Simple.

Open IC2NuclearControl.cfg in the folder ./MineCraftServer/Minecraft/config/IC2NuclearControl.cfg
Find the line "infoPanelRefreshPeriod"

Code:
# Lets change this into a other number. It is set in Ticks
# 20 Ticks = 1 Second
# Lets limit the refresh time to 1.5 Seconds
 
infoPanelRefreshPeriod=30

Disabling certain mods from chunk loading. Thanks to CoderJ!

Forge gives an example for mod specific settings; it's located in forgeChunkLoading.cfg
If you want to disable Buildcraft quarries from chunk loading, you would add this above the defaults area of the config...

Code:
BuildCraft|Factory {
    # Maximum chunks per ticket for the mod.
    I:maximumChunksPerTicket=0
 
    # Maximum ticket count for the mod. Zero disables chunkloading capabilities.
    I:maximumTicketCount=0
}

In order to turn off or modify other mods, use the mod ID which can be found either using /chunkloaders (it'll show up in the tooltip for the force loaded chunks) or by checking the mcmod.info file inside the mod archive.



Il add more if more Code fixes come in
 

adib

New Member
Jul 29, 2019
441
0
0
@TOTD
sometimes not using a more advanced program for text editing it can break the config.
 

Greedseed

New Member
Jul 29, 2019
1,107
0
0
Notepad++ will not brake it! you can also edit non extension texts with it. Its specialy made for coding so it works great dont wurry
 

adib

New Member
Jul 29, 2019
441
0
0
Notepad++ will not brake it! you can also edit non extension texts with it. Its specialy made for coding so it works great dont wurry
i meant simple editors will break it, notepad++ falls under the more advanced ones.
 

krizmac

New Member
Jul 29, 2019
42
0
0
Question: I don't seem to see a Redpower.cfg, was this written before the 1.4.2 update? I know Redpower2 isn't in this launcher yet, is why I'm asking.
 

krizmac

New Member
Jul 29, 2019
42
0
0
For real, I was building some stuff last night and would've absolutely murdered someone for some Stone Covers to hide wires....

Let's all picket outside Elo's house until she starts coding again :p
 

krizmac

New Member
Jul 29, 2019
42
0
0
What's this mean for FTB packs though? If it goes to 1.4.5, I hope she releases some "old" versions for 1.4.2 so we can mess around with it if FTB doesn't go to 1.4.5 immediately.

All in all though, this is awesome news. Thanks for finding that Ashz!
 

Busuwe

New Member
Jul 29, 2019
6
0
0
Nice tips :)
But don't you need to make "oldRedstoneFunction" local?
Otherwise it would be accessible by anyone that knows that it's there. (Or know how to list the contents of _G)
 

Greedseed

New Member
Jul 29, 2019
1,107
0
0
Nice tips :)
But don't you need to make "oldRedstoneFunction" local?
Otherwise it would be accessible by anyone that knows that it's there. (Or know how to list the contents of _G)

True. Thats why i stated "change both "oldRedstoneFunction" words to a secret word so one one finds your program and cant go around It."
 

Busuwe

New Member
Jul 29, 2019
6
0
0
Well, anyone can read the file /rom/startup and thus find out the "secret name" of the redstone function.

If you instead make the oldRedstoneFunction local to the "/rom/startup" chunk/file/function then they won't be able to use it even if they know the name as it was declared local in an inaccessible closure.
Code:
do
    local oldRedstoneFunction = rs.setOutput
    rs.setOutput = function(side, bool)
        sleep(0.05)
        oldRedstoneFunction(side, bool)
    end
end
(The do/end is just for clarity, it works just as well without them)
 

Fizzgigg

New Member
Jul 29, 2019
28
0
0
If you are on a mac I recommend Sublime Text or Text Wrangler (both are for HTML but work fine with java and configs) If you want a really advanced text editor for mac get Xcode, it does about everything. Everything listed is free.
 
  • Like
Reactions: Greedseed