aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-04-17 15:53:35 +0800
committershedaniel <daniel@shedaniel.me>2020-04-17 15:53:55 +0800
commit8fd2f6ee7494b3623431319e4cc8056c4d6096d3 (patch)
treecfcaf77fc1d69efe324881c1b12fc662f59a3871
parent4cf2e712adbdc6f75be71e0d63ecced8042cee26 (diff)
downloadRoughlyEnoughItems-8fd2f6ee7494b3623431319e4cc8056c4d6096d3.tar.gz
RoughlyEnoughItems-8fd2f6ee7494b3623431319e4cc8056c4d6096d3.tar.bz2
RoughlyEnoughItems-8fd2f6ee7494b3623431319e4cc8056c4d6096d3.zip
No one have saw this coming
Signed-off-by: shedaniel <daniel@shedaniel.me>
-rw-r--r--.github/workflows/curseforge.yml2
-rwxr-xr-xbuild.gradle30
-rw-r--r--gradle.properties3
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java8
-rw-r--r--src/main/java/me/shedaniel/rei/api/EntryStack.java3
-rw-r--r--src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java31
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java36
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/BucketItemHooks.java35
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/ContainerScreenHooks.java51
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java37
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/RecipeBookGuiHooks.java49
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java9
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java11
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java8
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler.java10
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java5
-rwxr-xr-xsrc/main/resources/assets/roughlyenoughitems/.modassetroot0
-rwxr-xr-xsrc/main/resources/fabric.mod.json4
-rw-r--r--src/main/resources/icon.pngbin44764 -> 220223 bytes
-rw-r--r--src/main/resources/listeners.roughlyenoughitems.json17
-rw-r--r--src/main/resources/rei.aw12
21 files changed, 81 insertions, 280 deletions
diff --git a/.github/workflows/curseforge.yml b/.github/workflows/curseforge.yml
index e6898fdc6..d989c9780 100644
--- a/.github/workflows/curseforge.yml
+++ b/.github/workflows/curseforge.yml
@@ -16,6 +16,6 @@ jobs:
with:
java-version: 1.8
- name: Upload to CurseForge
- run: ./gradlew clean build curseforge --refresh-dependencies --stacktrace
+ run: ./gradlew clean build releaseOnCf --refresh-dependencies --stacktrace
env:
danielshe_curse_api_key: ${{ secrets.CF_API_KEY }}
diff --git a/build.gradle b/build.gradle
index 183fd95bd..9d8c75dae 100755
--- a/build.gradle
+++ b/build.gradle
@@ -21,6 +21,7 @@ version = forceVersion != "" ? forceVersion : project.mod_version
def includeDep = true
minecraft {
+ accessWidener = file("src/main/resources/rei.aw")
}
static def buildTime() {
@@ -111,6 +112,28 @@ task remapMavenJar(type: RemapJarTask, dependsOn: jar) {
}
}
+def releaseChangelog = "No changelog"
+
+task releaseOnCf {
+ def df = new SimpleDateFormat("yyyy-MM-dd HH:mm")
+ df.setTimeZone(TimeZone.getTimeZone("UTC"))
+ def currentBranch = "git rev-parse --abbrev-ref HEAD".execute().in.readLines().join('\n')
+ def time = df.format(new Date())
+ def changes = new StringBuilder()
+ changes << "<h2>REI v$project.version for $project.supported_version</h2>Updated at <b>$time</b>.<br><a href=\"https://www.github.com/shedaniel/RoughlyEnoughItems/commits/$currentBranch\">Click here for changelog</a>"
+ def proc = "git log --max-count=200 --pretty=format:\"%s\"".execute()
+ proc.in.eachLine { line ->
+ def processedLine = line.toString()
+ if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
+ changes << "<br>- $processedLine"
+ }
+ }
+ proc.waitFor()
+ releaseChangelog = changes.toString()
+ println(releaseChangelog)
+ dependsOn tasks.getByName("curseforge")
+}
+
curseforge {
if (project.hasProperty('danielshe_curse_api_key') || System.getenv('danielshe_curse_api_key') != null) {
apiKey = project.hasProperty('danielshe_curse_api_key') ? project.property('danielshe_curse_api_key') : System.getenv('danielshe_curse_api_key')
@@ -118,10 +141,7 @@ curseforge {
id = '310111'
releaseType = 'beta'
changelogType = "html"
- def df = new SimpleDateFormat("yyyy-MM-dd HH:mm")
- df.setTimeZone(TimeZone.getTimeZone("UTC"))
- def time = df.format(new Date())
- changelog = "<h2>REI v$project.version</h2>Updated at <b>$time</b>.<br><a href=\"https://gist.github.com/shedaniel/b7593e692319976f3349263208792922\">Click here for full changelog</a>"
+ changelog = releaseChangelog
addGameVersion '1.16-Snapshot'
addGameVersion 'Java 8'
addGameVersion 'Fabric'
@@ -131,7 +151,7 @@ curseforge {
embeddedLibrary 'cloth-config'
}
mainArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) {
- displayName = "[Fabric 20w14a] v$project.version"
+ displayName = "[Fabric $project.supported_version] v$project.version"
}
afterEvaluate {
uploadTask.dependsOn("remapJar")
diff --git a/gradle.properties b/gradle.properties
index 8b12c36db..9a0f1c073 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,5 @@
-mod_version=4.1.8-unstable
+mod_version=4.1.9-unstable
+supported_version=20w16a
minecraft_version=20w16a
yarn_version=20w16a+build.1
fabricloader_version=0.8.2+build.194
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 3632ca029..c5d12328b 100644
--- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -31,8 +31,6 @@ import me.shedaniel.rei.api.*;
import me.shedaniel.rei.api.plugins.REIPluginV0;
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;
@@ -200,7 +198,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
Screen currentScreen = MinecraftClient.getInstance().currentScreen;
if (currentScreen instanceof CraftingScreen) {
RecipeBookWidget recipeBookGui = ((RecipeBookProvider) currentScreen).getRecipeBookWidget();
- RecipeBookGhostSlots ghostSlots = ((RecipeBookGuiHooks) recipeBookGui).rei_getGhostSlots();
+ RecipeBookGhostSlots ghostSlots = recipeBookGui.ghostSlots;
ghostSlots.reset();
List<List<ItemStack>> input = Lists.newArrayList();
@@ -306,7 +304,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
ClothClientHooks.SYNC_RECIPES.register((minecraftClient, recipeManager, synchronizeRecipesS2CPacket) -> syncRecipes(lastSync));
ClothClientHooks.SCREEN_ADD_BUTTON.register((minecraftClient, screen, abstractButtonWidget) -> {
if (ConfigObject.getInstance().doesDisableRecipeBook() && screen instanceof HandledScreen && abstractButtonWidget instanceof TexturedButtonWidget)
- if (((RecipeBookButtonWidgetHooks) abstractButtonWidget).rei_getTexture().equals(recipeButtonTex))
+ if (((TexturedButtonWidget) abstractButtonWidget).texture.equals(recipeButtonTex))
return ActionResult.FAIL;
return ActionResult.PASS;
});
@@ -376,7 +374,7 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
ScreenHelper.getLastOverlay().lateRender(i, i1, v);
});
ClothClientHooks.SCREEN_KEY_PRESSED.register((minecraftClient, screen, i, i1, i2) -> {
- if (screen.getFocused() != null && screen.getFocused() instanceof TextFieldWidget || (screen.getFocused() instanceof RecipeBookWidget && ((RecipeBookGuiHooks) screen.getFocused()).rei_getSearchField() != null && ((RecipeBookGuiHooks) screen.getFocused()).rei_getSearchField().isFocused()))
+ if (screen.getFocused() != null && screen.getFocused() instanceof TextFieldWidget || (screen.getFocused() instanceof RecipeBookWidget && ((RecipeBookWidget) screen.getFocused()).searchField != null && ((RecipeBookWidget) screen.getFocused()).searchField.isFocused()))
return ActionResult.PASS;
if (shouldReturn(screen.getClass()))
return ActionResult.PASS;
diff --git a/src/main/java/me/shedaniel/rei/api/EntryStack.java b/src/main/java/me/shedaniel/rei/api/EntryStack.java
index d09054ff5..46c1dd5e0 100644
--- a/src/main/java/me/shedaniel/rei/api/EntryStack.java
+++ b/src/main/java/me/shedaniel/rei/api/EntryStack.java
@@ -31,7 +31,6 @@ import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.impl.EmptyEntryStack;
import me.shedaniel.rei.impl.FluidEntryStack;
import me.shedaniel.rei.impl.ItemEntryStack;
-import me.shedaniel.rei.listeners.BucketItemHooks;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.BucketItem;
@@ -140,7 +139,7 @@ public interface EntryStack {
throw new IllegalArgumentException("EntryStack must be item!");
Item item = stack.getItem();
if (item instanceof BucketItem)
- return EntryStack.create(((BucketItemHooks) item).getFluid(), 1000);
+ return EntryStack.create(((BucketItem) item).fluid, 1000);
return EntryStack.empty();
}
diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
index 7137f0a04..b96243123 100644
--- a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
+++ b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
@@ -40,7 +40,6 @@ import me.shedaniel.rei.impl.ClientHelperImpl;
import me.shedaniel.rei.impl.InternalWidgets;
import me.shedaniel.rei.impl.ScreenHelper;
import me.shedaniel.rei.impl.Weather;
-import me.shedaniel.rei.listeners.ContainerScreenHooks;
import me.shedaniel.rei.utils.CollectionUtils;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
@@ -307,7 +306,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds {
VillagerRecipeViewingScreen widget = (VillagerRecipeViewingScreen) MinecraftClient.getInstance().currentScreen;
return new Rectangle(widget.bounds.x, 3, widget.bounds.width, 18);
}
- return new Rectangle(((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getContainerLeft(), 3, ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getContainerWidth(), 18);
+ return new Rectangle(ScreenHelper.getLastHandledScreen().x, 3, ScreenHelper.getLastHandledScreen().backgroundWidth, 18);
}
return null;
}
@@ -376,7 +375,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds {
VillagerRecipeViewingScreen widget = (VillagerRecipeViewingScreen) MinecraftClient.getInstance().currentScreen;
return new Rectangle(widget.bounds.x, window.getScaledHeight() - 22, widget.bounds.width - widthRemoved, 18);
}
- return new Rectangle(((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getContainerLeft(), window.getScaledHeight() - 22, ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getContainerWidth() - widthRemoved, 18);
+ return new Rectangle(ScreenHelper.getLastHandledScreen().x, window.getScaledHeight() - 22, ScreenHelper.getLastHandledScreen().backgroundWidth - widthRemoved, 18);
}
private Rectangle getCraftableToggleArea() {
@@ -427,21 +426,21 @@ public class ContainerScreenOverlay extends WidgetWithBounds {
if (OverlaySearchField.isSearching) {
setZOffset(200);
if (MinecraftClient.getInstance().currentScreen instanceof HandledScreen) {
- ContainerScreenHooks hooks = (ContainerScreenHooks) MinecraftClient.getInstance().currentScreen;
- int left = hooks.rei_getContainerLeft(), top = hooks.rei_getContainerTop();
- for (Slot slot : ((HandledScreen<?>) MinecraftClient.getInstance().currentScreen).getScreenHandler().slots)
+ HandledScreen<?> handledScreen = (HandledScreen<?>) MinecraftClient.getInstance().currentScreen;
+ int x = handledScreen.x, y = handledScreen.y;
+ for (Slot slot : handledScreen.getScreenHandler().slots)
if (!slot.hasStack() || !ENTRY_LIST_WIDGET.canLastSearchTermsBeAppliedTo(EntryStack.create(slot.getStack())))
- fillGradient(left + slot.x, top + slot.y, left + slot.x + 16, top + slot.y + 16, -601874400, -601874400);
+ fillGradient(x + slot.x, y + slot.y, x + slot.x + 16, y + slot.y + 16, -601874400, -601874400);
}
setZOffset(0);
}
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.renderWidgets(mouseX, mouseY, delta);
if (MinecraftClient.getInstance().currentScreen instanceof HandledScreen && ConfigObject.getInstance().areClickableRecipeArrowsEnabled()) {
- ContainerScreenHooks hooks = (ContainerScreenHooks) MinecraftClient.getInstance().currentScreen;
+ HandledScreen<?> handledScreen = (HandledScreen<?>) MinecraftClient.getInstance().currentScreen;
for (RecipeHelper.ScreenClickArea area : RecipeHelper.getInstance().getScreenClickAreas())
if (area.getScreenClass().equals(MinecraftClient.getInstance().currentScreen.getClass()))
- if (area.getRectangle().contains(mouseX - hooks.rei_getContainerLeft(), mouseY - hooks.rei_getContainerTop())) {
+ if (area.getRectangle().contains(mouseX - handledScreen.x, mouseY - handledScreen.y)) {
String collect = CollectionUtils.mapAndJoinToString(area.getCategories(), identifier -> RecipeHelper.getInstance().getCategory(identifier).getCategoryName(), ", ");
TOOLTIPS.add(Tooltip.create(I18n.translate("text.rei.view_recipes_for", collect)));
break;
@@ -549,9 +548,11 @@ public class ContainerScreenOverlay extends WidgetWithBounds {
return true;
}
ItemStack itemStack = null;
- if (MinecraftClient.getInstance().currentScreen instanceof HandledScreen)
- if (((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getHoveredSlot() != null && !((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getHoveredSlot().getStack().isEmpty())
- itemStack = ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getHoveredSlot().getStack();
+ if (MinecraftClient.getInstance().currentScreen instanceof HandledScreen) {
+ HandledScreen<?> handledScreen = (HandledScreen<?>) MinecraftClient.getInstance().currentScreen;
+ if (handledScreen.focusedSlot != null && !handledScreen.focusedSlot.getStack().isEmpty())
+ itemStack = handledScreen.focusedSlot.getStack();
+ }
if (itemStack != null && !itemStack.isEmpty()) {
if (ConfigObject.getInstance().getRecipeKeybind().matchesKey(int_1, int_2))
return ClientHelper.getInstance().executeRecipeKeyBind(itemStack);
@@ -599,10 +600,10 @@ public class ContainerScreenOverlay extends WidgetWithBounds {
return true;
}
if (MinecraftClient.getInstance().currentScreen instanceof HandledScreen && ConfigObject.getInstance().areClickableRecipeArrowsEnabled()) {
- ContainerScreenHooks hooks = (ContainerScreenHooks) MinecraftClient.getInstance().currentScreen;
+ HandledScreen<?> handledScreen = (HandledScreen<?>) MinecraftClient.getInstance().currentScreen;
for (RecipeHelper.ScreenClickArea area : RecipeHelper.getInstance().getScreenClickAreas())
- if (area.getScreenClass().equals(MinecraftClient.getInstance().currentScreen.getClass()))
- if (area.getRectangle().contains(double_1 - hooks.rei_getContainerLeft(), double_2 - hooks.rei_getContainerTop())) {
+ if (area.getScreenClass().equals(handledScreen.getClass()))
+ if (area.getRectangle().contains(double_1 - handledScreen.x, double_2 - handledScreen.y)) {
ClientHelper.getInstance().executeViewAllRecipesFromCategories(Arrays.asList(area.getCategories()));
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
return true;
diff --git a/src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java b/src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java
deleted file mode 100644
index e65c41153..000000000
--- a/src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java
+++ /dev/null
@@ -1,36 +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.listeners;
-
-import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
-import org.jetbrains.annotations.ApiStatus;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@ApiStatus.Internal
-@Mixin(AbstractInventoryScreen.class)
-public interface AbstractInventoryScreenHooks {
- @Accessor("drawStatusEffects")
- boolean rei_doesOffsetGuiForEffects();
-}
diff --git a/src/main/java/me/shedaniel/rei/listeners/BucketItemHooks.java b/src/main/java/me/shedaniel/rei/listeners/BucketItemHooks.java
deleted file mode 100644
index 4092d2369..000000000
--- a/src/main/java/me/shedaniel/rei/listeners/BucketItemHooks.java
+++ /dev/null
@@ -1,35 +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.listeners;
-
-import net.minecraft.fluid.Fluid;
-import net.minecraft.item.BucketItem;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@Mixin(BucketItem.class)
-public interface BucketItemHooks {
- @Accessor("fluid")
- Fluid getFluid();
-}
diff --git a/src/main/java/me/shedaniel/rei/listeners/ContainerScreenHooks.java b/src/main/java/me/shedaniel/rei/listeners/ContainerScreenHooks.java
deleted file mode 100644
index bd1d9e538..000000000
--- a/src/main/java/me/shedaniel/rei/listeners/ContainerScreenHooks.java
+++ /dev/null
@@ -1,51 +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.listeners;
-
-import net.minecraft.client.gui.screen.ingame.HandledScreen;
-import net.minecraft.screen.slot.Slot;
-import org.jetbrains.annotations.ApiStatus;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@ApiStatus.Internal
-@Mixin(HandledScreen.class)
-public interface ContainerScreenHooks {
-
- @Accessor("x")
- int rei_getContainerLeft();
-
- @Accessor("y")
- int rei_getContainerTop();
-
- @Accessor("backgroundWidth")
- int rei_getContainerWidth();
-
- @Accessor("backgroundHeight")
- int rei_getContainerHeight();
-
- @Accessor("focusedSlot")
- Slot rei_getHoveredSlot();
-
-}
diff --git a/src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java b/src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java
deleted file mode 100644
index eee9ae33a..000000000
--- a/src/main/java/me/shedaniel/rei/listeners/RecipeBookButtonWidgetHooks.java
+++ /dev/null
@@ -1,37 +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.listeners;
-
-import net.minecraft.client.gui.widget.TexturedButtonWidget;
-import net.minecraft.util.Identifier;
-import org.jetbrains.annotations.ApiStatus;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-@ApiStatus.Internal
-@Mixin(TexturedButtonWidget.class)
-public interface RecipeBookButtonWidgetHooks {
- @Accessor("texture")
- Identifier rei_getTexture();
-}
diff --git a/src/main/java/me/shedaniel/rei/listeners/RecipeBookGuiHooks.java b/src/main/java/me/shedaniel/rei/listeners/RecipeBookGuiHooks.java
deleted file mode 100644
index 232238933..000000000
--- a/src/main/java/me/shedaniel/rei/listeners/RecipeBookGuiHooks.java
+++ /dev/null
@@ -1,49 +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.listeners;
-
-import net.minecraft.client.gui.screen.recipebook.RecipeBookGhostSlots;
-import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
-import net.minecraft.client.gui.screen.recipebook.RecipeGroupButtonWidget;
-import net.minecraft.client.gui.widget.TextFieldWidget;
-import org.jetbrains.annotations.ApiStatus;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-
-import java.util.List;
-
-@ApiStatus.Internal
-@Mixin(RecipeBookWidget.class)
-public interface RecipeBookGuiHooks {
-
- @Accessor("ghostSlots")
- RecipeBookGhostSlots rei_getGhostSlots();
-
- @Accessor("searchField")
- TextFieldWidget rei_getSearchField();
-
- @Accessor("tabButtons")
- List<RecipeGroupButtonWidget> rei_getTabButtons();
-
-}
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
index 065b8807b..bceaf5b23 100644
--- a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
@@ -31,15 +31,12 @@ import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.api.*;
import me.shedaniel.rei.api.plugins.REIPluginV0;
-import me.shedaniel.rei.api.subsets.SubsetsRegistry;
import me.shedaniel.rei.api.widgets.Panel;
import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.gui.RecipeViewingScreen;
import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
import me.shedaniel.rei.impl.ClientHelperImpl;
import me.shedaniel.rei.impl.RenderingEntry;
-import me.shedaniel.rei.impl.ScreenHelper;
-import me.shedaniel.rei.listeners.ContainerScreenHooks;
import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseCategory;
import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseDisplay;
import me.shedaniel.rei.plugin.blasting.DefaultBlastingDisplay;
@@ -305,13 +302,13 @@ public class DefaultPlugin implements REIPluginV0 {
@Override
public Rectangle getLeftBounds(HandledScreen<?> screen) {
- return new Rectangle(2, 0, ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getContainerLeft() - 4, MinecraftClient.getInstance().getWindow().getScaledHeight());
+ return new Rectangle(2, 0, screen.x - 4, screen.height);
}
@Override
public Rectangle getRightBounds(HandledScreen<?> screen) {
- int startX = ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getContainerLeft() + ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen()).rei_getContainerWidth() + 2;
- return new Rectangle(startX, 0, MinecraftClient.getInstance().getWindow().getScaledWidth() - startX - 2, MinecraftClient.getInstance().getWindow().getScaledHeight());
+ int startX = screen.x + screen.backgroundWidth + 2;
+ return new Rectangle(startX, 0, screen.width - startX - 2, screen.height);
}
@Override
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
index 931afa2b0..40b1d7b84 100644
--- a/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
@@ -26,10 +26,9 @@ package me.shedaniel.rei.plugin;
import com.google.common.collect.Ordering;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.impl.ScreenHelper;
-import me.shedaniel.rei.listeners.AbstractInventoryScreenHooks;
-import me.shedaniel.rei.listeners.ContainerScreenHooks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
+import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.entity.effect.StatusEffectInstance;
import java.util.ArrayList;
@@ -41,15 +40,15 @@ import java.util.function.Supplier;
public class DefaultPotionEffectExclusionZones implements Supplier<List<Rectangle>> {
@Override
public List<Rectangle> get() {
- if (!(ScreenHelper.getLastHandledScreen() instanceof AbstractInventoryScreen) || !((AbstractInventoryScreenHooks) ScreenHelper.getLastHandledScreen()).rei_doesOffsetGuiForEffects())
+ if (!(ScreenHelper.getLastHandledScreen() instanceof AbstractInventoryScreen) || !((AbstractInventoryScreen) ScreenHelper.getLastHandledScreen()).drawStatusEffects)
return Collections.emptyList();
Collection<StatusEffectInstance> activePotionEffects = MinecraftClient.getInstance().player.getStatusEffects();
if (activePotionEffects.isEmpty())
return Collections.emptyList();
- ContainerScreenHooks hooks = ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen());
+ HandledScreen<?> handledScreen = ScreenHelper.getLastHandledScreen();
List<Rectangle> list = new ArrayList<>();
- int x = hooks.rei_getContainerLeft() - 124;
- int y = hooks.rei_getContainerTop();
+ int x = handledScreen.x - 124;
+ int y = handledScreen.y;
int height = 33;
if (activePotionEffects.size() > 5)
height = 132 / (activePotionEffects.size() - 1);
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java b/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java
index 21966fa32..408a26c69 100644
--- a/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java
@@ -26,8 +26,8 @@ package me.shedaniel.rei.plugin;
import com.google.common.collect.Lists;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.impl.ScreenHelper;
-import me.shedaniel.rei.listeners.ContainerScreenHooks;
import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
import net.minecraft.client.recipebook.ClientRecipeBook;
import net.minecraft.screen.AbstractRecipeScreenHandler;
@@ -42,11 +42,11 @@ public class DefaultRecipeBookExclusionZones implements Supplier<List<Rectangle>
public List<Rectangle> get() {
if (!MinecraftClient.getInstance().player.getRecipeBook().isGuiOpen() || !(MinecraftClient.getInstance().currentScreen instanceof RecipeBookProvider) || !(ScreenHelper.getLastHandledScreen().getScreenHandler() instanceof AbstractRecipeScreenHandler))
return Collections.emptyList();
- ContainerScreenHooks screenHooks = ((ContainerScreenHooks) ScreenHelper.getLastHandledScreen());
- List<Rectangle> l = Lists.newArrayList(new Rectangle(screenHooks.rei_getContainerLeft() - 4 - 145, screenHooks.rei_getContainerTop(), 4 + 145 + 30, screenHooks.rei_getContainerHeight()));
+ HandledScreen<?> handledScreen = ScreenHelper.getLastHandledScreen();
+ List<Rectang