From e31a9c7c4ffcdd6b38370a38519593c34f0b92f2 Mon Sep 17 00:00:00 2001 From: Noaaan Date: Sun, 17 Mar 2024 19:03:15 +0100 Subject: [PATCH] Do not shadow variables, fixes #21 --- changelog.md | 10 ++-------- gradle.properties | 2 +- .../blocks/chest/MythicChestBlockEntity.java | 4 ++++ .../MythicChestBlockEntityLithiumCompatMixin.java | 13 ++++--------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/changelog.md b/changelog.md index f4fb743..53e6263 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,3 @@ -# 0.6.0 +# 0.6.1 -- Fixed a bug where the Stormyx Chain would not animate correctly. -- Chests now extend ChestBlocks instead of AbstractChestBlocks. This should improve compatibility and reduce the amount of crashes. -- Chests screens no longer force scrolling when leaking by an extra row (thanks glisco!). -- Chest recipes now use the `c:wooden_chests` tag for crafting recipes. -- Added a block set for Hydrargym (Storage Block, Anvil, nuggets). -- Add load conditions for nugget-related recipes. This prevents errors in logs if they are disabled. -- Updated and fixed attributes on crowns \ No newline at end of file +- Update and fix Lithium compat \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 19120bd..5c6fd74 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.20.4 yarn_mappings=1.20.4+build.3 loader_version=0.15.7 # Mod Properties -mod_version=0.6.0+1.20.3 +mod_version=0.6.1+1.20.3 maven_group=nourl archives_base_name=mythicmetals-decorations # Dependencies diff --git a/src/main/java/nourl/mythicmetalsdecorations/blocks/chest/MythicChestBlockEntity.java b/src/main/java/nourl/mythicmetalsdecorations/blocks/chest/MythicChestBlockEntity.java index 5c8738c..e2d2557 100644 --- a/src/main/java/nourl/mythicmetalsdecorations/blocks/chest/MythicChestBlockEntity.java +++ b/src/main/java/nourl/mythicmetalsdecorations/blocks/chest/MythicChestBlockEntity.java @@ -66,6 +66,10 @@ protected DefaultedList method_11282() { return inventory; } + public DefaultedList getMythicChestInventory() { + return inventory; + } + @Override protected void setInvStackList(DefaultedList list) { inventory = list; diff --git a/src/main/java/nourl/mythicmetalsdecorations/mixin/MythicChestBlockEntityLithiumCompatMixin.java b/src/main/java/nourl/mythicmetalsdecorations/mixin/MythicChestBlockEntityLithiumCompatMixin.java index 39c242b..179fede 100644 --- a/src/main/java/nourl/mythicmetalsdecorations/mixin/MythicChestBlockEntityLithiumCompatMixin.java +++ b/src/main/java/nourl/mythicmetalsdecorations/mixin/MythicChestBlockEntityLithiumCompatMixin.java @@ -3,26 +3,21 @@ import me.jellysquid.mods.lithium.api.inventory.LithiumInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.collection.DefaultedList; +import nourl.mythicmetalsdecorations.blocks.chest.MythicChestBlock; import nourl.mythicmetalsdecorations.blocks.chest.MythicChestBlockEntity; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; @Mixin(MythicChestBlockEntity.class) public abstract class MythicChestBlockEntityLithiumCompatMixin implements LithiumInventory { - @Shadow - private int size; - - @Shadow - private DefaultedList inventory; - @Override public int size() { - return this.size; + MythicChestBlock block = (MythicChestBlock) ((MythicChestBlockEntity) (Object) this).getCachedState().getBlock(); + return block.getSize(); } @Override public DefaultedList getInventoryLithium() { - return this.inventory; + return ((MythicChestBlockEntity) (Object) this).getMythicChestInventory(); } }