diff --git a/build.gradle b/build.gradle index 2a589ce..dc8bcbb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,22 +1,22 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.8-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_21 -targetCompatibility = JavaVersion.VERSION_21 - -archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +base { + archivesName = project.archives_base_name +} + repositories { // Add repositories to retrieve artifacts from in here. // You should only use this when depending on other mods because // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // See https://docs.gradle.org/current/userguide/declaring_repositories.html // for more information about repositories. - + maven { url = "https://api.modrinth.com/maven" } // Modrinth maven { url "https://maven.terraformersmc.com/" } // Mod Menu maven { url "https://maven.shedaniel.me/" } // Cloth Config } @@ -25,20 +25,21 @@ dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - // Tells Gradle to use cloth config - modImplementation "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}", { - exclude module: 'fabric-api' - } - include "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}" + // Fabric API. This is technically optional, but you probably want it anyway. + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" // Tells Gradle to use mod menu modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}", { exclude module: 'fabric-api' } + + // Tells Gradle to use cloth config + modImplementation "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}", { + exclude module: 'fabric-api' + } + include "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}" } processResources { @@ -50,7 +51,6 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // Minecraft 1.20.5 (1.20.5-pre1) upwards uses Java 21. it.options.release = 21 } @@ -59,18 +59,22 @@ java { // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + rename { "${it}_${project.base.archivesName.get()}"} } } // configure the maven publication publishing { publications { - mavenJava(MavenPublication) { + create("mavenJava", MavenPublication) { + artifactId = project.archives_base_name from components.java } } @@ -82,4 +86,4 @@ publishing { // The repositories here will be used for publishing your artifact, not for // retrieving dependencies. } -} +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8cd053a..5964b80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G # Mod Properties -mod_version = 2.4.4 +mod_version = 2.4.5 maven_group = com.bvengo archives_base_name = simpleshulkerpreview @@ -11,12 +11,12 @@ archives_base_name = simpleshulkerpreview ## https://maven.shedaniel.me/me/shedaniel/cloth/cloth-config-fabric/ ## https://maven.terraformersmc.com/com/terraformersmc/modmenu -cloth_version=15.0.127 -modmenu_version=11.0.1 +cloth_version=16.0.141 +modmenu_version=12.0.0-beta.1 -minecraft_version=1.21 -yarn_mappings=1.21+build.1 -loader_version=0.15.11 +minecraft_version=1.21.3 +yarn_mappings=1.21.3+build.2 +loader_version=0.16.9 # Fabric API -fabric_version=0.100.1+1.21 \ No newline at end of file +fabric_version=0.107.0+1.21.3 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd49..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22c..ccc1a9b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/gradlew b/gradlew index 1aa94a4..b26d411 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -246,4 +249,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" +exec "$JAVACMD" "$@" \ No newline at end of file diff --git a/gradlew.bat b/gradlew.bat index 7101f8e..b808aea 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -89,4 +91,4 @@ exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal -:omega +:omega \ No newline at end of file diff --git a/notes/inventory.md b/notes/inventory.md deleted file mode 100644 index 8b0a618..0000000 --- a/notes/inventory.md +++ /dev/null @@ -1,61 +0,0 @@ -# Notes about inventory structure - -**Get inventory data** -``` -/data get entity BVengo Inventory -``` - -*Output - I manually added the outer braces and Inventory id for better context* -```json -{ - ..., - Inventory: [ - { - count: 1, - Slot: 0b, - components: { - "minecraft:container": [ - { - item: { - count: 37, - id: "minecraft:stone" - }, - slot: 0 - }, - { - item: { - count: 12, - id: "minecraft:acacia_log" - }, - slot: 1 - } - ] - }, - id: "minecraft:shulker_box" - }, - { - count: 1, - Slot: 1b, - components: { - "minecraft:bundle_contents": [ - { - count: 3, - id: "minecraft:torchflower_seeds" - }, - { - count: 16, - id: "minecraft:pumpkin_seeds" - } - ] - }, - id: "minecraft:bundle" - }, - { - count: 64, - Slot: 2b, - id: "minecraft:grass_block" - } - ], - ... -} -``` diff --git a/src/main/java/com/bvengo/simpleshulkerpreview/config/ConfigOptions.java b/src/main/java/com/bvengo/simpleshulkerpreview/config/ConfigOptions.java index ecf2c11..b40a226 100644 --- a/src/main/java/com/bvengo/simpleshulkerpreview/config/ConfigOptions.java +++ b/src/main/java/com/bvengo/simpleshulkerpreview/config/ConfigOptions.java @@ -95,4 +95,13 @@ public class ConfigOptions implements ConfigData { @ConfigEntry.Category("compatibility") @ConfigEntry.Gui.Tooltip() public boolean supportOtherContainers = false; + + /** + * Support mods that change the default size of shulkers. + * Requested in https://github.com/BVengo/simple-shulker-preview/issues/33 + */ + @ConfigEntry.Category("compatibility") + @ConfigEntry.Gui.CollapsibleObject() + @ConfigEntry.Gui.Tooltip() + public ShulkerInventoryOptions shulkerInventoryOptions = new ShulkerInventoryOptions(); } \ No newline at end of file diff --git a/src/main/java/com/bvengo/simpleshulkerpreview/config/IconPositionOptions.java b/src/main/java/com/bvengo/simpleshulkerpreview/config/IconPositionOptions.java index c7d6f2a..50c7ee4 100644 --- a/src/main/java/com/bvengo/simpleshulkerpreview/config/IconPositionOptions.java +++ b/src/main/java/com/bvengo/simpleshulkerpreview/config/IconPositionOptions.java @@ -12,7 +12,7 @@ public class IconPositionOptions { public int translateY; @ConfigEntry.Gui.Tooltip() - @ConfigEntry.BoundedDiscrete(min = 0, max = 16) + @ConfigEntry.BoundedDiscrete(min = 0, max = 64) public int translateZ; @ConfigEntry.Gui.Tooltip() diff --git a/src/main/java/com/bvengo/simpleshulkerpreview/config/ShulkerInventoryOptions.java b/src/main/java/com/bvengo/simpleshulkerpreview/config/ShulkerInventoryOptions.java new file mode 100644 index 0000000..884a6e7 --- /dev/null +++ b/src/main/java/com/bvengo/simpleshulkerpreview/config/ShulkerInventoryOptions.java @@ -0,0 +1,17 @@ +package com.bvengo.simpleshulkerpreview.config; + +import me.shedaniel.autoconfig.annotation.ConfigEntry; + +public class ShulkerInventoryOptions { + @ConfigEntry.Gui.Tooltip() + @ConfigEntry.BoundedDiscrete(max = 64) + public int shulkerInventoryRows = 3; + + @ConfigEntry.Gui.Tooltip() + @ConfigEntry.BoundedDiscrete(max = 64) + public int shulkerInventoryCols = 9; + + public int getSize() { + return shulkerInventoryRows * shulkerInventoryCols; + } +} \ No newline at end of file diff --git a/src/main/java/com/bvengo/simpleshulkerpreview/container/ContainerManager.java b/src/main/java/com/bvengo/simpleshulkerpreview/container/ContainerManager.java index e4b8e99..2fb4d6b 100644 --- a/src/main/java/com/bvengo/simpleshulkerpreview/container/ContainerManager.java +++ b/src/main/java/com/bvengo/simpleshulkerpreview/container/ContainerManager.java @@ -11,6 +11,7 @@ import net.minecraft.component.type.ContainerComponent; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +import org.apache.commons.lang3.math.Fraction; public class ContainerManager { private ItemStack containerStack; @@ -71,48 +72,62 @@ public int getStackSize() { * Returns the ratio full that a container is. * @return A float between 0 and 1 indicating how full the container is */ - public float getCapacity() { - switch(containerContentsType) { - case CONTAINER: - return getContainerCapacity(); - case BUNDLE: - return getBundleCapacity(); - default: - // String msg = String.format("Cannot get capacity of container '%s' with no contents type.", containerId); - // SimpleShulkerPreviewMod.LOGGER.warn(msg); - return 0.0f; + public Fraction getCapacity() { + Fraction capacity = switch (containerContentsType) { + case CONTAINER -> getContainerCapacity(); + case BUNDLE -> getBundleCapacity(); + default -> + // String msg = String.format("Cannot get capacity of container '%s' with no contents type.", containerId); + // SimpleShulkerPreviewMod.LOGGER.warn(msg); + Fraction.ZERO; + }; + + // Cap the capacity at 1, in case unsupported large containers are used without using the configs to + // modify inventory sizes + if(capacity.compareTo(Fraction.ONE) > 0) { + capacity = Fraction.ONE; } + + return capacity; } public ContainerType getContainerType() { return containerType; } - private float getContainerCapacity() { + private Fraction getContainerCapacity() { if(containerType != ContainerType.SHULKER_BOX) { // String msg = String.format("Cannot get maximum inventory size of the container '%s'.", containerId); // SimpleShulkerPreviewMod.LOGGER.warn(msg); - return 0.0f; + return Fraction.ZERO; } return getShulkerCapacity(); } - private float getShulkerCapacity() { + private Fraction getShulkerCapacity() { ContainerComponent containerComponent = containerStack.get(DataComponentTypes.CONTAINER); - Iterable itemIterable = containerComponent.iterateNonEmpty(); + if(containerComponent == null) { +// String msg = String.format("Cannot get container component for container '%s'.", containerId); +// SimpleShulkerPreviewMod.LOGGER.warn(msg); + return Fraction.ZERO; + } - float sumCapacity = 0.0f; + int maxItems = SimpleShulkerPreviewMod.CONFIGS.shulkerInventoryOptions.getSize() * 64; // Maximum number of items in the shulker + int numItems = 0; // Actual number of items in the shulker + + Iterable itemIterable = containerComponent.iterateNonEmpty(); for(ItemStack itemStack : itemIterable) { - sumCapacity += (float) itemStack.getCount() / itemStack.getItem().getMaxCount();; + numItems += itemStack.getCount(); + maxItems += itemStack.getItem().getMaxCount() - 64; // Replace the previous 64 with the actual max size of the item } - return sumCapacity / ShulkerBoxBlockEntity.INVENTORY_SIZE; + return Fraction.getFraction(numItems, maxItems); } - private float getBundleCapacity() { + private Fraction getBundleCapacity() { BundleContentsComponent bundleComponent = containerStack.get(DataComponentTypes.BUNDLE_CONTENTS); - return bundleComponent.getOccupancy().floatValue(); + return bundleComponent.getOccupancy(); } private void setContainerContentsType() { diff --git a/src/main/java/com/bvengo/simpleshulkerpreview/container/ItemStackManager.java b/src/main/java/com/bvengo/simpleshulkerpreview/container/ItemStackManager.java index 0d5007c..a6213d7 100644 --- a/src/main/java/com/bvengo/simpleshulkerpreview/container/ItemStackManager.java +++ b/src/main/java/com/bvengo/simpleshulkerpreview/container/ItemStackManager.java @@ -122,9 +122,7 @@ public static ItemStack getItemFromCustomName(ItemStack itemStack) { Identifier itemId = Identifier.tryParse(customName.getString()); if(itemId == null) return null; - Item item = Registries.ITEM.getOrEmpty(itemId).orElse(null); - if(item == null) return null; - + Item item = Registries.ITEM.get(itemId); return new ItemStack(item); } diff --git a/src/main/java/com/bvengo/simpleshulkerpreview/mixin/DrawContextMixin.java b/src/main/java/com/bvengo/simpleshulkerpreview/mixin/DrawContextMixin.java index e754cad..7eb1f48 100644 --- a/src/main/java/com/bvengo/simpleshulkerpreview/mixin/DrawContextMixin.java +++ b/src/main/java/com/bvengo/simpleshulkerpreview/mixin/DrawContextMixin.java @@ -10,7 +10,6 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.*; @@ -27,10 +26,9 @@ public abstract class DrawContextMixin implements DrawContextAccess { adjustSize = newValue; } - @Inject(at = @At(value = "INVOKE", target = "net/minecraft/item/ItemStack.isItemBarVisible()Z"), - method = "drawItemInSlot(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V") - private void renderShulkerItemOverlay(TextRenderer renderer, ItemStack stack, int x, int y, @Nullable String countLabel, CallbackInfo info) { - + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawItemBar(Lnet/minecraft/item/ItemStack;II)V"), + method = "drawStackOverlay(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V") + private void renderShulkerItemOverlay(TextRenderer textRenderer, ItemStack stack, int x, int y, String stackCountText, CallbackInfo info) { if(SimpleShulkerPreviewMod.CONFIGS.disableMod) { return; } diff --git a/src/main/java/com/bvengo/simpleshulkerpreview/positioners/CapacityBarRenderer.java b/src/main/java/com/bvengo/simpleshulkerpreview/positioners/CapacityBarRenderer.java index f737c41..dbb7c4a 100644 --- a/src/main/java/com/bvengo/simpleshulkerpreview/positioners/CapacityBarRenderer.java +++ b/src/main/java/com/bvengo/simpleshulkerpreview/positioners/CapacityBarRenderer.java @@ -1,28 +1,34 @@ package com.bvengo.simpleshulkerpreview.positioners; import com.bvengo.simpleshulkerpreview.SimpleShulkerPreviewMod; +import com.bvengo.simpleshulkerpreview.config.CapacityBarOptions; import com.bvengo.simpleshulkerpreview.container.ContainerManager; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.RenderLayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.MathHelper; +import net.minecraft.util.Colors; +import net.minecraft.util.math.ColorHelper; +import org.apache.commons.lang3.math.Fraction; public class CapacityBarRenderer extends OverlayRenderer { - public static final int CAPACITY_BAR_COLOR_FILL = MathHelper.packRgb(0.4F, 0.4F, 1.0F); - public static final int CAPACITY_BAR_COLOR_BACK = -16777216; + // Taken from BundleItem.java + private static final int FULL_ITEM_BAR_COLOR = ColorHelper.fromFloats(1.0F, 1.0F, 0.33F, 0.33F); + private static final int ITEM_BAR_COLOR = ColorHelper.fromFloats(1.0F, 0.44F, 0.53F, 1.0F); - float capacity; + private Fraction capacity; - public int xBackgroundStart; - public int yBackgroundStart; - public int xBackgroundEnd; - public int yBackgroundEnd; + private int xBackgroundStart; + private int yBackgroundStart; + private int xBackgroundEnd; + private int yBackgroundEnd; - public int xCapacityStart; - public int yCapacityStart; - public int xCapacityEnd; - public int yCapacityEnd; + private int xCapacityStart; + private int yCapacityStart; + private int xCapacityEnd; + private int yCapacityEnd; + + private final CapacityBarOptions configs = SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions; public CapacityBarRenderer(ContainerManager containerParser, ItemStack stack, int x, int y) { super(stack, x, y); @@ -31,53 +37,53 @@ public CapacityBarRenderer(ContainerManager containerParser, ItemStack stack, in protected boolean canDisplay() { return ( - (!SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.hideWhenEmpty || capacity > 0.0f) && - (!SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.hideWhenFull || capacity < 1.0f) + (!configs.hideWhenEmpty || capacity.compareTo(Fraction.ZERO) > 0) && + (!configs.hideWhenFull || capacity.compareTo(Fraction.ONE) < 0) ); } protected void calculatePositions() { - int step = (int)(SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.length * capacity); - int shadowHeight = SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.displayShadow ? 1 : 0; + int step = (int)(configs.length * capacity.floatValue()); + int shadowHeight = configs.displayShadow ? 1 : 0; - xBackgroundStart = stackX + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.translateX; - yBackgroundStart = stackY + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.translateY; + xBackgroundStart = stackX + configs.translateX; + yBackgroundStart = stackY + configs.translateY; - switch(SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.direction) { + switch(configs.direction) { case LEFT_TO_RIGHT -> { - xBackgroundEnd = xBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.length; - yBackgroundEnd = yBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.width + shadowHeight; + xBackgroundEnd = xBackgroundStart + configs.length; + yBackgroundEnd = yBackgroundStart + configs.width + shadowHeight; xCapacityStart = xBackgroundStart; yCapacityStart = yBackgroundStart; xCapacityEnd = xBackgroundStart + step; - yCapacityEnd = yCapacityStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.width; + yCapacityEnd = yCapacityStart + configs.width; } case RIGHT_TO_LEFT -> { - xBackgroundEnd = xBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.length; - yBackgroundEnd = yBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.width + shadowHeight; + xBackgroundEnd = xBackgroundStart + configs.length; + yBackgroundEnd = yBackgroundStart + configs.width + shadowHeight; xCapacityStart = xBackgroundEnd - step; yCapacityStart = yBackgroundStart; xCapacityEnd = xBackgroundEnd; - yCapacityEnd = yCapacityStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.width; + yCapacityEnd = yCapacityStart + configs.width; } case TOP_TO_BOTTOM -> { - xBackgroundEnd = xBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.width; - yBackgroundEnd = yBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.length; + xBackgroundEnd = xBackgroundStart + configs.width; + yBackgroundEnd = yBackgroundStart + configs.length; xCapacityStart = xBackgroundStart; yCapacityStart = yBackgroundStart; xCapacityEnd = xBackgroundEnd; yCapacityEnd = yCapacityStart + step; } case BOTTOM_TO_TOP -> { - xBackgroundEnd = xBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.width; - yBackgroundEnd = yBackgroundStart + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.length; + xBackgroundEnd = xBackgroundStart + configs.width; + yBackgroundEnd = yBackgroundStart + configs.length; xCapacityStart = xBackgroundStart; yCapacityStart = yBackgroundEnd - step; xCapacityEnd = xBackgroundEnd; yCapacityEnd = yBackgroundEnd; } default -> { - String err = "Unexpected value for capacity direction: " + SimpleShulkerPreviewMod.CONFIGS.capacityBarOptions.direction; + String err = "Unexpected value for capacity direction: " + configs.direction; SimpleShulkerPreviewMod.LOGGER.error(err); throw new IllegalStateException(err); @@ -86,10 +92,12 @@ protected void calculatePositions() { } protected void render(DrawContext context) { - context.fill(RenderLayer.getGuiOverlay(), xBackgroundStart, yBackgroundStart, xBackgroundEnd, yBackgroundEnd, - CAPACITY_BAR_COLOR_BACK); - context.fill(RenderLayer.getGuiOverlay(), xCapacityStart, yCapacityStart, xCapacityEnd, yCapacityEnd, - CAPACITY_BAR_COLOR_FILL | CAPACITY_BAR_COLOR_BACK); + if(configs.displayShadow) { + context.fill(RenderLayer.getGuiOverlay(), xBackgroundStart, yBackgroundStart, xBackgroundEnd, yBackgroundEnd, Colors.BLACK); + } + + int colour = capacity.compareTo(Fraction.ONE) == 0 ? FULL_ITEM_BAR_COLOR : ITEM_BAR_COLOR; + context.fill(RenderLayer.getGuiOverlay(), xCapacityStart, yCapacityStart, xCapacityEnd, yCapacityEnd, ColorHelper.fullAlpha(colour)); } public void renderOptional(DrawContext context) { diff --git a/src/main/resources/assets/simpleshulkerpreview/lang/en_us.json b/src/main/resources/assets/simpleshulkerpreview/lang/en_us.json index 8eb4782..64ba9f8 100644 --- a/src/main/resources/assets/simpleshulkerpreview/lang/en_us.json +++ b/src/main/resources/assets/simpleshulkerpreview/lang/en_us.json @@ -66,12 +66,18 @@ "text.autoconfig.simpleshulkerpreview.option.iconPositionOptionsStacked.translateZ.@Tooltip": "In/out offset. Use when other mods cover / are covered by this.", "text.autoconfig.simpleshulkerpreview.option.iconPositionOptionsStacked.scale": "Scale", "text.autoconfig.simpleshulkerpreview.option.iconPositionOptionsStacked.scale.@Tooltip": "Scale of the icon.", + "text.autoconfig.simpleshulkerpreview.option.shulkerInventoryOptions": "Shulker Inventory Options", + "text.autoconfig.simpleshulkerpreview.option.shulkerInventoryOptions.@Tooltip": "Options to modify the client-side shulker attributes when server-side mods require it.", + "text.autoconfig.simpleshulkerpreview.option.shulkerInventoryOptions.shulkerInventoryRows": "Shulker Inventory Rows", + "text.autoconfig.simpleshulkerpreview.option.shulkerInventoryOptions.shulkerInventoryRows.@Tooltip": "The number of rows in a shulker box. Affects the capacity bar on all shulkers.", + "text.autoconfig.simpleshulkerpreview.option.shulkerInventoryOptions.shulkerInventoryCols": "Shulker Inventory Columns", + "text.autoconfig.simpleshulkerpreview.option.shulkerInventoryOptions.shulkerInventoryCols.@Tooltip": "The number of columns in a shulker box. Affects the capacity bar on all shulkers.", "text.autoconfig.simpleshulkerpreview.option.supportBundles": "Support Bundles", "text.autoconfig.simpleshulkerpreview.option.supportBundles.@Tooltip": "Displays items inside bundles", "text.autoconfig.simpleshulkerpreview.option.supportCustomHeads": "Support Custom Heads", "text.autoconfig.simpleshulkerpreview.option.supportCustomHeads.@Tooltip": "Treats custom heads separately from the minecraft:player_head", "text.autoconfig.simpleshulkerpreview.option.supportOtherContainers": "Support Other Containers", - "text.autoconfig.simpleshulkerpreview.option.supportOtherContains.@Tooltip": "Displays items inside other containers (e.g. modded)", + "text.autoconfig.simpleshulkerpreview.option.supportOtherContainers.@Tooltip": "Displays items inside other containers (e.g. modded)", "config.simpleshulkerpreview.capacityDirection.left_to_right": "Left to Right", "config.simpleshulkerpreview.capacityDirection.right_to_left": "Right to Left", "config.simpleshulkerpreview.capacityDirection.top_to_bottom": "Top to Bottom", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a3c87c4..810a2ed 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "simpleshulkerpreview", - "version": "2.4.4", + "version": "2.4.5", "icon": "assets/simpleshulkerpreview/icon.png", "name": "Simple Shulker Preview", "description": "Display a configurable icon indicating the contents of a shulker box, as well as a capacity bar.", @@ -24,7 +24,7 @@ "java": ">=21" }, "recommends": { - "modmenu": ">=11.0" + "modmenu": ">=12.0" }, "custom": { "modmenu": {