Skip to content

Commit

Permalink
remove forbidden getModItem calls (#952)
Browse files Browse the repository at this point in the history
* import tests from GT5U

* add NHCore in the forbidden list

* purge litterals from GMI

* remove bw gmi (1/2)

* remove GG.isModLoaded

* remove BW.isModLoaded

* remove GT++.isModLoaded

* remove NEIOrePlugin.isModLoaded

* remove TT.isModLoaded

* remove KekzTech.isModLoaded

* prevent useless isModLoaded checks

* remove bw gmi (2/2)

* remove NEIOrePlugin gmi

* remove tectech gmi

* remove nhcore gmi (1/3)

* remove nhcore gmi (2/3)

* remove gregtech gmi (1/2)

* temp

* fix other merge conflicts

* remove gregtech gmi (2/2)

* remove nhcore gmi (3/3)

* remove gg gmi (3/3)

* remove kekztech gmi (3/3)

* strenghten gmi checks

* fix GT++ gmi

* spotless apply

* fix bad copy paste

* fix missing import

* fix bad copy/paste again
  • Loading branch information
boubou19 authored Sep 1, 2024
1 parent 3b8312a commit d41353c
Show file tree
Hide file tree
Showing 81 changed files with 5,287 additions and 5,355 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test-forbidden-getmoditems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Forbidden getModItems

on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]

jobs:
test-forbidden-getmoditems:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect forbidden getModItem calls
shell: bash
run: |
! grep -E -r 'getModItem\(("(bartworks|galacticgreg|ggfab|GoodGenerator|gregtech|gtnhlanth|miscutils|kekztech|kubatech|tectech|gtneioreplugin|dreamcraft)"|.*(BartWorks|GalactiGreg|GGFab|GoodGenerator|GregTech|GTNHLanthanides|GTPlusPlus|KekzTech|KubaTech|TecTech|NEIOrePlugin|NewHorizonsCoreMod)\.ID)' src/main/java
18 changes: 18 additions & 0 deletions .github/workflows/test-forbidden-ismodloaded.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Forbidden isModLoaded

on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]

jobs:
test-forbidden-isModLoaded:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect forbidden isModLoaded calls
shell: bash
run: |
! grep -E -r '(BartWorks|GalactiGreg|GGFab|GoodGenerator|GTNHLanthanides|GregTech|GTPlusPlus|KekzTech|KubaTech|TecTech|NEIOrePlugin|NewHorizonsCoreMod)\.isModLoaded' src/main/java
19 changes: 19 additions & 0 deletions .github/workflows/test-scala-presence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test Scala Presence

on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]

jobs:
test-scala-presence:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect scala presence
shell: bash
run: |
! grep -E -r 'import scala\.' src/main/java
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Add your dependencies here

dependencies {
api("com.github.GTNewHorizons:GT5-Unofficial:5.09.49.40:dev")
api("com.github.GTNewHorizons:GT5-Unofficial:5.09.49.42:dev")
api("com.github.GTNewHorizons:Yamcl:0.6.0:dev")
api("com.github.GTNewHorizons:Baubles:1.0.4:dev")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.dreammaster.auxiliary;

import static com.dreammaster.scripts.IScriptLoader.missing;
import static com.dreammaster.scripts.IScriptLoader.wildcard;
import static gregtech.api.enums.Mods.*;

import net.minecraft.init.Blocks;
Expand Down Expand Up @@ -113,22 +114,6 @@ public void loadConfig() {
API.hideItem(GT_ModHandler.getModItem(AppliedEnergistics2.ID, "tile.BlockPaint", 1));
}

if (BartWorks.isModLoaded()) {
API.hideItem(GT_ModHandler.getModItem(BartWorks.ID, "gt.bwMetaGeneratedGTEnhancementcapsule", 1, 477));
API.hideItem(
GT_ModHandler
.getModItem(BartWorks.ID, "gt.bwMetaGeneratedGTEnhancementcapsule", 1, 32767, missing));
API.hideItem(
GT_ModHandler.getModItem(
BartWorks.ID,
"gt.bwMetaGeneratedGTEnhancementcapsuleMolten",
1,
32767,
missing));
API.hideItem(GT_ModHandler.getModItem(BartWorks.ID, "gt.bwMetaGeneratedcapsuleMolten", 1, 32767, missing));
API.hideItem(GT_ModHandler.getModItem(BartWorks.ID, "gt.bwMetaGeneratedcapsule", 1, 32767, missing));
}

if (Chisel.isModLoaded()) {
API.hideItem(GT_ModHandler.getModItem(Chisel.ID, "amber", 1));
API.hideItem(GT_ModHandler.getModItem(Chisel.ID, "bloodBrick", 1));
Expand Down Expand Up @@ -157,8 +142,8 @@ public void loadConfig() {
API.hideItem(GT_ModHandler.getModItem(BiomesOPlenty.ID, "misc", 1, 6, missing));
}
if (MagicBees.isModLoaded()) {
API.hideItem(GT_ModHandler.getModItem(MagicBees.ID, "capsule.magic", 1, 32767, missing));
API.hideItem(GT_ModHandler.getModItem(MagicBees.ID, "capsule.void", 1, 32767, missing));
API.hideItem(GT_ModHandler.getModItem(MagicBees.ID, "capsule.magic", 1, wildcard, missing));
API.hideItem(GT_ModHandler.getModItem(MagicBees.ID, "capsule.void", 1, wildcard, missing));
}

if (ForbiddenMagic.isModLoaded()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static com.github.bartimaeusnek.bartworks.API.recipe.BartWorksRecipeMaps.radioHatchRecipes;
import static com.github.bartimaeusnek.bartworks.util.BWRecipes.calcDecayTicks;
import static gregtech.api.enums.Mods.GTPlusPlus;
import static gregtech.api.util.GT_RecipeConstants.DECAY_TICKS;

import net.minecraft.item.ItemStack;
Expand All @@ -14,10 +13,6 @@
public class BW_RadHatchMaterial {

public static void runRadHatchAdder() {
if (!GTPlusPlus.isModLoaded()) {
return;
}

ItemStack err = ItemUtils.getErrorStack(1);

for (Material material : Material.mMaterialMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

public class BartWorksMaterials {

@Deprecated
public static Materials getBartWorksMaterialByVarName(String name) {
Materials materials = Materials._NULL;
try {
Expand All @@ -21,16 +22,19 @@ public static Materials getBartWorksMaterialByVarName(String name) {
return materials;
}

@Deprecated
public static Materials getBartWorksMaterialByODName(String name) {
return Werkstoff.werkstoffHashSet.stream().filter(e -> e.getVarName().equals(name)).findFirst()
.map(Werkstoff::getBridgeMaterial).orElse(Materials._NULL);
}

@Deprecated
public static Materials getBartWorksMaterialByIGNName(String name) {
return Optional.ofNullable(Werkstoff.werkstoffNameHashMap.get(name)).map(Werkstoff::getBridgeMaterial)
.orElse(Materials._NULL);
}

@Deprecated
public static Materials getBartWorksMaterialByID(int id) {
return Optional.ofNullable(Werkstoff.werkstoffHashMap.get((short) id)).map(Werkstoff::getBridgeMaterial)
.orElse(Materials._NULL);
Expand Down
Loading

0 comments on commit d41353c

Please sign in to comment.