aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-07-13 22:08:26 +0800
committershedaniel <daniel@shedaniel.me>2020-07-13 22:08:26 +0800
commitf2d6d8525aa74329c6491f57afad6570aec25791 (patch)
tree9828feba6b3d7fedc27ecf2573a5a4afbcda5e08 /src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java
parent627b2524ee1111a020a38928818858cd8f1bd804 (diff)
downloadRoughlyEnoughItems-f2d6d8525aa74329c6491f57afad6570aec25791.tar.gz
RoughlyEnoughItems-f2d6d8525aa74329c6491f57afad6570aec25791.tar.bz2
RoughlyEnoughItems-f2d6d8525aa74329c6491f57afad6570aec25791.zip
Performance Improvements
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java')
-rw-r--r--src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java b/src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java
index a7b061bd6..de3e66da4 100644
--- a/src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java
+++ b/src/main/java/me/shedaniel/rei/tests/plugin/REITestPlugin.java
@@ -26,17 +26,20 @@ package me.shedaniel.rei.tests.plugin;
import me.shedaniel.rei.api.EntryRegistry;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.plugins.REIPluginV0;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.apache.logging.log4j.LogManager;
import org.jetbrains.annotations.TestOnly;
-import java.util.Collections;
import java.util.Random;
@TestOnly
+@Environment(EnvType.CLIENT)
public class REITestPlugin implements REIPluginV0 {
private Random random = new Random();
@@ -56,7 +59,7 @@ public class REITestPlugin implements REIPluginV0 {
int times = 10;
for (Item item : Registry.ITEM) {
for (int i = 0; i < times; i++)
- entryRegistry.queueRegisterEntryAfter(EntryStack.create(item), Collections.singleton(transformStack(EntryStack.create(item))));
+ entryRegistry.registerEntryAfter(EntryStack.create(item), transformStack(EntryStack.create(item)));
try {
for (ItemStack stack : entryRegistry.appendStacksForItem(item)) {
for (int i = 0; i < times; i++)
@@ -68,8 +71,8 @@ public class REITestPlugin implements REIPluginV0 {
}
public EntryStack transformStack(EntryStack stack) {
- stack.setAmount(random.nextInt(Byte.MAX_VALUE));
- stack.setting(EntryStack.Settings.CHECK_AMOUNT, EntryStack.Settings.TRUE);
+ CompoundTag tag = stack.getItemStack().getOrCreateTag();
+ tag.putInt("Whatever", random.nextInt(Integer.MAX_VALUE));
return stack;
}