Skip to content

Commit

Permalink
build: 🚧 Dev Environment changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Krutoy242 committed Jan 10, 2024
1 parent 87e59a9 commit 06fda26
Show file tree
Hide file tree
Showing 21 changed files with 325 additions and 421 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ scripts/nc_script_addons
config/serializationisbad-remotecache.json
config/loliasm/methods-stable_39.csv
config/probezs.cfg
config/InfinityItemEditor.cfg
2 changes: 2 additions & 0 deletions dev/.devonly.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ mods/FantasticLib-*
mods/simplelogin-*
mods/zenrecipereload-*
mods/ProbeZS-*
mods/Caliper-*
mods/infinityeditor-*
ComplementaryUnbound_*

# Mods in process of testing to add them later
Expand Down
63 changes: 20 additions & 43 deletions dev/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,22 @@

πŸš§βœ…βŒ List of priorities:

- [ ] ✏️ Burn singularity should be exponential `1.25`
- [ ] ✏️ Star Of Psi should be obtainable in no-power run
- [ ] πŸ“– Explain BoP gems sources in empowered quests
- [ ] πŸ› fix Ie Bug If Removing Entities When Crash On Mount
- [ ] ✏️ Remove Mysical Flesh
- [ ] πŸ› Fix AdvRock planet jump causing death https://discord.com/channels/911676461050642432/959878900278784030/1179686673525776474
- [ ] ✏️ Remove usage of different fires from Cyclic
- [ ] ✏️ Remove fast processing with Crushing block since its too fast
- [ ] ✏️ fix 59% on Bees Output
- [ ] πŸ› fix when unlog on entity causing it to dissapear
- [ ] πŸ€– Nanomachines still lost on servers
- [ ] ✏️ add 3D Prints More Usage (maybe for QMD)
- [ ] ✏️ Shift+Right click clear NC Multitool info
- [ ] ✏️ Buff advanced generators
- [ ] πŸ“– remove Eldritch Knowledge Rewards since newbies eat them all at once
- [ ] ✏️ adv Rock Crystals Beneficate In QMD
- [ ] default Nanomachines Configs
- [ ] fix Trophy Crafting Not Working
- [ ] distructive Stabilisation Ring Not Working
- [ ] induction Smelter Add Energetic Alloy Recipe
- [ ] add Drawer Key To Morphing Tool
- [ ] fix I C2 Chainsaw Cant Cut T Ctrees
- [ ] fix Filament N B T
- [ ] fix Ic2 Fertilizer Recipe
- [ ] remove Grid Hotkey
- [ ] rolling Machine Remove False Quest Description
- [ ] install Threadwatcher
- [ ] remove Enchantments From Quests Rewards
- [ ] check If Compressed Cobble In E I O Smeltery Smeltable
- [ ] sulfuric acid recipe recipe in Chemical Reactor should also accept Mek's liquid
- [ ] Disable Quark's buttons for Modular Storage
- [ ] Remove cheap fluiduct recipe
- [ ] Install https://www.curseforge.com/minecraft/mc-mods/omniwand
- [ ] Replace BetterP2P to https://www.curseforge.com/minecraft/mc-mods/enhancedp2p
- [ ] Replace Villager Market to https://www.curseforge.com/minecraft/mc-mods/villager-market-nbt-fix
- [ ] find Option That Fix E U Ring On Change Dimension
- [ ] fix Dispenser Quest Typo C
- [ ] fix Tropical Gardens Spawn In Frozen Ocean
- [ ] check Shark Bite Glitching
- [ ] add3 D Prints More Usage
- [ ] remove Melodic Alloy Reservoir From I O
- [ ] remove All Modded Books From Rewards
- [ ] Remove useless ores from T6 ore miner
- [ ] disable Bogo Shuffle
- [ ] `betteranimalsplus_goose` replace for world tick instead of entity tick
- [ ] Remove Armor Curve
- [ ] ✏️ steel And Up Turbine Upgrades Not Working
- [ ] πŸ“– note That Mithminite Armor Simplify Bores
- [ ] ⚑ Replace `utils.rh` with subcommands to improve performance. `IItemStack.ores` is slow.
- [ ] ✏️ QMDs `Sodium Chlorde` and `Sodium Nitrate` unify
- [ ] 🌍 Fix Biome Tweaker block replacementsafter AdvRock filler block change
- [ ] πŸ–ΌοΈ Optimize Bibliocraft textures
- [ ] ✏️ addVoidBeaconTab
- [ ] addSkyblockTpMechanic
- [ ] Fix Myrmexes have double JER trade tabs

