mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
Speedup - Inspired by the 1.12 version
This commit is contained in:
1 parent
6f874e5434
commit
449ce974f4
9 files changed
+463
-350
No files matched your search
@@ -58,8 +58,8 @@ public class MineTweakerImplementationAPI {
|
||||
private static final ListenPlayerLoggedIn LISTEN_LOGIN = new ListenPlayerLoggedIn();
|
||||
private static final ListenPlayerLoggedOut LISTEN_LOGOUT = new ListenPlayerLoggedOut();
|
||||
private static final ListenBlockInfo LISTEN_BLOCK_INFO = new ListenBlockInfo();
|
||||
private static final EventList<ReloadEvent> ONRELOAD = new EventList<ReloadEvent>();
|
||||
private static final EventList<ReloadEvent> ONPOSTRELOAD = new EventList<ReloadEvent>();
|
||||
private static final EventList<ReloadEvent> ONRELOAD = new EventList<>();
|
||||
private static final EventList<ReloadEvent> ONPOSTRELOAD = new EventList<>();
|
||||
|
||||
static {
|
||||
minetweakerCommands = new HashMap<String, MineTweakerCommand>();
|
||||
@@ -621,28 +621,7 @@ public class MineTweakerImplementationAPI {
|
||||
events.onPlayerLoggedIn(LISTEN_LOGIN);
|
||||
events.onPlayerLoggedOut(LISTEN_LOGOUT);
|
||||
}
|
||||
//
|
||||
// byte[] currentScript = MineTweakerAPI.tweaker.getScriptData();
|
||||
// if (currentScript != null) {
|
||||
// System.out.println("Already loaded a script before");
|
||||
//
|
||||
// // alread loaded a script
|
||||
// byte[] stagedScript = MineTweakerAPI.tweaker.getStagedScriptData();
|
||||
//
|
||||
// if (Arrays.equals(currentScript, stagedScript)) {
|
||||
// System.out.println("No reload needed");
|
||||
// return; // no reload necessary
|
||||
// }
|
||||
//
|
||||
// if (MineTweakerAPI.game.isLocked()) {
|
||||
// System.out.println("Reload blocked");
|
||||
// MineTweakerAPI.game.signalLockError();
|
||||
// return;
|
||||
// }
|
||||
// } else {
|
||||
// System.out.println("First time loading a script, go ahead");
|
||||
// }
|
||||
|
||||
|
||||
MineTweakerAPI.tweaker.rollback();
|
||||
if (MineTweakerAPI.server != null) {
|
||||
if (!MineTweakerAPI.server.isCommandAdded("minetweaker")) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface IRecipeManager {
|
||||
* @return number of removed recipes
|
||||
*/
|
||||
@ZenMethod
|
||||
int remove(IIngredient output, @Optional boolean nbtMatch);
|
||||
void remove(IIngredient output, @Optional boolean nbtMatch);
|
||||
|
||||
/**
|
||||
* Adds a shaped recipe.
|
||||
@@ -81,7 +81,7 @@ public interface IRecipeManager {
|
||||
* @return number of removed recipes
|
||||
*/
|
||||
@ZenMethod
|
||||
int removeShaped(IIngredient output, @Optional IIngredient[][] ingredients);
|
||||
void removeShaped(IIngredient output, @Optional IIngredient[][] ingredients);
|
||||
|
||||
/**
|
||||
* Removes shapeless recipes.
|
||||
@@ -94,7 +94,7 @@ public interface IRecipeManager {
|
||||
* @return number of removed recipes
|
||||
*/
|
||||
@ZenMethod
|
||||
int removeShapeless(IIngredient output, @Optional IIngredient[] ingredients, @Optional boolean wildcard);
|
||||
void removeShapeless(IIngredient output, @Optional IIngredient[] ingredients, @Optional boolean wildcard);
|
||||
|
||||
/**
|
||||
* Performs a crafting with the specified ingredients. Returns null if no
|
||||
|
||||
@@ -28,21 +28,14 @@ public class ShapedRecipe implements ICraftingRecipe {
|
||||
|
||||
public ShapedRecipe(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function, IRecipeAction action, boolean mirrored) {
|
||||
int numIngredients = 0;
|
||||
for(int i = 0; i < ingredients.length; i++) {
|
||||
IIngredient[] ingredient = ingredients[i];
|
||||
for(int i1 = 0; i1 < ingredient.length; i1++) {
|
||||
if(ingredient[i1] != null) {
|
||||
for (IIngredient[] ingredient : ingredients) {
|
||||
for (IIngredient iIngredient : ingredient) {
|
||||
if (iIngredient != null) {
|
||||
numIngredients++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for(IIngredient[] row : ingredients) {
|
||||
// for(IIngredient ingredient : row) {
|
||||
// if(ingredient != null) {
|
||||
// numIngredients++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
this.posx = new byte[numIngredients];
|
||||
this.posy = new byte[numIngredients];
|
||||
this.output = output;
|
||||
|
||||
@@ -111,7 +111,7 @@ public class MTTweaker implements ITweaker {
|
||||
System.out.println("Loading scripts");
|
||||
|
||||
scriptData = ScriptProviderMemory.collect(scriptProvider);
|
||||
Set<String> executed = new HashSet<String>();
|
||||
Set<String> executed = new HashSet<>();
|
||||
|
||||
Iterator<IScriptIterator> scripts = scriptProvider.getScripts();
|
||||
while (scripts.hasNext()) {
|
||||
@@ -120,10 +120,10 @@ public class MTTweaker implements ITweaker {
|
||||
if (!executed.contains(script.getGroupName())) {
|
||||
executed.add(script.getGroupName());
|
||||
|
||||
Map<String, byte[]> classes = new HashMap<String, byte[]>();
|
||||
Map<String, byte[]> classes = new HashMap<>();
|
||||
IEnvironmentGlobal environmentGlobal = GlobalRegistry.makeGlobalEnvironment(classes);
|
||||
|
||||
List<ZenParsedFile> files = new ArrayList<ZenParsedFile>();
|
||||
List<ZenParsedFile> files = new ArrayList<>();
|
||||
|
||||
while (script.next()) {
|
||||
Reader reader = null;
|
||||
|
||||
Reference in new issue
Block a user