diff options
| author | shedaniel <daniel@shedaniel.me> | 2024-04-25 22:29:22 +0900 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-04-25 22:29:22 +0900 |
| commit | d372f03dbec88fedb9e0e3cffb766c2bb3b0f8a4 (patch) | |
| tree | 0109ba9dace1b1ae12fa996bb292abca5be20a3b | |
| parent | 1a86c46219b873313085ba384903b1077c832c4e (diff) | |
| download | RoughlyEnoughItems-d372f03dbec88fedb9e0e3cffb766c2bb3b0f8a4.tar.gz RoughlyEnoughItems-d372f03dbec88fedb9e0e3cffb766c2bb3b0f8a4.tar.bz2 RoughlyEnoughItems-d372f03dbec88fedb9e0e3cffb766c2bb3b0f8a4.zip | |
Update to 1.20.5
13 files changed, 73 insertions, 41 deletions
diff --git a/build.gradle b/build.gradle index 802cc28d4..ec27f7dba 100755 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ subprojects { tasks.withType(JavaCompile) { options.encoding = "UTF-8" - options.release = 17 + options.release = 21 } } diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java index e43ee532e..a651dbc4d 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java @@ -363,8 +363,9 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin }); if (Platform.isFabric()) { Set<Holder<Potion>> potions = Collections.newSetFromMap(new LinkedTreeMap<>(Comparator.comparing(Holder::getRegisteredName), false)); - for (Ingredient container : PotionBrewing.ALLOWED_CONTAINERS) { - for (PotionBrewing.Mix<Potion> mix : PotionBrewing.POTION_MIXES) { + PotionBrewing brewing = Minecraft.getInstance().level.potionBrewing(); + for (Ingredient container : brewing.containers) { + for (PotionBrewing.Mix<Potion> mix : brewing.potionMixes) { Holder<Potion> from = mix.from(); Ingredient ingredient = mix.ingredient(); Holder<Potion> to = mix.to(); @@ -381,7 +382,7 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin } } for (Holder<Potion> potion : potions) { - for (PotionBrewing.Mix<Item> mix : PotionBrewing.CONTAINER_MIXES) { + for (PotionBrewing.Mix<Item> mix : brewing.containerMixes) { Holder<Item> from = mix.from(); Ingredient ingredient = mix.ingredient(); Holder<Item> to = mix.to(); @@ -405,8 +406,8 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin Tier tier = tieredItem.getTier(); repairMaterialBase = EntryIngredients.ofIngredient(tier.getRepairIngredient()); } else if (item instanceof ArmorItem armorItem) { - ArmorMaterial material = armorItem.getMaterial(); - repairMaterialBase = EntryIngredients.ofIngredient(material.getRepairIngredient()); + Holder<ArmorMaterial> material = armorItem.getMaterial(); + repairMaterialBase = EntryIngredients.ofIngredient(material.value().repairIngredient().get()); } else if (item instanceof ShieldItem shieldItem) { repairMaterialBase = EntryIngredients.ofItemTag(ItemTags.PLANKS); repairMaterialBase.filter(s -> shieldItem.isValidRepairItem(stack, s.castValue())); @@ -417,7 +418,7 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin if (repairMaterialBase == null || repairMaterialBase.isEmpty()) continue; for (int[] i = {1}; i[0] <= 4; i[0]++) { ItemStack baseStack = item.getDefaultInstance(); - int toRepair = i[0] == 4 ? item.getMaxDamage() : baseStack.getMaxDamage() / 4 * i[0]; + int toRepair = i[0] == 4 ? baseStack.getMaxDamage() : baseStack.getMaxDamage() / 4 * i[0]; baseStack.setDamageValue(toRepair); EntryIngredient repairMaterial = repairMaterialBase.map(s -> { EntryStack<?> newStack = s.copy(); diff --git a/fabric/build.gradle b/fabric/build.gradle index 23876b07e..02676a865 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" + id "com.github.johnrengelman.shadow" version "8.1.1" } architectury { @@ -141,7 +141,7 @@ unifiedPublishing { curseforge { token = project.hasProperty("danielshe_curse_api_key") ? project.property("danielshe_curse_api_key") : System.getenv("danielshe_curse_api_key") id = "310111" - gameVersions.addAll "Java 17", "1.20.5-Snapshot"//, project.minecraft_version + gameVersions.addAll "Java 17", project.minecraft_version } } diff --git a/fabric/src/main/resources/roughlyenoughitems.accessWidener b/fabric/src/main/resources/roughlyenoughitems.accessWidener index 6144ef3b9..2430ce5b4 100644 --- a/fabric/src/main/resources/roughlyenoughitems.accessWidener +++ b/fabric/src/main/resources/roughlyenoughitems.accessWidener @@ -14,9 +14,9 @@ accessible field net/minecraft/client/gui/screens/recipebook/RecipeBookCompo accessible field net/minecraft/client/StringSplitter widthProvider Lnet/minecraft/client/StringSplitter$WidthProvider; accessible field net/minecraft/nbt/CompoundTag tags Ljava/util/Map; accessible field net/minecraft/world/entity/player/Inventory compartments Ljava/util/List; -accessible field net/minecraft/world/item/alchemy/PotionBrewing ALLOWED_CONTAINERS Ljava/util/List; -accessible field net/minecraft/world/item/alchemy/PotionBrewing CONTAINER_MIXES Ljava/util/List; -accessible field net/minecraft/world/item/alchemy/PotionBrewing POTION_MIXES Ljava/util/List; +accessible field net/minecraft/world/item/alchemy/PotionBrewing containers Ljava/util/List; +accessible field net/minecraft/world/item/alchemy/PotionBrewing containerMixes Ljava/util/List; +accessible field net/minecraft/world/item/alchemy/PotionBrewing potionMixes Ljava/util/List; accessible method net/minecraft/client/gui/GuiGraphics innerBlit (Lnet/minecraft/resources/ResourceLocation;IIIIIFFFF)V accessible method net/minecraft/client/gui/screens/Screen init ()V accessible method net/minecraft/client/gui/screens/Screen insertText (Ljava/lang/String;Z)V diff --git a/forge/build.gradle b/forge/build.gradle index bd7d55a65..33df86eb4 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" + id "com.github.johnrengelman.shadow" version "8.1.1" } architectury { diff --git a/gradle.properties b/gradle.properties index f87ec1b05..6ecca1199 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,16 @@ org.gradle.jvmargs=-Xmx6G base_version=15.0 -unstable=true -supported_version=1.20.5 (24w14a) -minecraft_version=24w14a +unstable=false +supported_version=1.20.5 +minecraft_version=1.20.5 platforms=fabric,neoforge forge_version=49.0.3 -neoforge_version=20.5.0-alpha.24w14a.20240408.221956 -neoforge_pr=787 -fabricloader_version=0.15.9 -cloth_config_version=14.0.125 +neoforge_version=20.5.3-beta +neoforge_pr= +fabricloader_version=0.15.10 +cloth_config_version=14.0.126 modmenu_version=7.0.0 -fabric_api=0.96.14+1.20.5 -architectury_version=12.0.24-beta +fabric_api=0.97.6+1.20.5 +architectury_version=12.0.26 api_exculde= #api_include=me.shedaniel.cloth:cloth-events,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u,org.jetbrains:annotations,net.fabricmc.fabric-api:fabric diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 7869466cd..6f5b97cbf 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" + id "com.github.johnrengelman.shadow" version "8.1.1" } architectury { diff --git a/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java b/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java index e379ff5a8..3131c2658 100644 --- a/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java +++ b/neoforge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java @@ -27,6 +27,7 @@ import com.google.gson.internal.LinkedTreeMap; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.plugin.client.BuiltinClientPlugin; import me.shedaniel.rei.plugin.client.DefaultClientPlugin; +import net.minecraft.client.Minecraft; import net.minecraft.core.Holder; import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.Item; @@ -36,9 +37,7 @@ import net.minecraft.world.item.alchemy.PotionBrewing; import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.crafting.Ingredient; import net.neoforged.neoforge.common.brewing.BrewingRecipe; -import net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry; import net.neoforged.neoforge.common.brewing.IBrewingRecipe; -import net.neoforged.neoforge.common.brewing.VanillaBrewingRecipe; import java.util.Arrays; import java.util.Collections; @@ -48,20 +47,20 @@ import java.util.Set; public class DefaultClientPluginImpl extends DefaultClientPlugin { @Override public void registerForgePotions(DisplayRegistry registry, BuiltinClientPlugin clientPlugin) { - for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) { - if (recipe instanceof VanillaBrewingRecipe) { - registerVanillaPotions(registry, clientPlugin); - } else if (recipe instanceof BrewingRecipe) { + PotionBrewing brewing = Minecraft.getInstance().level.potionBrewing(); + registerVanillaPotions(brewing, registry, clientPlugin); + for (IBrewingRecipe recipe : brewing.getRecipes()) { + if (recipe instanceof BrewingRecipe) { BrewingRecipe brewingRecipe = (BrewingRecipe) recipe; clientPlugin.registerBrewingRecipe(brewingRecipe.getInput(), brewingRecipe.getIngredient(), brewingRecipe.getOutput().copy()); } } } - private static void registerVanillaPotions(DisplayRegistry registry, BuiltinClientPlugin clientPlugin) { + private static void registerVanillaPotions(PotionBrewing brewing, DisplayRegistry registry, BuiltinClientPlugin clientPlugin) { Set<Holder<Potion>> potions = Collections.newSetFromMap(new LinkedTreeMap<>(Comparator.comparing(Holder::getRegisteredName), false)); - for (Ingredient container : PotionBrewing.ALLOWED_CONTAINERS) { - for (PotionBrewing.Mix<Potion> mix : PotionBrewing.POTION_MIXES) { + for (Ingredient container : brewing.containers) { + for (PotionBrewing.Mix<Potion> mix : brewing.potionMixes) { Holder<Potion> from = mix.from(); Ingredient ingredient = mix.ingredient; Holder<Potion> to = mix.to(); @@ -78,7 +77,7 @@ public class DefaultClientPluginImpl extends DefaultClientPlugin { } } for (Holder<Potion> potion : potions) { - for (PotionBrewing.Mix<Item> mix : PotionBrewing.CONTAINER_MIXES) { + for (PotionBrewing.Mix<Item> mix : brewing.containerMixes) { Holder<Item> from = mix.from(); Ingredient ingredient = mix.ingredient(); Holder<Item> to = mix.to(); diff --git a/neoforge/src/main/resources/META-INF/accesstransformer.cfg b/neoforge/src/main/resources/META-INF/accesstransformer.cfg index d3cd4b3a0..d1b35d717 100644 --- a/neoforge/src/main/resources/META-INF/accesstransformer.cfg +++ b/neoforge/src/main/resources/META-INF/accesstransformer.cfg @@ -14,9 +14,9 @@ public net.minecraft.client.gui.screens.recipebook.RecipeBookComponent tabButton public net.minecraft.client.StringSplitter widthProvider public net.minecraft.nbt.CompoundTag tags public net.minecraft.world.entity.player.Inventory compartments -public net.minecraft.world.item.alchemy.PotionBrewing ALLOWED_CONTAINERS -public net.minecraft.world.item.alchemy.PotionBrewing CONTAINER_MIXES -public net.minecraft.world.item.alchemy.PotionBrewing POTION_MIXES +public net.minecraft.world.item.alchemy.PotionBrewing containers +public net.minecraft.world.item.alchemy.PotionBrewing containerMixes +public net.minecraft.world.item.alchemy.PotionBrewing potionMixes public net.minecraft.world.item.alchemy.PotionBrewing$Mix from public net.minecraft.world.item.alchemy.PotionBrewing$Mix ingredient public net.minecraft.world.item.alchemy.PotionBrewing$Mix to diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java index 72881c62e..5f95d3417 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/REIConfigScreen.java @@ -138,7 +138,7 @@ public class REIConfigScreen extends Screen implements ConfigAccess { if (this.searching) { this.widgets.add(Widgets.createButton(new Rectangle(8, 32, sideWidth, 20), literal("↩ ").append(translatable("gui.back"))) .onClick(button -> setSearching(false))); - this.widgets.add(HoleWidget.createBackground(new Rectangle(8 + sideWidth + 4, 32, width - 16 - sideWidth - 4, 20), () -> 0, 32)); + this.widgets.add(HoleWidget.createMenuBackground(new Rectangle(8 + sideWidth + 4, 32, width - 16 - sideWidth - 4, 20))); TextFieldWidget textField = new TextFieldWidget(new Rectangle(8 + sideWidth + 4 + 6, 32 + 6, width - 16 - sideWidth - 4 - 10, 12)) { @Override protected void renderSuggestion(GuiGraphics graphics, int x, int y) { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java index e6f7332ae..e701eac07 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/config/components/ConfigCategoryEntryWidget.java @@ -46,9 +46,9 @@ public class ConfigCategoryEntryWidget { Label label = Widgets.createLabel(new Point(21, hasDescription ? 5 : 7), category.getName().copy().withStyle(style -> style.withColor(0xFFC0C0C0))) .leftAligned(); Font font = Minecraft.getInstance().font; - MutableComponent description = category.getDescription().copy().withStyle(style -> style.withColor(0xFF909090)); + MutableComponent description = category.getDescription().copy().withStyle(style -> style.withColor(0xFFB0B0B0)); Widget descriptionLabel = Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { - renderTextScrolling(graphics, description, 0, 0, (int) ((width - 21 - 6) / 0.75), 0xFF909090); + renderTextScrolling(graphics, description, 0, 0, (int) ((width - 21 - 6) / 0.75), 0xFFB0B0B0); }); Rectangle bounds = new Rectangle(0, 0, label.getBounds().getMaxX(), hasDescription ? 24 : 7 * 3); return Widgets.concatWithBounds( diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java index 3a8b0ed25..cf5f675ee 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/HoleWidget.java @@ -32,7 +32,7 @@ import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.impl.client.gui.InternalTextures; -import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.resources.ResourceLocation; import org.joml.Matrix4f; @@ -41,6 +41,7 @@ import java.util.function.IntSupplier; public class HoleWidget { // 32 for list background, 64 for header and footer + @Deprecated(forRemoval = true) public static Widget create(Rectangle bounds, IntSupplier yOffset, int colorIntensity) { return Widgets.withBounds( Widgets.concat( @@ -51,6 +52,7 @@ public class HoleWidget { ); } + @Deprecated(forRemoval = true) public static Widget create(Rectangle bounds, ResourceLocation backgroundLocation, IntSupplier yOffset, int colorIntensity) { return Widgets.withBounds( Widgets.concat( @@ -61,10 +63,22 @@ public class HoleWidget { ); } + public static Widget create(Rectangle bounds) { + return Widgets.withBounds( + Widgets.concat( + createMenuBackground(bounds), + createListBorders(bounds) + ), + bounds + ); + } + + @Deprecated(forRemoval = true) public static Widget createBackground(Rectangle bounds, IntSupplier yOffset, int colorIntensity) { return createBackground(bounds, InternalTextures.LEGACY_DIRT, yOffset, colorIntensity); } + @Deprecated(forRemoval = true) public static Widget createBackground(Rectangle bounds, ResourceLocation backgroundLocation, IntSupplier yOffset, int colorIntensity) { return Widgets.withBounds(Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { Tesselator tesselator = Tesselator.getInstance(); @@ -73,6 +87,15 @@ public class HoleWidget { }), bounds); } + public static Widget createMenuBackground(Rectangle bounds) { + return Widgets.withBounds(Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { + RenderSystem.enableBlend(); + graphics.blit(new ResourceLocation("textures/gui/menu_list_background.png"), bounds.x, bounds.y, bounds.getMaxX(), bounds.getMaxY(), bounds.width, bounds.height, 32, 32); + RenderSystem.disableBlend(); + }), bounds); + } + + @Deprecated(forRemoval = true) public static Widget createInnerShadow(Rectangle bounds) { return Widgets.withBounds(Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { Tesselator tesselator = Tesselator.getInstance(); @@ -96,4 +119,13 @@ public class HoleWidget { RenderSystem.disableBlend(); }), bounds); } + + public static Widget createListBorders(Rectangle bounds) { + return Widgets.withBounds(Widgets.createDrawableWidget((graphics, mouseX, mouseY, delta) -> { + RenderSystem.enableBlend(); + graphics.blit(CreateWorldScreen.HEADER_SEPARATOR, bounds.x, bounds.y - 2, 0.0F, 0.0F, bounds.width, 2, 32, 2); + graphics.blit(CreateWorldScreen.FOOTER_SEPARATOR, bounds.x, bounds.getMaxY(), 0.0F, 0.0F, bounds.width, 2, 32, 2); + RenderSystem.disableBlend(); + }), bounds); + } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java index 126576f49..ec8147b87 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ScrollableViewWidget.java @@ -58,7 +58,7 @@ public class ScrollableViewWidget { List<Widget> widgets = new ArrayList<>(); if (background) { - widgets.add(HoleWidget.create(bounds, scrollingRef[0]::scrollAmountInt, 32)); + widgets.add(HoleWidget.create(bounds)); } widgets.add(Widgets.scissored(scrollingRef[0].getScissorBounds(), Widgets.withTranslate(inner, |
