Skip to content

Remove hungarian notation, Rename underblock systems, and fix nei overflow#212

Merged
koolkrafter5 merged 6 commits into
masterfrom
hiss-bad-notation-b-gone
Jul 12, 2026
Merged

Remove hungarian notation, Rename underblock systems, and fix nei overflow#212
koolkrafter5 merged 6 commits into
masterfrom
hiss-bad-notation-b-gone

Conversation

@C0bra5

@C0bra5 C0bra5 commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Removes Hungarian notation from cropsNH
  • Rename under-block systems to use the word subsoil wherever possible since that is the name I've been using for all outward-facing things so far.
  • Change the light level requirement message in nei so it doesn't overflow.

I used regex to find all the variable declarations that used Hungarian notation in CropsNH, and then used IDEA's refactor tool to rename those variables across the project all at once.

Regex used for first pass (case sensitive):

(?:(?:[A-Z$_][a-zA-Z0-9\._$]*+(?:<(?:[^\s>,]++|,\s*)++(?:\s+(?:extends|implements)\s++\S+)?>)?|byte|short|int|long|float|double|boolean|char|var)(?:\[\])*+|(?<=,))\s++([vrtma][A-Z][a-zA-Z0-9_]++)(?:\s+=|;|$|,|\))

Regex used for second pass (case sensitive, mostly false positives):

(?:(?:[A-Z$_][a-zA-Z0-9\._$]*+(?:<(?:[^\s>,]++|,\s*)++(?:\s+(?:extends|implements)\s++\S+)?>)?|byte|short|int|long|float|double|boolean|char|var)(?:\[\])*+|(?<=,))\s++([a-z][A-Z][a-zA-Z0-9_]++)(?:\s+=|;|$|,|\))

A better expression would require full PCRE2 support, so use something like ripgrep with -P -e "expression". This one will catch variable declarations that use nested generics such as T<U, V<? extends W.X<Y>> mAsd = 2

(?:(?<class>[A-Z$_?][a-zA-Z0-9\._$]*+(?:<(?<template>\g<class>(?:\s++(?:extends|implements)\s++\g<class>)?)(\s*+,\s*+\g<template>)*+>)?|byte|short|int|long|float|double|boolean|char|var)(?:\[\])*+|(?<=,))\s++([vrtma][A-Z][a-zA-Z0-9_]++)(?:\s+=|;|$|,|\))

Tests for the regexes

# should not match
this.mTier = 2;
# needs full PCRE2 support
T<U, V<? extends ClassA.SubClassB<ClassC>>> mAsd = 2;
# always success
final int mInt, mInt2;
int[] aAsd;
Block.SoundType aAsd = new Block.SoundType();
public void asd(ItemStack aStack, Asd$sa.asd aAsd) {}
Class<? extends Gsr> rClass;
Class<Block.SoundType, ? extends Gsr.Asd> rClass;

I also used regex to find all mentions of under block, renamed everything manually or using the IDEA's refactor tool.

(under(\s*|[_\-])block|block(\s*|[_\-])under)

The new light level message in nei
image

Checklist

  • I have tested this PR in DevEnv
  • I have tested this PR in Fullpack
    • Daily 618
  • This PR is in compliance with the GTNH AI Policy
    • No AI Used

@C0bra5 C0bra5 added the Refactor For PRs rewriting a part of the code to have a nicer code overall. label Jul 11, 2026
@C0bra5
C0bra5 marked this pull request as ready for review July 11, 2026 14:48
@C0bra5 C0bra5 added the Safe for Stable Bugfix with low break chance for patch releases label Jul 11, 2026
@C0bra5 C0bra5 changed the title Remove hungarian notation from CropsNH Remove hungarian notation, Rename underblock systems, and fix nei overflow Jul 11, 2026
@koolkrafter5
koolkrafter5 merged commit 95d651a into master Jul 12, 2026
1 check passed
@koolkrafter5
koolkrafter5 deleted the hiss-bad-notation-b-gone branch July 12, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor For PRs rewriting a part of the code to have a nicer code overall. Safe for Stable Bugfix with low break chance for patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants