Skip to content

Commit

Permalink
New ore filter implementation (#1561)
Browse files Browse the repository at this point in the history
* OreGlob prototype

* Apply manual inversion for !(ore) syntax

* Fix ebnf

* Remove OreEvaluator interface, finish OreGlobInterpreter javadoc

* Works

Permit empty input as valid oreglob expression
Some node optimizations
Fix 'n or more' counting one more N on some scenario
Tests
Rename NotNode to GroupNode, make it respect inverted flag

* Test case for empty input, group negation, impossible, any char, inverted any char, any char or more & inverted any char or more; fix some tokens getting included in literals

* !() parsing & test

* Inline token field and get rid of Token class for more cursedness

* Fix groups advancing token twice, slight style change

* Insert prefix like 'or' 'and' to improve readability

* Crude implementation of branch elimination

* Make OreGlob abstract, structural equality test cases

* Modify NodeVisitor to handle complete descriptions separately

* Repackage

* make getIndividualNodeMatchDescription abstract

* Optimization case for consecutive inverted string matches

* some compilation warnings, treat empty expression as impossible match, encapsulate inverted/next field

* logical inversion warning/optimization test

* Report inversion chains as well as nested inversions

* Correct nested inversion warning condition

* error visit fix etc

* hardcode oreglob to only match char below 0xFFFF, docs update

* MASSIVE COVER-UP

* Hide node constructors, make BranchType an inner class of BranchNode

* Update EBNF

* Update EBNF

* Always return no match glob if there's compilation error

* Integrate oreglob into actual ore filter

* small adjustments & docs

* change some terms

- 'inversion' -> 'not'/'negation'; Turns out 'logical inversion' means completely different thing oops
- 'nothing' -> 'empty'
- 'something' -> 'nonempty'
- 'impossible' -> 'nothing'

* Minor docs edit

* Minor docs edit 2

* Correct XNOR visualization

* Additional term change

* Compilation flags

- using $ without providing any compilation flags produces error
- consecutive compilation flag blocks at the beginning correctly displays "compilation flags in middle of expression" error
- fixed $ not getting formatted if the compilation flag is terminated with EOF

* update lang

* Rename CompileStatusWidget

* Divide OreFilterTestSlot implementation for future tutorial app (tm)

* Remove unnecessary package specification

* Correct highlight rule for compilation flags, remove loop labels in favor of cringe double breakers

* Comment getCursorPosFromMouse bit
  • Loading branch information
Tictim authored Apr 7, 2023
1 parent 3316fa0 commit 690788e
Show file tree
Hide file tree
Showing 38 changed files with 3,364 additions and 392 deletions.
3 changes: 3 additions & 0 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.modules.ModuleContainerRegistryEvent;
import gregtech.api.util.oreglob.OreGlob;
import gregtech.client.utils.BloomEffectUtil;
import gregtech.integration.groovy.GroovyScriptCompat;
import gregtech.common.covers.filter.oreglob.impl.OreGlobParser;
import gregtech.modules.GregTechModules;
import gregtech.modules.ModuleManager;
import net.minecraftforge.common.MinecraftForge;
Expand Down Expand Up @@ -42,6 +44,7 @@ public GregTechMod() {
public void onConstruction(FMLConstructionEvent event) {
moduleManager = ModuleManager.getInstance();
GregTechAPI.moduleManager = moduleManager;
OreGlob.setCompiler(input -> new OreGlobParser(input).compile());
moduleManager.registerContainer(new GregTechModules());
MinecraftForge.EVENT_BUS.post(new ModuleContainerRegistryEvent());

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/gregtech/api/gui/GuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ public class GuiTextures {
// Covers
public static final TextureArea COVER_MACHINE_CONTROLLER = TextureArea.fullImage("textures/items/metaitems/cover.controller.png");

// Ore Filter
public static final TextureArea ORE_FILTER_INFO = TextureArea.fullImage("textures/gui/widget/ore_filter/info.png");
public static final TextureArea ORE_FILTER_SUCCESS = TextureArea.fullImage("textures/gui/widget/ore_filter/success.png");
public static final TextureArea ORE_FILTER_ERROR = TextureArea.fullImage("textures/gui/widget/ore_filter/error.png");
public static final TextureArea ORE_FILTER_WARN = TextureArea.fullImage("textures/gui/widget/ore_filter/warn.png");
public static final TextureArea ORE_FILTER_WAITING = TextureArea.fullImage("textures/gui/widget/ore_filter/waiting.png");

public static final TextureArea ORE_FILTER_MATCH = TextureArea.fullImage("textures/gui/widget/ore_filter/match.png");
public static final TextureArea ORE_FILTER_NO_MATCH = TextureArea.fullImage("textures/gui/widget/ore_filter/no_match.png");

//Terminal
public static final TextureArea ICON_REMOVE = TextureArea.fullImage("textures/gui/terminal/icon/remove_hover.png");
public static final TextureArea ICON_UP = TextureArea.fullImage("textures/gui/terminal/icon/up_hover.png");
Expand Down
142 changes: 0 additions & 142 deletions src/main/java/gregtech/api/gui/widgets/OreDictFilterTestSlot.java

This file was deleted.

Loading

0 comments on commit 690788e

Please sign in to comment.