diff options
Diffstat (limited to 'src/main/java/me')
33 files changed, 302 insertions, 91 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 8866aab36..9ab33a147 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -16,6 +16,7 @@ import me.shedaniel.rei.gui.ContainerScreenOverlay; import me.shedaniel.rei.impl.*; import me.shedaniel.rei.listeners.RecipeBookButtonWidgetHooks; import me.shedaniel.rei.listeners.RecipeBookGuiHooks; +import me.shedaniel.rei.tests.plugin.REITestPlugin; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; import net.fabricmc.loader.api.FabricLoader; @@ -38,6 +39,7 @@ import net.minecraft.container.Slot; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.recipe.Ingredient; +import net.minecraft.recipe.RecipeManager; import net.minecraft.text.LiteralText; import net.minecraft.util.ActionResult; import net.minecraft.util.Identifier; @@ -207,24 +209,41 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { RoughlyEnoughItemsCore.LOGGER.error("[REI] Can't load REI plugins from %s: %s", reiPlugin.getClass(), e.getLocalizedMessage()); } } + + // Test Only + loadTestPlugins(); } @SuppressWarnings("deprecation") - private void registerClothEvents() { - final Identifier recipeButtonTex = new Identifier("textures/gui/recipe_button.png"); - AtomicLong lastSync = new AtomicLong(-1); - ClothClientHooks.SYNC_RECIPES.register((minecraftClient, recipeManager, synchronizeRecipesS2CPacket) -> { + private void loadTestPlugins() { + if (System.getProperty("rei.test", "false").equals("true")) { + registerPlugin(new REITestPlugin()); + } + } + + @Internal + @Deprecated + public static void syncRecipes(AtomicLong lastSync) { + if (lastSync != null) { if (lastSync.get() > 0 && System.currentTimeMillis() - lastSync.get() <= 5000) { RoughlyEnoughItemsCore.LOGGER.warn("[REI] Suppressing Sync Recipes!"); return; } lastSync.set(System.currentTimeMillis()); - if (ConfigManager.getInstance().getConfig().doesRegisterRecipesInAnotherThread()) { - CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RecipeHelper.getInstance()).recipesLoaded(recipeManager), SYNC_RECIPES); - } else { - ((RecipeHelperImpl) RecipeHelper.getInstance()).recipesLoaded(recipeManager); - } - }); + } + RecipeManager recipeManager = MinecraftClient.getInstance().getNetworkHandler().getRecipeManager(); + if (ConfigManager.getInstance().getConfig().doesRegisterRecipesInAnotherThread()) { + CompletableFuture.runAsync(() -> ((RecipeHelperImpl) RecipeHelper.getInstance()).recipesLoaded(recipeManager), SYNC_RECIPES); + } else { + ((RecipeHelperImpl) RecipeHelper.getInstance()).recipesLoaded(recipeManager); + } + } + + @SuppressWarnings("deprecation") + private void registerClothEvents() { + final Identifier recipeButtonTex = new Identifier("textures/gui/recipe_button.png"); + AtomicLong lastSync = new AtomicLong(-1); + ClothClientHooks.SYNC_RECIPES.register((minecraftClient, recipeManager, synchronizeRecipesS2CPacket) -> syncRecipes(lastSync)); ClothClientHooks.SCREEN_ADD_BUTTON.register((minecraftClient, screen, abstractButtonWidget) -> { if (ConfigManager.getInstance().getConfig().doesDisableRecipeBook() && screen instanceof AbstractContainerScreen && abstractButtonWidget instanceof TexturedButtonWidget) if (((RecipeBookButtonWidgetHooks) abstractButtonWidget).rei_getTexture().equals(recipeButtonTex)) diff --git a/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/src/main/java/me/shedaniel/rei/api/ConfigObject.java index 07770f9d1..f4c3539f6 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigObject.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -79,6 +79,8 @@ public interface ConfigObject { boolean doesRegisterRecipesInAnotherThread(); + boolean doesSnapToRows(); + @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface DontApplyFieldName { diff --git a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java index 4fe71b5e3..6c9f56fdd 100644 --- a/src/main/java/me/shedaniel/rei/api/EntryRegistry.java +++ b/src/main/java/me/shedaniel/rei/api/EntryRegistry.java @@ -44,7 +44,19 @@ public interface EntryRegistry { * @param afterEntry the stack to put after * @param stack the stack to register */ - void registerEntryAfter(EntryStack afterEntry, EntryStack stack); + default void registerEntryAfter(EntryStack afterEntry, EntryStack stack) { + registerEntryAfter(afterEntry, stack, true); + } + + /** + * Registers an new stack to the entry list + * + * @param afterEntry the stack to put after + * @param stack the stack to register + * @param checkAlreadyContains whether the list should check if it is already on the list + */ + @Deprecated + void registerEntryAfter(EntryStack afterEntry, EntryStack stack, boolean checkAlreadyContains); /** * Registers multiple stacks to the item list diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java index cfe5b520b..448f00d9e 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java @@ -206,6 +206,8 @@ public interface RecipeHelper { List<RecipeHelper.ScreenClickArea> getScreenClickAreas(); + boolean arePluginsLoading(); + interface ScreenClickArea { Class<? extends AbstractContainerScreen> getScreenClass(); diff --git a/src/main/java/me/shedaniel/rei/gui/ConfigReloadingScreen.java b/src/main/java/me/shedaniel/rei/gui/ConfigReloadingScreen.java new file mode 100644 index 000000000..d81678501 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/gui/ConfigReloadingScreen.java @@ -0,0 +1,53 @@ +package me.shedaniel.rei.gui; + +import me.shedaniel.rei.api.RecipeHelper; +import me.shedaniel.rei.api.annotations.Internal; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.resource.language.I18n; +import net.minecraft.client.util.NarratorManager; +import net.minecraft.util.Util; + +@Deprecated +@Internal +public class ConfigReloadingScreen extends Screen { + + private Screen parent; + + public ConfigReloadingScreen(Screen parent) { + super(NarratorManager.EMPTY); + this.parent = parent; + } + + @Override + public boolean shouldCloseOnEsc() { + return false; + } + + @Override + public void render(int int_1, int int_2, float float_1) { + this.renderDirtBackground(0); + if (!RecipeHelper.getInstance().arePluginsLoading()) + minecraft.openScreen(parent); + this.drawCenteredString(this.font, I18n.translate("text.rei.config.is.reloading"), this.width / 2, this.height / 2 - 50, 16777215); + String string_3; + switch ((int) (Util.getMeasuringTimeMs() / 300L % 4L)) { + case 0: + default: + string_3 = "O o o"; + break; + case 1: + case 3: + string_3 = "o O o"; + break; + case 2: + string_3 = "o o O"; + } + this.drawCenteredString(this.font, string_3, this.width / 2, this.height / 2 - 41, 8421504); + super.render(int_1, int_2, float_1); + } + + @Override + public boolean isPauseScreen() { + return false; + } +} diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java index 764d82d0e..904832392 100644 --- a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java +++ b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java @@ -22,7 +22,8 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.resource.language.I18n; @@ -174,7 +175,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds { @Override public void render(int mouseX, int mouseY, float delta) { super.render(mouseX, mouseY, delta); - GuiLighting.disable(); + DiffuseLighting.disable(); Rectangle bounds = getBounds(); if (ClientHelper.getInstance().isCheating() && RoughlyEnoughItemsCore.hasOperatorPermission()) { if (RoughlyEnoughItemsCore.hasPermissionToUsePackets()) @@ -251,7 +252,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds { @Override public void render(int mouseX, int mouseY, float delta) { super.render(mouseX, mouseY, delta); - GuiLighting.disable(); + DiffuseLighting.disable(); MinecraftClient.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); blit(getBounds().x + 3, getBounds().y + 3, weather.getId() * 14, 14, 14, 14); @@ -430,7 +431,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds { ENTRY_LIST_WIDGET.updateSearch(ScreenHelper.getSearchField().getText()); } if (OverlaySearchField.isSearching) { - GuiLighting.disable(); + DiffuseLighting.disable(); setBlitOffset(200); if (MinecraftClient.getInstance().currentScreen instanceof AbstractContainerScreen) { ContainerScreenHooks hooks = (ContainerScreenHooks) MinecraftClient.getInstance().currentScreen; @@ -442,7 +443,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds { setBlitOffset(0); } RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiLighting.disable(); + DiffuseLighting.disable(); this.renderWidgets(mouseX, mouseY, delta); if (MinecraftClient.getInstance().currentScreen instanceof AbstractContainerScreen && ConfigManager.getInstance().getConfig().areClickableRecipeArrowsEnabled()) { ContainerScreenHooks hooks = (ContainerScreenHooks) MinecraftClient.getInstance().currentScreen; @@ -505,10 +506,10 @@ public class ContainerScreenOverlay extends WidgetWithBounds { if (!ConfigManager.getInstance().getConfig().isEntryListWidgetScrolled()) buttonLeft.enabled = buttonRight.enabled = ENTRY_LIST_WIDGET.getTotalPages() != 1; widgets.forEach(widget -> { - GuiLighting.disable(); + DiffuseLighting.disable(); widget.render(int_1, int_2, float_1); }); - GuiLighting.disable(); + DiffuseLighting.disable(); } @Override @@ -529,7 +530,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds { } } for (Widget widget : widgets) - if (widget.mouseScrolled(i, j, amount)) + if (widget != ENTRY_LIST_WIDGET && widget.mouseScrolled(i, j, amount)) return true; return false; } diff --git a/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java b/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java index 1bb440936..b6bb8600c 100644 --- a/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java +++ b/src/main/java/me/shedaniel/rei/gui/OverlaySearchField.java @@ -10,7 +10,7 @@ import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.gui.widget.TextFieldWidget; import me.shedaniel.rei.impl.ScreenHelper; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.resource.language.I18n; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.util.InputUtil; @@ -30,7 +30,7 @@ public class OverlaySearchField extends TextFieldWidget { @SuppressWarnings("deprecation") public void laterRender(int int_1, int int_2, float float_1) { - GuiLighting.disable(); + DiffuseLighting.disable(); RenderSystem.disableDepthTest(); setEditableColor(ContainerScreenOverlay.getEntryListWidget().getAllStacks().isEmpty() && !getText().isEmpty() ? 16733525 : isSearching ? -852212 : (containsMouse(PointHelper.fromMouse()) || isFocused()) ? (ScreenHelper.isDarkModeEnabled() ? -17587 : -1) : -6250336); setSuggestion(!isFocused() && getText().isEmpty() ? I18n.translate("text.rei.search.field.suggestion") : null); diff --git a/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java index 6d36abacf..9becf4d21 100644 --- a/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java @@ -19,7 +19,7 @@ import me.shedaniel.rei.impl.ScreenHelper; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.resource.language.I18n; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.sound.SoundEvents; @@ -73,7 +73,7 @@ public class PreRecipeViewingScreen extends Screen { } super.render(int_1, int_2, float_1); this.widgets.forEach(widget -> { - GuiLighting.disable(); + DiffuseLighting.disable(); widget.render(int_1, int_2, float_1); }); } diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java index 8ff213334..1b42f991b 100644 --- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java @@ -17,7 +17,7 @@ import me.shedaniel.rei.utils.CollectionUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.resource.language.I18n; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.util.Window; @@ -27,6 +27,7 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; +import javax.annotation.Nullable; import java.util.*; import java.util.function.Supplier; @@ -46,6 +47,8 @@ public class RecipeViewingScreen extends Screen { public boolean choosePageActivated; public RecipeChoosePageWidget recipeChoosePageWidget; private Rectangle bounds; + @Nullable + private CategoryBaseWidget workingStationsBaseWidget; private RecipeCategory<RecipeDisplay> selectedCategory; private ButtonWidget recipeBack, recipeNext, categoryBack, categoryNext; @@ -67,6 +70,11 @@ public class RecipeViewingScreen extends Screen { this.choosePageActivated = false; } + @Nullable + public CategoryBaseWidget getWorkingStationsBaseWidget() { + return workingStationsBaseWidget; + } + @Override public boolean keyPressed(int int_1, int int_2, int int_3) { if (int_1 == 256 && choosePageActivated) { @@ -292,7 +300,8 @@ public class RecipeViewingScreen extends Screen { recipeChoosePageWidget = new RecipeChoosePageWidget(this, page, getTotalPages(selectedCategory)); else recipeChoosePageWidget = null; - + + workingStationsBaseWidget = null; List<List<EntryStack>> workingStations = RecipeHelper.getInstance().getWorkingStations(selectedCategory.getIdentifier()); if (!workingStations.isEmpty()) { int hh = MathHelper.floor((bounds.height - 16) / 18f); @@ -300,7 +309,7 @@ public class RecipeViewingScreen extends Screen { int innerWidth = MathHelper.ceil(workingStations.size() / ((float) hh)); int xx = bounds.x - (10 + innerWidth * 18) + 6; int yy = bounds.y + 16; - preWidgets.add(new CategoryBaseWidget(new Rectangle(xx - 6, yy - 6, 15 + innerWidth * 18, 11 + actualHeight * 18))); + preWidgets.add(workingStationsBaseWidget = new CategoryBaseWidget(new Rectangle(xx - 6, yy - 6, 15 + innerWidth * 18, 11 + actualHeight * 18))); int index = 0; List<String> list = Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("text.rei.working_station")); xx += (innerWidth - 1) * 18; @@ -364,7 +373,7 @@ public class RecipeViewingScreen extends Screen { public void render(int mouseX, int mouseY, float delta) { this.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); preWidgets.forEach(widget -> { - GuiLighting.disable(); + DiffuseLighting.disable(); widget.render(mouseX, mouseY, delta); }); if (selectedCategory != null) @@ -383,19 +392,19 @@ public class RecipeViewingScreen extends Screen { if (!tab.isSelected()) tab.render(mouseX, mouseY, delta); } - GuiLighting.disable(); + DiffuseLighting.disable(); super.render(mouseX, mouseY, delta); widgets.forEach(widget -> { - GuiLighting.disable(); + DiffuseLighting.disable(); widget.render(mouseX, mouseY, delta); }); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiLighting.disable(); + DiffuseLighting.disable(); for (TabWidget tab : tabs) { if (tab.isSelected()) tab.render(mouseX, mouseY, delta); } - GuiLighting.disable(); + DiffuseLighting.disable(); ScreenHelper.getLastOverlay().render(mouseX, mouseY, delta); ScreenHelper.getLastOverlay().lateRender(mouseX, mouseY, delta); if (choosePageActivated) { diff --git a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java index b6579bab8..d8e3094b3 100644 --- a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java @@ -24,7 +24,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexFormats; import net.minecraft.client.resource.language.I18n; @@ -350,10 +350,10 @@ public class VillagerRecipeViewingScreen extends Screen { this.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); int yOffset = 0; this.widgets.forEach(widget -> { - GuiLighting.disable(); + DiffuseLighting.disable(); widget.render(mouseX, mouseY, delta); }); - GuiLighting.disable(); + DiffuseLighting.disable(); ScreenHelper.getLastOverlay().render(mouseX, mouseY, delta); RenderSystem.pushMatrix(); ScissorsHandler.INSTANCE.scissor(new Rectangle(0, scrollListBounds.y + 1, width, scrollListBounds.height - 2)); @@ -361,14 +361,14 @@ public class VillagerRecipeViewingScreen extends Screen { ButtonWidget buttonWidget = buttonWidgets.get(i); buttonWidget.getBounds().y = scrollListBounds.y + 1 + yOffset - (int) scroll; if (buttonWidget.getBounds().getMaxY() > scrollListBounds.getMinY() && buttonWidget.getBounds().getMinY() < scrollListBounds.getMaxY()) { - GuiLighting.disable(); + DiffuseLighting.disable(); buttonWidget.render(mouseX, mouseY, delta); } yOffset += buttonWidget.getBounds().height; } for (int i = 0; i < buttonWidgets.size(); i++) { if (buttonWidgets.get(i).getBounds().getMaxY() > scrollListBounds.getMinY() && buttonWidgets.get(i).getBounds().getMinY() < scrollListBounds.getMaxY()) { - GuiLighting.disable(); + DiffuseLighting.disable(); recipeRenderers.get(i).setZ(1); recipeRenderers.get(i).render(buttonWidgets.get(i).getBounds(), mouseX, mouseY, delta); ScreenHelper.getLastOverlay().addTooltip(recipeRenderers.get(i).getTooltip(mouseX, mouseY)); @@ -387,7 +387,7 @@ public class VillagerRecipeViewingScreen extends Screen { boolean hovered = (new Rectangle(scrollbarPositionMinX, minY, scrollbarPositionMaxX - scrollbarPositionMinX, height)).contains(PointHelper.fromMouse()); float bottomC = (hovered ? .67f : .5f) * (ScreenHelper.isDarkModeEnabled() ? 0.8f : 1f); float topC = (hovered ? .87f : .67f) * (ScreenHelper.isDarkModeEnabled() ? 0.8f : 1f); - GuiLighting.disable(); + DiffuseLighting.disable(); RenderSystem.disableTexture(); RenderSystem.enableBlend(); RenderSystem.disableAlphaTest(); diff --git a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java index f9b35ea3e..8404d0244 100644 --- a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java +++ b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java @@ -12,7 +12,7 @@ import me.shedaniel.rei.gui.widget.EntryWidget; import me.shedaniel.rei.gui.widget.QueuedTooltip; import me.shedaniel.rei.utils.CollectionUtils; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.util.Identifier; import net.minecraft.util.Pair; import net.minecraft.util.math.MathHelper; @@ -95,7 +95,7 @@ public class SimpleRecipeEntry extends RecipeEntry { } xx = bounds.x + 4 + 18 * (getItemsPerLine() - 2); yy = bounds.y + getHeight() / 2 - 8; - GuiLighting.disable(); + DiffuseLighting.disable(); MinecraftClient.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); blit(xx, yy, 0, 28, 18, 18); xx += 18; diff --git a/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java index be56a10ef..6fb1dd874 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/CraftableToggleButtonWidget.java @@ -10,7 +10,7 @@ import me.shedaniel.math.api.Rectangle; import me.shedaniel.rei.api.ConfigManager; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.resource.language.I18n; import net.minecraft.item.ItemStack; @@ -33,14 +33,14 @@ public abstract class CraftableToggleButtonWidget extends ButtonWidget { } public void lateRender(int mouseX, int mouseY, float delta) { - GuiLighting.disable(); + DiffuseLighting.disable(); super.render(mouseX, mouseY, delta); this.itemRenderer.zOffset = getBlitOffset(); Rectangle bounds = getBounds(); this.itemRenderer.renderGuiItem(new ItemStack(Blocks.CRAFTING_TABLE), bounds.x + 2, bounds.y + 2); this.itemRenderer.zOffset = 0.0F; - GuiLighting.disable(); + DiffuseLighting.disable(); MinecraftClient.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); int color = ConfigManager.getInstance().isCraftableOnlyEnabled() ? 939579655 : 956235776; diff --git a/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java index c93698b4a..c3d93bf7e 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java @@ -21,7 +21,7 @@ import me.shedaniel.rei.impl.SearchArgument; import me.shedaniel.rei.utils.CollectionUtils; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; -import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexFormats; import net.minecraft.item.ItemGroup; @@ -40,6 +40,7 @@ import java.util.stream.Collectors; public class EntryListWidget extends WidgetWithBounds { + private static final boolean LAZY = true; private static final String SPACE = " ", EMPTY = ""; private static final Supplier<Boolean> RENDER_EXTRA_CONFIG = ConfigManager.getInstance().getConfig()::doesRenderEntryExtraOverlay; @SuppressWarnings("deprecation") @@ -56,6 +57,7 @@ public class EntryListWidget extends WidgetWithBounds { protected double scroll; protected long start; protected long duration; + protected int blockedCount; private Rectangle bounds, innerBounds; private List<EntryStack> allStacks = null; private List<EntryListEntry> entries = Collections.emptyList(); @@ -64,12 +66,7 @@ public class EntryListWidget extends WidgetWithBounds { private boolean draggingScrollBar = false; protecte |
