aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-runtime/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-09-09 17:08:36 +0800
committershedaniel <daniel@shedaniel.me>2020-09-09 17:08:36 +0800
commite3bbafaad49d15c7459ec0b38dd4268b4fd7e5ef (patch)
treeaad638798bc66a140ad6900fde438f5040952903 /RoughlyEnoughItems-runtime/src
parentafe32352abcef8d501acf7985d2e9b1f3fcb673e (diff)
downloadRoughlyEnoughItems-e3bbafaad49d15c7459ec0b38dd4268b4fd7e5ef.tar.gz
RoughlyEnoughItems-e3bbafaad49d15c7459ec0b38dd4268b4fd7e5ef.tar.bz2
RoughlyEnoughItems-e3bbafaad49d15c7459ec0b38dd4268b4fd7e5ef.zip
Get rid of mixins, turn EntryStack methods turn an ImmutableList instead of ArrayList
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-runtime/src')
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java12
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java12
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java43
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java3
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java2
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/FluidEntryStack.java6
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemEntryStack.java19
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemStackHook.java31
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java10
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/mixin/MixinItemStack.java48
-rw-r--r--RoughlyEnoughItems-runtime/src/main/resources/fabric.mod.json3
-rw-r--r--RoughlyEnoughItems-runtime/src/main/resources/mixin.roughlyenoughitems-runtime.json13
12 files changed, 65 insertions, 137 deletions
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java
index abad5ef0c..eea8a5e30 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java
@@ -25,10 +25,11 @@ package me.shedaniel.rei.gui.widget;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.math.Matrix4f;
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
+import it.unimi.dsi.fastutil.ints.IntSet;
import me.shedaniel.clothconfig2.ClothConfigInitializer;
import me.shedaniel.clothconfig2.api.ScissorsHandler;
import me.shedaniel.clothconfig2.api.ScrollingContainer;
@@ -62,16 +63,13 @@ import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import java.util.Set;
import java.util.concurrent.*;
-import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ApiStatus.Internal
public class EntryListWidget extends WidgetWithBounds {
- static final Supplier<Boolean> RENDER_ENCHANTMENT_GLINT = ConfigObject.getInstance()::doesRenderEntryEnchantmentGlint;
static final Comparator<? super EntryStack> ENTRY_NAME_COMPARER = Comparator.comparing(stack -> stack.asFormatStrippedText().getString());
static final Comparator<? super EntryStack> ENTRY_GROUP_COMPARER = Comparator.comparingInt(stack -> {
if (stack.getType() == EntryStack.Type.ITEM) {
@@ -436,7 +434,7 @@ public class EntryListWidget extends WidgetWithBounds {
this.lastSearchArguments = SearchArgument.processSearchTerm(searchTerm);
List<EntryStack> list = Lists.newArrayList();
boolean checkCraftable = ConfigManager.getInstance().isCraftableOnlyEnabled() && !ScreenHelper.inventoryStacks.isEmpty();
- Set<Integer> workingItems = checkCraftable ? Sets.newHashSet() : null;
+ IntSet workingItems = checkCraftable ? new IntOpenHashSet() : null;
if (checkCraftable)
workingItems.addAll(CollectionUtils.map(RecipeHelper.getInstance().findCraftableEntriesByItems(ScreenHelper.inventoryStacks), EntryStack::hashIgnoreAmount));
List<EntryStack> stacks = EntryRegistry.getInstance().getPreFilteredList();
@@ -450,7 +448,7 @@ public class EntryListWidget extends WidgetWithBounds {
if (canLastSearchTermsBeAppliedTo(stack)) {
if (workingItems != null && !workingItems.contains(stack.hashIgnoreAmount()))
continue;
- filtered.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
+ filtered.add(stack.rewrap().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE));
}
}
return filtered;
@@ -471,7 +469,7 @@ public class EntryListWidget extends WidgetWithBounds {
if (canLastSearchTermsBeAppliedTo(stack)) {
if (workingItems != null && !workingItems.contains(stack.hashIgnoreAmount()))
continue;
- list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
+ list.add(stack.rewrap().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE));
}
}
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java
index a09d01e96..cb9171296 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/FavoritesListWidget.java
@@ -24,8 +24,9 @@
package me.shedaniel.rei.gui.widget;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
import com.mojang.blaze3d.vertex.PoseStack;
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
+import it.unimi.dsi.fastutil.ints.IntSet;
import me.shedaniel.clothconfig2.ClothConfigInitializer;
import me.shedaniel.clothconfig2.api.ScissorsHandler;
import me.shedaniel.clothconfig2.api.ScrollingContainer;
@@ -51,7 +52,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -199,14 +199,14 @@ public class FavoritesListWidget extends WidgetWithBounds {
if (ConfigObject.getInstance().doSearchFavorites()) {
List<EntryStack> list = Lists.newArrayList();
boolean checkCraftable = ConfigManager.getInstance().isCraftableOnlyEnabled() && !ScreenHelper.inventoryStacks.isEmpty();
- Set<Integer> workingItems = checkCraftable ? Sets.newHashSet() : null;
+ IntSet workingItems = checkCraftable ? new IntOpenHashSet() : null;
if (checkCraftable)
workingItems.addAll(CollectionUtils.map(RecipeHelper.getInstance().findCraftableEntriesByItems(ScreenHelper.inventoryStacks), EntryStack::hashIgnoreAmount));
for (EntryStack stack : ConfigObject.getInstance().getFavorites()) {
if (listWidget.canLastSearchTermsBeAppliedTo(stack)) {
if (checkCraftable && !workingItems.contains(stack.hashIgnoreAmount()))
continue;
- list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
+ list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE));
}
}
EntryPanelOrdering ordering = ConfigObject.getInstance().getItemListOrdering();
@@ -220,13 +220,13 @@ public class FavoritesListWidget extends WidgetWithBounds {
} else {
List<EntryStack> list = Lists.newArrayList();
boolean checkCraftable = ConfigManager.getInstance().isCraftableOnlyEnabled() && !ScreenHelper.inventoryStacks.isEmpty();
- Set<Integer> workingItems = checkCraftable ? Sets.newHashSet() : null;
+ IntSet workingItems = checkCraftable ? new IntOpenHashSet() : null;
if (checkCraftable)
workingItems.addAll(CollectionUtils.map(RecipeHelper.getInstance().findCraftableEntriesByItems(ScreenHelper.inventoryStacks), EntryStack::hashIgnoreAmount));
for (EntryStack stack : ConfigObject.getInstance().getFavorites()) {
if (checkCraftable && !workingItems.contains(stack.hashIgnoreAmount()))
continue;
- list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
+ list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE));
}
EntryPanelOrdering ordering = ConfigObject.getInstance().getItemListOrdering();
if (ordering == EntryPanelOrdering.NAME)
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java
index 91907294d..2f182ab35 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java
@@ -23,31 +23,50 @@
package me.shedaniel.rei.impl;
-import it.unimi.dsi.fastutil.objects.Reference2ObjectMaps;
-import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectMaps;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
import me.shedaniel.rei.api.EntryStack;
import net.minecraft.client.gui.GuiComponent;
import org.jetbrains.annotations.ApiStatus;
-import java.util.Map;
-
@ApiStatus.Internal
public abstract class AbstractEntryStack extends GuiComponent implements EntryStack {
- private static final Map<Settings<?>, Object> EMPTY_SETTINGS = Reference2ObjectMaps.emptyMap();
- private Map<Settings<?>, Object> settings = null;
+ private static final Short2ObjectMap<Object> EMPTY_SETTINGS = Short2ObjectMaps.emptyMap();
+ private Short2ObjectMap<Object> settings = null;
@Override
public <T> EntryStack setting(Settings<T> settings, T value) {
+ short settingsId = settings.getId();
if (this.settings == null)
- this.settings = new Reference2ObjectOpenHashMap<>(4);
- this.settings.put(settings, value);
+ this.settings = Short2ObjectMaps.singleton(settingsId, value);
+ else {
+ if (this.settings.size() == 1) {
+ if (this.settings.containsKey(settingsId)) {
+ this.settings = Short2ObjectMaps.singleton(settingsId, value);
+ return this;
+ } else {
+ Short2ObjectMap<Object> singletonSettings = this.settings;
+ this.settings = new Short2ObjectOpenHashMap<>(4, 1);
+ this.settings.putAll(singletonSettings);
+ }
+ }
+ this.settings.put(settingsId, value);
+ }
return this;
}
@Override
public <T> EntryStack removeSetting(Settings<T> settings) {
- if (this.settings != null && this.settings.remove(settings) != null && this.settings.isEmpty()) {
- this.settings = null;
+ if (this.settings != null) {
+ short settingsId = settings.getId();
+ if (this.settings.size() == 1) {
+ if (this.settings.containsKey(settingsId)) {
+ this.settings = null;
+ }
+ } else if (this.settings.remove(settingsId) != null && this.settings.isEmpty()) {
+ this.settings = null;
+ }
}
return this;
}
@@ -58,13 +77,13 @@ public abstract class AbstractEntryStack extends GuiComponent implements EntrySt
return this;
}
- protected Map<Settings<?>, Object> getSettings() {
+ protected Short2ObjectMap<Object> getSettings() {
return this.settings == null ? EMPTY_SETTINGS : this.settings;
}
@Override
public <T> T get(Settings<T> settings) {
- Object o = this.settings == null ? null : this.settings.get(settings);
+ Object o = this.settings == null ? null : this.settings.get(settings.getId());
if (o == null)
return settings.getDefaultValue();
return (T) o;
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java
index b9dff2dae..1037f6ac4 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java
@@ -106,7 +106,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
@Override
public boolean doesRenderEntryEnchantmentGlint() {
- return advanced.miscellaneous.renderEntryEnchantmentGlint;
+ return true;
}
@Override
@@ -464,7 +464,6 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData {
public static class Miscellaneous {
@Comment("Declares whether arrows in containers should be clickable.") private boolean clickableRecipeArrows = true;
private boolean registerRecipesInAnotherThread = true;
- @Comment("Whether REI should render entry's enchantment glint") private boolean renderEntryEnchantmentGlint = true;
private boolean newFastEntryRendering = true;
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java
index a96f7ead8..0ccb380b3 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java
@@ -78,7 +78,7 @@ public class EntryRegistryImpl implements EntryRegistry {
@Override
@NotNull
public Stream<EntryStack> getEntryStacks() {
- return entries.stream();
+ return reloading ? reloadingRegistry.stream().map(AmountIgnoredEntryStackWrapper::unwrap) : entries.stream();
}
@Override
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/FluidEntryStack.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/FluidEntryStack.java
index 65019ba8b..2d777869e 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/FluidEntryStack.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/FluidEntryStack.java
@@ -29,6 +29,7 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.math.Matrix4f;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.ClientHelper;
@@ -55,7 +56,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
@@ -124,8 +124,8 @@ public class FluidEntryStack extends AbstractEntryStack {
@Override
public EntryStack copy() {
EntryStack stack = EntryStack.create(fluid, amount);
- for (Map.Entry<Settings<?>, Object> entry : getSettings().entrySet()) {
- stack.setting((Settings<? super Object>) entry.getKey(), entry.getValue());
+ for (Short2ObjectMap.Entry<Object> entry : getSettings().short2ObjectEntrySet()) {
+ stack.setting(EntryStack.Settings.getById(entry.getShortKey()), entry.getValue());
}
return stack;
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemEntryStack.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemEntryStack.java
index 0e3e17d89..f59746214 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemEntryStack.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemEntryStack.java
@@ -30,6 +30,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import it.unimi.dsi.fastutil.objects.ReferenceSet;
+import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.ClientHelper;
@@ -61,7 +62,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
@@ -110,9 +110,18 @@ public class ItemEntryStack extends AbstractEntryStack implements OptimalEntrySt
@Override
public EntryStack copy() {
- EntryStack stack = EntryStack.create(getItemStack().copy());
- for (Map.Entry<Settings<?>, Object> entry : getSettings().entrySet()) {
- stack.setting((Settings<? super Object>) entry.getKey(), entry.getValue());
+ EntryStack stack = EntryStack.create(itemStack.copy());
+ for (Short2ObjectMap.Entry<Object> entry : getSettings().short2ObjectEntrySet()) {
+ stack.setting(EntryStack.Settings.getById(entry.getShortKey()), entry.getValue());
+ }
+ return stack;
+ }
+
+ @Override
+ public EntryStack rewrap() {
+ EntryStack stack = EntryStack.create(itemStack);
+ for (Short2ObjectMap.Entry<Object> entry : getSettings().short2ObjectEntrySet()) {
+ stack.setting(EntryStack.Settings.getById(entry.getShortKey()), entry.getValue());
}
return stack;
}
@@ -358,13 +367,11 @@ public class ItemEntryStack extends AbstractEntryStack implements OptimalEntrySt
public void optimisedRenderBase(PoseStack matrices, MultiBufferSource.BufferSource immediate, Rectangle bounds, int mouseX, int mouseY, float delta) {
if (!isEmpty() && get(Settings.RENDER).get()) {
ItemStack stack = getItemStack();
- ((ItemStackHook) (Object) stack).rei_setRenderEnchantmentGlint(get(Settings.Item.RENDER_ENCHANTMENT_GLINT).get());
matrices.pushPose();
matrices.translate(bounds.getCenterX(), bounds.getCenterY(), 100.0F + getZ());
matrices.scale(bounds.getWidth(), (bounds.getWidth() + bounds.getHeight()) / -2f, bounds.getHeight());
Minecraft.getInstance().getItemRenderer().render(stack, ItemTransforms.TransformType.GUI, false, matrices, immediate, 15728880, OverlayTexture.NO_OVERLAY, getModelFromStack(stack));
matrices.popPose();
- ((ItemStackHook) (Object) stack).rei_setRenderEnchantmentGlint(false);
}
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemStackHook.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemStackHook.java
deleted file mode 100644
index bbcc4bb12..000000000
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ItemStackHook.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020 shedaniel
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package me.shedaniel.rei.impl;
-
-import org.jetbrains.annotations.ApiStatus;
-
-@ApiStatus.Internal
-public interface ItemStackHook {
- void rei_setRenderEnchantmentGlint(boolean b);
-}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
index 4d78312ed..5dd8ade09 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
@@ -309,7 +309,7 @@ public class RecipeHelperImpl implements RecipeHelper {
private void startSection(MutablePair<Stopwatch, String> sectionData, String section) {
sectionData.setRight(section);
RoughlyEnoughItemsCore.LOGGER.debug("Reloading Section: \"%s\"", section);
- sectionData.getLeft().start();
+ sectionData.getLeft().reset().start();
}
private void endSection(MutablePair<Stopwatch, String> sectionData) {
@@ -321,13 +321,13 @@ public class RecipeHelperImpl implements RecipeHelper {
private void pluginSection(MutablePair<Stopwatch, String> sectionData, String sectionName, List<REIPluginV0> list, Consumer<REIPluginV0> consumer) {
for (REIPluginV0 plugin : list) {
+ startSection(sectionData, sectionName + " for " + plugin.getPluginIdentifier().toString());
try {
- startSection(sectionData, sectionName + " for " + plugin.getPluginIdentifier().toString());
consumer.accept(plugin);
- endSection(sectionData);
} catch (Throwable e) {
RoughlyEnoughItemsCore.LOGGER.error(plugin.getPluginIdentifier().toString() + " plugin failed to " + sectionName + "!", e);
}
+ endSection(sectionData);
}
}
@@ -378,16 +378,16 @@ public class RecipeHelperImpl implements RecipeHelper {
List<REIPluginV0> reiPluginV0s = new ArrayList<>();
endSection(sectionData);
for (REIPluginEntry plugin : plugins) {
+ startSection(sectionData, "pre-register for " + plugin.getPluginIdentifier().toString());
try {
if (plugin instanceof REIPluginV0) {
- startSection(sectionData, "pre-register for " + plugin.getPluginIdentifier().toString());
((REIPluginV0) plugin).preRegister();
reiPluginV0s.add((REIPluginV0) plugin);
- endSection(sectionData);
}
} catch (Throwable e) {
RoughlyEnoughItemsCore.LOGGER.error(plugin.getPluginIdentifier().toString() + " plugin failed to pre register!", e);
}
+ endSection(sectionData);
}
pluginSection(sectionData, "register-bounds", reiPluginV0s, plugin -> plugin.registerBounds(displayHelper));
pluginSection(sectionData, "register-entries", reiPluginV0s, plugin -> plugin.registerEntries(entryRegistry));
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/mixin/MixinItemStack.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/mixin/MixinItemStack.java
deleted file mode 100644
index 33d015883..000000000
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/mixin/MixinItemStack.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020 shedaniel
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package me.shedaniel.rei.mixin;
-
-import me.shedaniel.rei.impl.ItemStackHook;
-import net.minecraft.world.item.ItemStack;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-@Mixin(ItemStack.class)
-public class MixinItemStack implements ItemStackHook {
- private boolean rei_dontRenderOverlay = false;
-
- @Override
- public void rei_setRenderEnchantmentGlint(boolean b) {
- rei_dontRenderOverlay = !b;
- }
-
- @Inject(method = "hasFoil", at = @At("HEAD"), cancellable = true)
- public void hasEnchantmentGlint(CallbackInfoReturnable<Boolean> callbackInfo) {
- if (rei_dontRenderOverlay)
- callbackInfo.setReturnValue(false);
- }
-
-}
diff --git a/RoughlyEnoughItems-runtime/src/main/resources/fabric.mod.json b/RoughlyEnoughItems-runtime/src/main/resources/fabric.mod.json
index dfe977c13..d6cfac072 100644
--- a/RoughlyEnoughItems-runtime/src/main/resources/fabric.mod.json
+++ b/RoughlyEnoughItems-runtime/src/main/resources/fabric.mod.json
@@ -30,9 +30,6 @@
"me.shedaniel.rei.gui.plugin.DefaultRuntimePlugin"
]
},
- "mixins": [
- "mixin.roughlyenoughitems-runtime.json"
- ],
"accessWidener": "roughlyenoughitems-runtime.accessWidener",
"custom": {
"modmenu:parent": "roughlyenoughitems",
diff --git a/RoughlyEnoughItems-runtime/src/main/resources/mixin.roughlyenoughitems-runtime.json b/RoughlyEnoughItems-runtime/src/main/resources/mixin.roughlyenoughitems-runtime.json
deleted file mode 100644
index 337db0c3f..000000000
--- a/RoughlyEnoughItems-runtime/src/main/resources/mixin.roughlyenoughitems-runtime.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "required": true,
- "package": "me.shedaniel.rei.mixin",
- "minVersion": "0.7.11",
- "compatibilityLevel": "JAVA_8",
- "mixins": [],
- "client": [
- "MixinItemStack"
- ],
- "injectors": {
- "defaultRequire": 1
- }
-}