diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/adapter.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/adapter.json new file mode 100644 index 000000000..039cc6321 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/adapter.json @@ -0,0 +1,12 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/inventory.json", + "traits/powerAcceptor.json" + ], + "nbt": { + "blacklist": [ + "oc:adapter.blocks" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/assembler.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/assembler.json new file mode 100644 index 000000000..9db233b83 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/assembler.json @@ -0,0 +1,12 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/inventory.json", + "traits/powerAcceptor.json" + ], + "nbt": { + "blacklist": [ + "oc:remaining" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/cable.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/cable.json new file mode 100644 index 000000000..2a5da92da --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/cable.json @@ -0,0 +1,3 @@ +[{ + "includes": ["traits/environment.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/capacitor.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/capacitor.json new file mode 100644 index 000000000..2a5da92da --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/capacitor.json @@ -0,0 +1,3 @@ +[{ + "includes": ["traits/environment.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/case.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case.json new file mode 100644 index 000000000..d0a7fe6c5 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case.json @@ -0,0 +1,9 @@ +[{ + "includes": [ + "traits/computer.json", + "traits/inventory.json", + "traits/powerAcceptor.json", + "traits/redstone.json", + "traits/rotatable.json" + ] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/case1.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case1.json new file mode 100644 index 000000000..5236537c8 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case1.json @@ -0,0 +1,3 @@ +[{ + "includes": ["case.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/case2.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case2.json new file mode 100644 index 000000000..5236537c8 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case2.json @@ -0,0 +1,3 @@ +[{ + "includes": ["case.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/case3.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case3.json new file mode 100644 index 000000000..5236537c8 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/case3.json @@ -0,0 +1,3 @@ +[{ + "includes": ["case.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/caseCreative.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/caseCreative.json new file mode 100644 index 000000000..5236537c8 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/caseCreative.json @@ -0,0 +1,3 @@ +[{ + "includes": ["case.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/charger.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/charger.json new file mode 100644 index 000000000..5c05e7269 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/charger.json @@ -0,0 +1,16 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/inventory.json", + "traits/powerAcceptor.json", + "traits/redstone.json", + "traits/rotatable.json" + ], + "nbt": { + "blacklist": [ + "chargeSpeed", + "hasPower", + "invertSignal" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/disassembler.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/disassembler.json new file mode 100644 index 000000000..9ab51a0fc --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/disassembler.json @@ -0,0 +1,14 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/inventory.json", + "traits/powerAcceptor.json" + ], + "nbt": { + "blacklist": [ + "oc:buffer", + "oc:queue", + "oc:total" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/diskDrive.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/diskDrive.json new file mode 100644 index 000000000..7a52c2ef3 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/diskDrive.json @@ -0,0 +1,7 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/inventory.json", + "traits/rotatable.json" + ] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/geolyzer.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/geolyzer.json new file mode 100644 index 000000000..2a5da92da --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/geolyzer.json @@ -0,0 +1,3 @@ +[{ + "includes": ["traits/environment.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram.json new file mode 100644 index 000000000..5e40db6c3 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram.json @@ -0,0 +1,7 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/externalData.json", + "traits/rotatable.json" + ] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram1.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram1.json new file mode 100644 index 000000000..e7bedbd90 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram1.json @@ -0,0 +1,3 @@ +[{ + "includes": ["hologram.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram2.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram2.json new file mode 100644 index 000000000..e7bedbd90 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/hologram2.json @@ -0,0 +1,3 @@ +[{ + "includes": ["hologram.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/keyboard.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/keyboard.json new file mode 100644 index 000000000..a1a9760b2 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/keyboard.json @@ -0,0 +1,8 @@ +[{ + "includes": ["traits/rotatable.json"], + "nbt": { + "blacklist": [ + "oc:keyboard" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/microcontroller.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/microcontroller.json new file mode 100644 index 000000000..de8fbc384 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/microcontroller.json @@ -0,0 +1,18 @@ +[{ + "includes": [ + "traits/computer.json", + "traits/hub.json", + "traits/inventory.json", + "traits/powerAcceptor.json", + "traits/redstone.json", + "traits/rotatable.json" + ], + "nbt": { + "blacklist": [ + "oc:info", + "oc:snooper", + "oc:componentNodes", + "oc:outputs" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/motionSensor.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/motionSensor.json new file mode 100644 index 000000000..2a5da92da --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/motionSensor.json @@ -0,0 +1,3 @@ +[{ + "includes": ["traits/environment.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/netSplitter.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/netSplitter.json new file mode 100644 index 000000000..5c133025f --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/netSplitter.json @@ -0,0 +1,6 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/redstone.json" + ] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/powerConverter.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/powerConverter.json new file mode 100644 index 000000000..4b10cadc2 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/powerConverter.json @@ -0,0 +1,6 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/powerAcceptor.json" + ] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/powerDistributor.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/powerDistributor.json new file mode 100644 index 000000000..0ce5d96fc --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/powerDistributor.json @@ -0,0 +1,7 @@ +[{ + "nbt": { + "blacklist": [ + "oc:connector" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/printer.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/printer.json new file mode 100644 index 000000000..7c1dca481 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/printer.json @@ -0,0 +1,16 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/inventory.json" + ], + "nbt": { + "blacklist": [ + "oc:active", + "oc:amountInk", + "oc:amountMaterial", + "oc:limit", + "oc:remaining", + "oc:total" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/raid.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/raid.json new file mode 100644 index 000000000..7a52c2ef3 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/raid.json @@ -0,0 +1,7 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/inventory.json", + "traits/rotatable.json" + ] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/redstone.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/redstone.json new file mode 100644 index 000000000..f2be27863 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/redstone.json @@ -0,0 +1,8 @@ +[{ + "includes": ["traits/redstone.json"], + "nbt": { + "blacklist": [ + "oc:redstone/node" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/relay.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/relay.json new file mode 100644 index 000000000..885350961 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/relay.json @@ -0,0 +1,12 @@ +[{ + "includes": [ + "traits/hub.json", + "traits/inventory.json", + "traits/powerAcceptor.json" + ], + "nbt": { + "blacklist": [ + "oc:componentNodes" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/robot.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/robot.json new file mode 100644 index 000000000..53641eb9c --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/robot.json @@ -0,0 +1,24 @@ +[{ + "includes": [ + "traits/computer.json", + "traits/environment.json", + "traits/inventory.json", + "traits/redstone.json", + "traits/rotatable.json" + ], + "nbt": { + "blacklist": [ + "display", + "oc:components", + "oc:containers", + "oc:lightColor", + "oc:owner", + "oc:ownerUuid", + "oc:robot", + "oc:robotEnergy", + "oc:selectedSlot", + "oc:selectedTank", + "oc:storedEnergy" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen.json new file mode 100644 index 000000000..369d34273 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen.json @@ -0,0 +1,14 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/externalData.json", + "traits/redstone.json", + "traits/rotatable.json" + ], + "nbt": { + "blacklist": [ + "oc:hasPower", + "oc:hadRedstoneInput" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen1.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen1.json new file mode 100644 index 000000000..dadd2bf74 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen1.json @@ -0,0 +1,3 @@ +[{ + "includes": ["screen.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen2.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen2.json new file mode 100644 index 000000000..dadd2bf74 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen2.json @@ -0,0 +1,3 @@ +[{ + "includes": ["screen.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen3.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen3.json new file mode 100644 index 000000000..dadd2bf74 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/screen3.json @@ -0,0 +1,3 @@ +[{ + "includes": ["screen.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/serverRack.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/serverRack.json new file mode 100644 index 000000000..06dc5c669 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/serverRack.json @@ -0,0 +1,15 @@ +[{ + "includes": [ + "traits/hub.json", + "traits/inventory.json", + "traits/powerAcceptor.json", + "traits/redstone.json", + "traits/rotatable.json" + ], + "nbt": { + "blacklist": [ + "oc:servers", + "oc:terminals" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/computer.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/computer.json new file mode 100644 index 000000000..d90950be1 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/computer.json @@ -0,0 +1,7 @@ +[{ + "nbt": { + "blacklist": [ + "oc:computer" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/environment.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/environment.json new file mode 100644 index 000000000..b91cf6986 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/environment.json @@ -0,0 +1,8 @@ +[{ + "nbt": { + "blacklist": [ + "node", + "oc:node" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/externalData.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/externalData.json new file mode 100644 index 000000000..c579dec59 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/externalData.json @@ -0,0 +1,9 @@ +[{ + "nbt": { + "blacklist": [ + "chunkX", + "chunkZ", + "dimension" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/hub.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/hub.json new file mode 100644 index 000000000..6994b8091 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/hub.json @@ -0,0 +1,8 @@ +[{ + "nbt": { + "blacklist": [ + "oc:plugs", + "oc:queue" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/inventory.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/inventory.json new file mode 100644 index 000000000..f16d956de --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/inventory.json @@ -0,0 +1,8 @@ +[{ + "ignoreInventoryContents": true, + "nbt": { + "blacklist": [ + "oc:items" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/powerAcceptor.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/powerAcceptor.json new file mode 100644 index 000000000..7500c660b --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/powerAcceptor.json @@ -0,0 +1,9 @@ +[{ + "nbt": { + "blacklist": [ + "oc:ae2power", + "oc:ic2power", + "oc:ic2cpower" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/redstone.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/redstone.json new file mode 100644 index 000000000..6b2818069 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/redstone.json @@ -0,0 +1,11 @@ +[{ + "nbt": { + "blacklist": [ + "oc:rs.input", + "oc:rs.output", + "oc:rs.bundledInput", + "oc:rs.bundledOutput", + "oc:rs.rednetInput" + ] + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/rotatable.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/rotatable.json new file mode 100644 index 000000000..2168077cf --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/traits/rotatable.json @@ -0,0 +1,7 @@ +[{ + "rotation": { + "type": "nbtField", + "tag": "oc:yaw", + "format": "ForgeDirection" + } +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/transposer.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/transposer.json new file mode 100644 index 000000000..2a5da92da --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/transposer.json @@ -0,0 +1,3 @@ +[{ + "includes": ["traits/environment.json"] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/bcbuilder/blocks/waypoint.json b/src/main/resources/assets/opencomputers/bcbuilder/blocks/waypoint.json new file mode 100644 index 000000000..556f25dc7 --- /dev/null +++ b/src/main/resources/assets/opencomputers/bcbuilder/blocks/waypoint.json @@ -0,0 +1,7 @@ +[{ + "includes": [ + "traits/environment.json", + "traits/redstone.json", + "traits/rotatable.json" + ] +}] \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/bin/du.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/bin/du.lua new file mode 100644 index 000000000..9e8017307 --- /dev/null +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/bin/du.lua @@ -0,0 +1,133 @@ +local shell = require("shell") +local fs = require("filesystem") + +local args, options, reason = shell.parse(...) +if #args == 0 then + args[1] = '.' +end + +local TRY=[[ +Try 'du --help' for more information.]] + +local VERSION=[[ +du (OpenOS bin) 1.0 +Written by payonel, patterned after GNU coreutils du]] + +local HELP=[[ +Usage: du [OPTION]... [FILE]... +Summarize disk usage of each FILE, recursively for directories. + + -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) + -s, --summarize display only a total for each argument + --help display this help and exit + --version output version information and exit]] + +local function writeline(value, pipe) + pipe = pipe or io.stdout + pipe:write(value) + pipe:write('\n') +end + +if options.help then + writeline(HELP) + return true +end + +if options.version then + writeline(VERSION) + return true +end + +local function addTrailingSlash(path) + if path:sub(-1) ~= '/' then + return path .. '/' + else + return path + end +end + +local function opCheck(shortName, longName) + local enabled = options[shortName] or options[longName] + options[shortName] = nil + options[longName] = nil + return enabled +end + +local bHuman = opCheck('h', 'human-readable') +local bSummary = opCheck('s', 'summarize') + +if (next(options)) then + for op,v in pairs(options) do + io.stderr:write(string.format("du: invalid option -- '%s'\n", op)) + end + writeline(TRY, io.stderr) + return false +end + +local function formatSize(size) + if not bHuman then + return tostring(size) + end + local sizes = {"", "K", "M", "G"} + local unit = 1 + local power = options.si and 1000 or 1024 + while size > power and unit < #sizes do + unit = unit + 1 + size = size / power + end + + return math.floor(size * 10) / 10 .. sizes[unit] +end + +local function printSize(size, rpath) + local displaySize = formatSize(size) + writeline(string.format("%s%s", string.format("%-12s", displaySize), rpath)) +end + +local function visitor(rpath) + local subtotal = 0 + local dirs = 0 + local spath = shell.resolve(rpath) + + if (fs.isDirectory(spath)) then + local list_result = fs.list(spath) + for list_item in list_result do + local vtotal, vdirs = visitor(addTrailingSlash(rpath) .. list_item) + subtotal = subtotal + vtotal + dirs = dirs + vdirs + end + + if (dirs == 0) then -- no child dirs + if (not bSummary) then + printSize(subtotal, rpath) + end + end + + elseif (not fs.isLink(spath)) then + subtotal = fs.size(spath) + end + + return subtotal, dirs +end + +for i,arg in ipairs(args) do + local path = shell.resolve(arg) + + if (not fs.exists(path)) then + writeline(string.format("%s does not exist", arg), io.stderr) + else + if (fs.isDirectory(path)) then + local total = visitor(arg) + + if (bSummary) then + printSize(total, arg) + end + elseif (fs.isLink(path)) then + printSize(0, arg) + else + printSize(fs.size(path), arg) + end + end +end + +return true diff --git a/src/main/scala/li/cil/oc/client/Sound.scala b/src/main/scala/li/cil/oc/client/Sound.scala index f6b22e9ed..8308582c0 100644 --- a/src/main/scala/li/cil/oc/client/Sound.scala +++ b/src/main/scala/li/cil/oc/client/Sound.scala @@ -53,7 +53,7 @@ object Sound { // Set in init event. var manager: SoundManager = _ - def soundSystem = manager.sndSystem + def soundSystem = if (manager != null) manager.sndSystem else null private def updateVolume() { val volume = diff --git a/src/main/scala/li/cil/oc/common/launch/CoreModContainer.scala b/src/main/scala/li/cil/oc/common/launch/CoreModContainer.scala new file mode 100644 index 000000000..408dcd3c3 --- /dev/null +++ b/src/main/scala/li/cil/oc/common/launch/CoreModContainer.scala @@ -0,0 +1,19 @@ +package li.cil.oc.common.launch + +import com.google.common.eventbus.EventBus +import net.minecraftforge.fml.common.DummyModContainer +import net.minecraftforge.fml.common.LoadController +import net.minecraftforge.fml.common.ModMetadata + +class CoreModContainer extends DummyModContainer({ + val md = new ModMetadata() + md.authorList.add("Sangar") + md.modId = "OpenComputers|Core" + md.version = "@VERSION@" + md.name = "OpenComputers (Core)" + md.url = "http://oc.cil.li/" + md.description = "OC core mod used for class transformer and as API owner to avoid cyclic dependencies." + md +}) { + override def registerBus(bus: EventBus, controller: LoadController) = true +} diff --git a/src/main/scala/li/cil/oc/common/launch/TransformerLoader.scala b/src/main/scala/li/cil/oc/common/launch/TransformerLoader.scala index 38a97fb3a..1f1b50415 100644 --- a/src/main/scala/li/cil/oc/common/launch/TransformerLoader.scala +++ b/src/main/scala/li/cil/oc/common/launch/TransformerLoader.scala @@ -2,32 +2,17 @@ package li.cil.oc.common.launch import java.util -import com.google.common.eventbus.EventBus import li.cil.oc.common.asm.ClassTransformer -import net.minecraftforge.fml.common.DummyModContainer -import net.minecraftforge.fml.common.LoadController -import net.minecraftforge.fml.common.ModMetadata import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions @TransformerExclusions(Array("li.cil.oc.common.asm")) @MCVersion("1.8") -class TransformerLoader extends DummyModContainer({ - val md = new ModMetadata() - md.authorList.add("Sangar") - md.modId = "OpenComputers|Core" - md.version = "@VERSION@" - md.name = "OpenComputers (Core)" - md.url = "http://oc.cil.li/" - md.description = "OC core mod used for class transformer and as API owner to avoid cyclic dependencies." - md -}) with IFMLLoadingPlugin { +class TransformerLoader extends IFMLLoadingPlugin { val instance = this - override def getModContainerClass = getClass.getName - - override def registerBus(bus: EventBus, controller: LoadController) = true + override def getModContainerClass = "li.cil.oc.common.launch.CoreModContainer" override def getASMTransformerClass = Array(classOf[ClassTransformer].getName) diff --git a/src/main/scala/li/cil/oc/integration/buildcraft/recipes/LootDiskProgrammableRecipe.scala b/src/main/scala/li/cil/oc/integration/buildcraft/recipes/LootDiskProgrammableRecipe.scala index 1d03466d9..4af8c2c39 100644 --- a/src/main/scala/li/cil/oc/integration/buildcraft/recipes/LootDiskProgrammableRecipe.scala +++ b/src/main/scala/li/cil/oc/integration/buildcraft/recipes/LootDiskProgrammableRecipe.scala @@ -2,6 +2,7 @@ package li.cil.oc.integration.buildcraft.recipes import java.util +import buildcraft.api.recipes.BuildcraftRecipeRegistry import buildcraft.api.recipes.IProgrammingRecipe import li.cil.oc.Constants import li.cil.oc.OpenComputers @@ -15,6 +16,8 @@ import scala.collection.convert.WrapAsJava._ import scala.collection.mutable object LootDiskProgrammableRecipe extends IProgrammingRecipe { + def register() = BuildcraftRecipeRegistry.programmingTable.addRecipe(LootDiskProgrammableRecipe) + override def getId: String = OpenComputers.ID + ":loot_disk" override def getOptions(width: Int, height: Int): util.List[ItemStack] = { diff --git a/src/main/scala/li/cil/oc/integration/buildcraft/recipes/ModBuildCraftRecipes.scala b/src/main/scala/li/cil/oc/integration/buildcraft/recipes/ModBuildCraftRecipes.scala index 52856d40f..6896d6010 100644 --- a/src/main/scala/li/cil/oc/integration/buildcraft/recipes/ModBuildCraftRecipes.scala +++ b/src/main/scala/li/cil/oc/integration/buildcraft/recipes/ModBuildCraftRecipes.scala @@ -7,6 +7,6 @@ object ModBuildCraftRecipes extends ModProxy { override def getMod = Mods.BuildCraftTiles override def initialize(): Unit = { - buildcraft.api.recipes.BuildcraftRecipeRegistry.programmingTable.addRecipe(LootDiskProgrammableRecipe) + LootDiskProgrammableRecipe.register() } }