```sh
/bcore_ticktime
Expand Down Expand Up @@ -95,6 +71,8 @@ minecraft:sponge

Planned non-urgent changes, or just good ideas:

- [ ] 🌎 fix Tropical Gardens Spawn In OTG Frozen Ocean
- [ ] ✏️ Star Of Psi should be obtainable in no-power run
- [ ] πŸ•Έ Create issues about IC2 Reactor in compact machine and cables disconnection
- [ ] πŸ› If Conarm armor have huge durability (>65,000), when it get damage over 50% its repairing to 100% and become unbreakable. On some cases it void armor from inventory instead
- [ ] 🟒 Return `TwilightTweaks` when fixed https://github.com/LoliKingdom/Bansoukou/issues/5
Expand All @@ -103,12 +81,9 @@ Planned non-urgent changes, or just good ideas:
- [ ] πŸ“– sort TC book By Material Power, need fix: https://github.com/Project-RT/RandomTweaker/issues/67
- [ ] ✏️ Stackable Fluid Containers duped when crafting with fluid. Waiting for fix: https://github.com/CraftTweaker/CraftTweaker/issues/1692
- [ ] ✏️ Apiarist Villagert should sell Combs cor Cacoa. Seems like its impossible to remove Apiarist trades with `vtt` mod
- [ ] 🟒 add `Fairy Lights` when released https://github.com/ACGaming/UniversalTweaks/pull/291
- [ ] πŸ“– Improve messages "Player Obtained [...]" with `tellraw` command. Cant untill fix `/tellraw` for Discord
- [ ] ✏️ `Harbinger Cube` must spawn with strong Iron/Diamond skin effects and as Blight
- [ ] 🌍 fix Mercury Have Water
- [ ] 🟒 Unify QMD cobalt dust after QMD update
- [ ] 🟒 Install `Fairy Lights` when fixed: https://github.com/ACGaming/UniversalTweaks/issues/289
- [ ] ✏️ Add more seeds compat for Graden Cloche https://github.com/michelegargiulo/ZenCloche/wiki
- [ ] πŸ”¨ fix Invincible Combo `Strength Of Will` + `Runic Shield`
- [ ] ✏️ Fix Health boost potion recipe (one from gold ingot)
Expand Down Expand Up @@ -220,7 +195,7 @@ Planned non-urgent changes, or just good ideas:
- [ ] ✏️ Add craft mechanic - Mud Ball hit something (called "humilate")
- [ ] πŸ“– Add little tiles fancy chest with lot of space
- [ ] ✏️ Add mobs in Mek's gear
- [ ] 🌍 AdvRock geodes should contain modded ores
- [ ] 🌍 AdvRock geodes should contain modded ores (use <geodeOres> XML tag)
- [ ] ✏️ Nerf IO spike metals (carapace with `Bedrock cobblestone` + `Bedrock Ore` inside instead of pure blocks)
- [ ] ✏️ Remove Cyclic's machines completely because they are laggy
- [ ] ✏️ Add craft `Rat hole` + `Salis Mundus` -> `Something`
Expand Down Expand Up @@ -291,6 +266,8 @@ Planned non-urgent changes, or just good ideas:

## Unable to

- ✏️ fix 59% on Bees Output such as Combs. Impossible since this how Mod Tweaker adds them. Some recipes have -1% some dont.
- ❌ fix I C2 Chainsaw Cant Cut T Ctrees. Impossible to change mining level with `MaterialChanger`
- ✏️ Add Rubber Wood in Resin Funnel - **Resin Funnel** recipes cant be changed
- πŸ”„ Blacklist Bedrock Ore for ![](https://git.io/Jz9q9 "Mining Laser")
- Buff Giant Sword
Expand Down
2 changes: 1 addition & 1 deletion dev/automation/Inject_JS.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function init(h = defaultHelper) {
glob.sync('scripts/**/*.zs').forEach((filePath) => {
const zsfileContent = loadText(filePath)
for (const match of zsfileContent.matchAll(
/\/\*\s*Inject_js((\(|\{)[\s\S\n\r]*?(\)|\}))\s*\*\//gm
/\/\*\s*Inject_js((\(|\{)[\s\S\n\r]*?(\)|\})\s*)\*\//gm
)) {
const lineNumber = zsfileContent
.substring(0, match.index)
Expand Down
88 changes: 33 additions & 55 deletions dev/automation/bansoukou.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// @ts-check

import { spawn } from 'node:child_process'
import { execSync, spawnSync } from 'node:child_process'
import { existsSync, mkdirSync, renameSync, statSync, unlinkSync } from 'node:fs'
import { dirname, join, parse } from 'node:path'
import process from 'node:process'
Expand All @@ -17,13 +17,11 @@ import AdmZip from 'adm-zip'
import fast_glob from 'fast-glob'
import levenshtein from 'fast-levenshtein'
import _ from 'lodash'
import replace_in_file from 'replace-in-file'

import {
defaultHelper,
execSyncInherit,
loadJson,
loadText,
saveObjAsJson,
saveText,
} from '../lib/utils.js'
Expand All @@ -35,39 +33,11 @@ function relative(relPath = './') {
export async function init(h = defaultHelper) {
await h.begin('Fixing Bansoukou files')
renameFoldersToActualMods()
injectJsonAdvancementFixes()
await showDiffs(h)

return h.result('Done!')
}

function injectJsonAdvancementFixes() {
const json = loadJson(relative('bansoukou.json'))
for (const [glob, data] of Object.entries(json)) {
const filePaths = fast_glob.sync(`mods/${glob}`, { dot: true })
for (const [archievePath, advJson] of Object.entries(data))
saveFile(/** @type {string} */ (filePaths.pop()), archievePath, advJson)
}
return Object.entries(json).length
}

/**
* @param {string} jarPath
* @param {string} archievePath
* @param {object} advJson
*/
function saveFile(jarPath, archievePath, advJson) {
const savePath = join('bansoukou/', getJarName(jarPath), archievePath)
const oldText = loadText(savePath)
const newText = JSON.stringify(advJson, null, 2)
if (oldText.length === newText.length && oldText === newText) return
saveText(newText, savePath)
}

function getJarName(jarPath) {
return jarPath.match(/^mods\/(.+)\.(jar|disabled)$/)[1]
}

/**
* Get names of all folders inside ./bansoukou/
*/
Expand Down Expand Up @@ -133,9 +103,10 @@ async function showDiffs(/** @type {typeof defaultHelper} */ h) {
? `mods/${folder}.disabled`
: `mods/${folder}.jar`
if (!existsSync(jarPath)) continue
const jarStat = getStat(jarPath)
const jarStat = statToString(statSync(jarPath))
const isJarCached = caches[jarPath] === jarStat
caches[jarPath] = jarStat
const unpatchedModPath = join('~bansoukou_unpatched/', folder)

/** @type {AdmZip | undefined} */
let zip
Expand All @@ -146,14 +117,20 @@ async function showDiffs(/** @type {typeof defaultHelper} */ h) {
cwd: `bansoukou/${folder}`,
})

// Generate Diffs
changedFiles.forEach((changedFile) => {
const unpatchedModPath = join('~bansoukou_unpatched/', folder)
const unpatchedFilePath = join(unpatchedModPath, changedFile)
const patchedFilePath = join('bansoukou', folder, changedFile)
const diffOut = `${join(diffStore, folder, changedFile)}.diff`
const diffExist = existsSync(diffOut)
const stat = statSync(patchedFilePath)

// If file just supposed to be removed no diffs will be generated
if (!stat.size) return

// Skip if both files unchanged
const fileStat = getStat(patchedFilePath)
if (isJarCached && caches[patchedFilePath] === fileStat) return
// Never skip if diff file not exist
const fileStat = statToString(stat)
if (diffExist && isJarCached && caches[patchedFilePath] === fileStat) return

// Extract unpatched file
try {
Expand All @@ -164,24 +141,34 @@ async function showDiffs(/** @type {typeof defaultHelper} */ h) {
return
}

const unpatchedFilePath = join(unpatchedModPath, changedFile)
const { oldF, newF } = decompile(unpatchedFilePath, patchedFilePath)

const diffOut = `${join(diffStore, folder, changedFile)}.diff`
mkdirSync(dirname(diffOut), { recursive: true })

const gitDiffCommand = 'git diff --no-index'
+ ` "${oldF}"`
+ ` "${newF}"`
// process.stdout.write(`> ${chalk.cyan(gitDiffCommand)}\n`)

/** @type {string|undefined} */
let diffResult
try {
execSyncInherit(
'git diff --no-index'
+ ` "${oldF}"`
+ ` "${newF}"`
+ ` > "${diffOut}"`
)
diffResult = execSync(gitDiffCommand).toString().trim()
}
catch (error) {
// Diff will end with error each time
diffResult = error?.stdout.toString().trim()
}

// Remove diff technical info
if (diffResult) {
diffResult = diffResult.replace(/^diff --git .+\nindex .+\n(--- .+\n\+\+\+ .+|Binary files .+)\n/m, '')
saveText(diffResult, diffOut)
}

try {
spawn(
spawnSync(
'code --diff'
+ ` "${oldF}"`
+ ` "${newF}"`
Expand All @@ -190,13 +177,6 @@ async function showDiffs(/** @type {typeof defaultHelper} */ h) {
}
catch (error) {}

// Remove diff technical info
replace_in_file.sync({
files: diffOut,
from : /^diff --git .+\nindex .+\n--- .+\n\+\+\+ .+\n/m,
to : '',
})

// Remove tempFiles
if (unpatchedFilePath !== oldF) unlinkSync(oldF)
if (patchedFilePath !== newF) unlinkSync(newF)
Expand Down Expand Up @@ -241,12 +221,10 @@ function decompile(unpatchedFilePath, patchedFilePath) {
}

/**
*
* @param {string} filePath
* @returns {string}
* @param {import("fs").Stats} stat
*/
function getStat(filePath) {
const stat = statSync(filePath)
function statToString(stat) {
return `${stat.mtime.toUTCString()} - ${stat.size}`
}

Expand Down
37 changes: 22 additions & 15 deletions dev/automation/jei.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

// @ts-check

import process from 'node:process'

import { getPurged, getSubMetas } from '../lib/tellme.js'
import {
config,
Expand All @@ -30,10 +32,11 @@ export async function init(h = defaultHelper) {
/** @type {string[]} */
const pure = []

/** @type {Set<string>} */
const removedMods = new Set()
const modList = getCSV('config/tellme/mod-list-csv.csv')

const itemsCsv = getCSV('config/tellme/items-csv.csv')
const definitions = Object.fromEntries(itemsCsv.map(o => [o['Registry name'], true]))

/** @type {string[]} */
const merged = [...config(jeiConfigPath).advanced.itemBlacklist, ...purged]

Expand All @@ -53,17 +56,21 @@ export async function init(h = defaultHelper) {
if (next.includes(s)) return

// If wildcarded
const def = s.match(/([^:]+:[^:]+)[:;].+/)?.[1]
if (def && merged.includes(def)) return

// If mod not exist
const mod = s.split(':')[0]
if (
!['fluid', 'gas'].includes(mod)
&& !modList.some(m => m.ModID === mod)
) {
removedMods.add(mod)
return
/** @type {string} */
// @ts-expect-error undef
const defMetaed = s.match(/([^:]+:[^:]+)[:;].+/)?.[1]
if (defMetaed && merged.includes(defMetaed)) return

// If definition doesnt exist
const splitted = s.split(':')
const mod = splitted[0]
const def = splitted.slice(0, 2).join(':')
if (mod !== 'fluid' && mod !== 'gas') {
// If mod not exist
if (!modList.some(m => m.ModID === mod)) return

// Item not exist
if (!definitions[def]) return
}

pure.push(s)
Expand All @@ -81,8 +88,8 @@ export async function init(h = defaultHelper) {
await h.begin(`injected :>> ${injected[0].numMatches}`)

h.result(
`Purged / Manually Blacklisted: ${purged.length} / ${
pure.length - purged.length
`Purged / Manually Blacklisted: ${purged.size} / ${
pure.length - purged.size
}`
)
}
Expand Down
1 change: 0 additions & 1 deletion dev/automation/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export async function init(h = defaultHelper, options = argv) {
'<integrateddynamics:squeezer>',
'<ic2:crafting:18>',
'<extrautils2:spike_iron>',
'<valkyrielib:modifier_component>',
'<environmentaltech:lightning_rod>',
'<environmentaltech:lightning_cont_6>',
'<environmentaltech:lightning_cont_5>',
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions dev/lib/curseforge-md-to-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ for (const o of ['d', 'h']) {

// Find all <code> elements and replace new lines with <br>
// Curse Forge cant in newlines inside code blocks
$('code').each(function () {
const codeContent = $(this).html()
if (!codeContent) return
$(this).html(codeContent.replace(/\n/g, '<br/>\n').replace(/ /g, 'Β '))
})
// $('code').each(function () {
// const codeContent = $(this).html()
// if (!codeContent) return
// $(this).html(codeContent.replace(/\n/g, '<br/>\n').replace(/ /g, 'Β '))
// })

// π‘·π’“π’†π’‡π’Šπ’™π’†π’”
$('body').prepend(
Expand Down
Loading

0 comments on commit 06fda26

Please sign in to comment.