forked from EnigmaticaModpacks/Enigmatica2Expert
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(recipes): ⚡Rewrite internal purging script to be faster
Now removing items from the game, like 4 types of copper dusts, would be little bit faster (1-2 seconds).
- Loading branch information
Showing
32 changed files
with
339 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
#priority 3900 | ||
#reloadable | ||
|
||
import crafttweaker.item.IIngredient; | ||
import crafttweaker.item.IItemStack; | ||
|
||
zenClass CPurge { | ||
val ingr as IIngredient; | ||
|
||
zenConstructor() { } | ||
|
||
function purge(_ingr as IIngredient) as CPurge { | ||
ingr = _ingr; | ||
if (isNull(ingr)) return this; | ||
|
||
for item in ingr.items { | ||
val actItem = actualItem(item); | ||
recipes.remove(actItem); | ||
utils.log('purged:', actItem.commandString, actItem.displayName); | ||
} | ||
return this; | ||
} | ||
|
||
function furn() as CPurge { | ||
if (isNull(ingr)) return this; | ||
for item in ingr.items { | ||
furnace.remove(actualItem(item)); | ||
} | ||
return this; | ||
} | ||
|
||
function ores() as CPurge { | ||
if (isNull(ingr)) return this; | ||
for item in ingr.items { | ||
for ore in item.ores { | ||
ore.remove(item); | ||
} | ||
} | ||
return this; | ||
} | ||
|
||
///////////// Private field ///////////// | ||
function actualItem(item as IItemStack) as IItemStack { | ||
return (item.damage == 0 && item.isDamageable) | ||
? item.anyDamage() | ||
: item; | ||
} | ||
|
||
} | ||
|
||
static purge as CPurge = CPurge(); | ||
|
||
global Purge as function(IIngredient)CPurge = function(ingr as IIngredient) as CPurge { | ||
return purge.purge(ingr); | ||
}; |
Oops, something went wrong.