diff options
Diffstat (limited to 'runtime/src/main/java')
76 files changed, 444 insertions, 615 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index 96a697253..de49c9a29 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -152,7 +152,7 @@ public class RoughlyEnoughItemsCoreClient { String type = object.getString(FavoriteEntry.TYPE_KEY); ResourceLocation id = new ResourceLocation(type); FavoriteEntryType<FavoriteEntry> entryType = FavoriteEntryType.registry().get(id); - if (entryType == null) return DataResult.error("Unknown favorite type: " + id + ", json: " + object); + if (entryType == null) return DataResult.error(() -> "Unknown favorite type: " + id + ", json: " + object); return entryType.read(object); }, "favoriteEntryFromJson"); ClientInternals.attachInstance((BiFunction<@Nullable Point, Collection<Tooltip.Entry>, Tooltip>) QueuedTooltip::impl, "tooltipProvider"); diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java index f76efdd65..b9d79cf83 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsNetwork.java @@ -104,7 +104,7 @@ public class RoughlyEnoughItemsNetwork { AbstractContainerMenu menu = player.containerMenu; ItemStack itemStack = buf.readItem(); ItemStack stack = itemStack.copy(); - if (!menu.getCarried().isEmpty() && ItemStack.isSameIgnoreDurability(menu.getCarried(), stack) && ItemStack.tagMatches(menu.getCarried(), stack)) { + if (!menu.getCarried().isEmpty() && ItemStack.isSameItemSameTags(menu.getCarried(), stack)) { stack.setCount(Mth.clamp(stack.getCount() + menu.getCarried().getCount(), 1, stack.getMaxStackSize())); } else if (!menu.getCarried().isEmpty()) { return; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java index 47253199a..9c185764e 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java @@ -70,7 +70,6 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import java.lang.reflect.InvocationTargetException; import java.time.LocalDateTime; import java.util.*; import java.util.function.Supplier; @@ -237,13 +236,7 @@ public class ClientHelperImpl implements ClientHelper { madeUpCommand = og.replaceAll("\\{player_name}", Minecraft.getInstance().player.getScoreboardName()).replaceAll("\\{item_name}", identifier.getPath()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", "").replaceAll("\\{count}", String.valueOf(cheatedStack.getCount())); Minecraft.getInstance().player.displayClientMessage(Component.translatable("text.rei.too_long_nbt"), false); } - try { - Class.forName("me.shedaniel.rei.impl.client.%s.CommandSenderImpl".formatted(Platform.isForge() ? "forge" : "fabric")) - .getDeclaredMethod("sendCommand", String.class) - .invoke(null, StringUtils.removeStart(madeUpCommand, "/")); - } catch (IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) { - throw new RuntimeException(e); - } + Minecraft.getInstance().player.connection.sendCommand(StringUtils.removeStart(madeUpCommand, "/")); return true; } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java index 25342ee31..c98745dcd 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/addon/ConfigAddonsScreen.java @@ -30,17 +30,21 @@ import me.shedaniel.rei.api.client.config.addon.ConfigAddon; import me.shedaniel.rei.api.client.config.addon.ConfigAddonRegistry; import me.shedaniel.rei.impl.client.gui.InternalTextures; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ComponentPath; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.navigation.FocusNavigationEvent; import net.minecraft.client.gui.screens.Screen; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; +import java.util.function.Supplier; public class ConfigAddonsScreen extends Screen { private AddonsList rulesList; @@ -56,9 +60,9 @@ public class ConfigAddonsScreen extends Screen { super.init(); { Component backText = Component.literal("↩ ").append(Component.translatable("gui.back")); - addRenderableWidget(new Button(4, 4, Minecraft.getInstance().font.width(backText) + 10, 20, backText, button -> { + addRenderableWidget(Button.builder(backText, button -> { minecraft.setScreen(parent); - })); + }).bounds(4, 4, Minecraft.getInstance().font.width(backText) + 10, 20).build()); } rulesList = addWidget(new AddonsList(minecraft, width, height, 30, height, BACKGROUND_LOCATION)); ConfigAddonRegistryImpl addonRegistry = (ConfigAddonRegistryImpl) ConfigAddonRegistry.getInstance(); @@ -82,22 +86,6 @@ public class ConfigAddonsScreen extends Screen { } @Override - publ |
