thexaero / open-parties-and-claims

Minecraft mod that adds chunk claims and player parties
https://www.curseforge.com/minecraft/mc-mods/open-parties-and-claims
Other
37 stars 20 forks source link

Chest from Expanded Storage can be opened on claimed chunks #187

Closed JoakoLP closed 1 year ago

JoakoLP commented 1 year ago

Please add compatibility for Expanded Storage.

JoakoLP commented 1 year ago

I have added this blocks on server config. I don't know if I have to add any prefix but it stills not working

blockProtectionOptionalExceptionGroups = ["Controls{minecraft:lever, #minecraft:buttons}", "Doors{#minecraft:doors, #minecraft:fence_gates, #forge:fence_gates, #minecraft:trapdoors}", "Chests{minecraft:chest, minecraft:trapped_chest, expandedstorage:bamboo_chest, expandedstorage:candy_cane_mini_present, expandedstorage:candy_cane_mini_present_with_sparrow, expandedstorage:diamond_chest, expandedstorage:diamond_mini_chest, expandedstorage:diamond_mini_chest_with_sparrow, expandedstorage:gold_chest, expandedstorage:gold_mini_chest, expandedstorage:gold_mini_chest_with_sparrow, expandedstorage:iron_chest, expandedstorage:iron_mini_chest, expandedstorage:iron_mini_chest_with_sparrow, expandedstorage:netherite_chest, expandedstorage:netherite_chest, expandedstorage:netherite_mini_chest, expandedstorage:netherite_mini_chest_with_sparrow, expandedstorage:obsidian_chest, expandedstorage:obsidian_mini_chest, expandedstorage:obsidian_mini_chest_with_sparrow, expandedstorage:old_diamond_chest, expandedstorage:old_gold_chest, expandedstorage:old_iron_chest, expandedstorage:old_netherite_chest, expandedstorage:old_obsidian_chest, expandedstorage:old_wood_chest, expandedstorage:pumpkin_chest, expandedstorage:pumpkin_mini_chest, expandedstorage:pumpkin_mini_chest_with_sparrow, expandedstorage:vanilla_wood_mini_chest, expandedstorage:vanilla_wood_mini_chest_with_sparrow, expandedstorage:wood_chest, expandedstorage:wood_mini_chest, expandedstorage:wood_mini_chest_with_sparrow, #forge:chests/wooden}", "Barrels{minecraft:barrel, #forge:barrels}", "Ender_Chests{minecraft:ender_chest, #forge:chests/ender}", "Shulker_Boxes{#minecraft:shulker_boxes}", "Furnaces{minecraft:furnace, minecraft:blast_furnace, minecraft:smoker, alloy_forgery:adamantite_block_forge_controller, alloy_forgery:bricks_forge_controller, alloy_forgery:deepslate_bricks_forge_controller, alloy_forgery:end_stone_bricks_forge_controller, alloy_forgery:polished_blackstone_forge_controller, alloy_forgery:prismarine_bricks_forge_controller, alloy_forgery:stone_bricks_forge_controller}", "Hoppers{minecraft:hopper}", "Dispenser-like{minecraft:dispenser, minecraft:dropper}", "Anvils{#minecraft:anvil, minecraft:grindstone}", "Beds{#minecraft:beds}", "Beacons{minecraft:beacon}", "Enchanting_Tables{minecraft:enchanting_table, toolleveling:tool_leveling_table}", "break$Crops{#minecraft:crops}"]
JoakoLP commented 1 year ago

I want to deny interaction from other players with those blocks unless I allow it.

JoakoLP commented 1 year ago

I got it to work with the alloy_forgery and mythicmetals blocks's, but not yet with the Expanded Storage's

blockProtectionOptionalExceptionGroups = ["Controls{minecraft:lever, #minecraft:buttons}", "Doors{#minecraft:doors, #minecraft:fence_gates, #forge:fence_gates, #minecraft:trapdoors}", "Chests{minecraft:chest, minecraft:trapped_chest, expandedstorage:bamboo_chest, expandedstorage:candy_cane_mini_present, expandedstorage:candy_cane_mini_present_with_sparrow, expandedstorage:diamond_chest, expandedstorage:diamond_mini_chest, expandedstorage:diamond_mini_chest_with_sparrow, expandedstorage:gold_chest, expandedstorage:gold_mini_chest, expandedstorage:gold_mini_chest_with_sparrow, expandedstorage:iron_chest, expandedstorage:iron_mini_chest, expandedstorage:iron_mini_chest_with_sparrow, expandedstorage:netherite_chest, expandedstorage:netherite_chest, expandedstorage:netherite_mini_chest, expandedstorage:netherite_mini_chest_with_sparrow, expandedstorage:obsidian_chest, expandedstorage:obsidian_mini_chest, expandedstorage:obsidian_mini_chest_with_sparrow, expandedstorage:old_diamond_chest, expandedstorage:old_gold_chest, expandedstorage:old_iron_chest, expandedstorage:old_netherite_chest, expandedstorage:old_obsidian_chest, expandedstorage:old_wood_chest, expandedstorage:pumpkin_chest, expandedstorage:pumpkin_mini_chest, expandedstorage:pumpkin_mini_chest_with_sparrow, expandedstorage:vanilla_wood_mini_chest, expandedstorage:vanilla_wood_mini_chest_with_sparrow, expandedstorage:wood_chest, expandedstorage:wood_mini_chest, expandedstorage:wood_mini_chest_with_sparrow, #forge:chests/wooden}", "Barrels{minecraft:barrel, #forge:barrels}", "Ender_Chests{minecraft:ender_chest, #forge:chests/ender}", "Shulker_Boxes{#minecraft:shulker_boxes}", "Furnaces{minecraft:furnace, minecraft:blast_furnace, minecraft:smoker, alloy_forgery:adamantite_block_forge_controller, alloy_forgery:bricks_forge_controller, alloy_forgery:deepslate_bricks_forge_controller, alloy_forgery:end_stone_bricks_forge_controller, alloy_forgery:polished_blackstone_forge_controller, alloy_forgery:prismarine_bricks_forge_controller, alloy_forgery:stone_bricks_forge_controller}", "Hoppers{minecraft:hopper}", "Dispenser-like{minecraft:dispenser, minecraft:dropper}", "Anvils{#minecraft:anvil, minecraft:grindstone, mythicmetals:(adamantite|aquarium|banglum|bronze|carmot|celestium|durasteel|hallowed|kyber|manganese|metallurgium|midas_gold|mythril|orichalcum|osmium|palladium|platinum|prometheum|quadrillum|runite|silver|star_platinum|steel|stormyx)_anvil}", "Beds{#minecraft:beds}", "Beacons{minecraft:beacon}", "Enchanting_Tables{minecraft:enchanting_table, toolleveling:tool_leveling_table}", "break$Crops{#minecraft:crops}"]
purejosh commented 1 year ago

I was just about to report this. Big problem.

thexaero commented 1 year ago

That sounds like an issue on Expanded Storage's end. Does it actually allow you to take items from the chests or is it just a visual issue?

thexaero commented 1 year ago

Can confirm that it's actually unprotected. I don't know why that would be the case but it affects other claim mods too.

unilock commented 1 year ago

Very odd, since Expanded Storage adds all its chests and barrels to Forge's common tags (#forge:chests/wooden and #forge:barrels/wooden) by default: https://gitlab.com/BucketOfCompasses/expanded-storage/-/blob/1.19.3/forge/src/main/java/ellemes/expandedstorage/forge/ForgeMain.java#L60

As well as Fabric's common tags: https://gitlab.com/BucketOfCompasses/expanded-storage/-/tree/1.19.3/fabric/src/generated/resources/data

(I couldn't find the datagen routines for the Fabric side of Expanded Storage, so hopefully that folder is proof enough)

The latest releases of Expanded Storage on CurseForge (for both 1.18.2, 1.19.2, and 1.19.3) already include the relevant tagging code, so I'm not sure what the problem could be...


Expanded Storage seems to have explicit support for Flan: https://gitlab.com/BucketOfCompasses/expanded-storage/-/blob/1.19.3/thread/src/main/java/ellemes/container_library/thread/wrappers/ThreadNetworkWrapper.java

As well as FTB Chunks: https://gitlab.com/BucketOfCompasses/expanded-storage/-/blob/1.19.3/common/src/main/java/ellemes/container_library/wrappers/NetworkWrapper.java

And there's a response to an issue on Expanded Storage's GitLab that claims to have a solution for Open Parties and Claims specifically: https://gitlab.com/BucketOfCompasses/expanded-storage/-/issues/11#note_1248550645

Maybe those are relevant?

thexaero commented 1 year ago

@unilock I don't think it has anything to do with what chest class they use. This protection is not chest-specific. It affects FTB Chunks too, if you look at their issue tracker, and probably Flan. For some reason the action of opening a chest is not confirmed by the server first, after a somewhat recent update on their end. The interaction is protected on the server side, the client just doesn't care about it.

thexaero commented 1 year ago

I guess they did explicitly fix the issue with FTB Chunks, just didn't close it (https://github.com/FTBTeam/FTB-Mods-Issues/issues/561). I don't know why they decided to add explicit support for specific mods instead of initiating the interaction on the server side after any claim checks.

purejosh commented 1 year ago

This is definitely an issue with Expanded Storage, unfortunately. Not OPAC. Chronossacaria and I worked together to find the reason why it's not protecting, and here's the reason:

It would appear that the reason for this is that is that expanded-storage has their own ChestBlockEntity rather than making use of Minecraft's ChestBlockEntity. Whilst the inventory size in Minecraft's ChestBlockEntity is private this could probably be made accessible via an Accessor as follows:

@Mixin(ChestBlockEntity.class)
public interface ChestBlockEntityAccessor {
    @Accessor("inventory")
    DefaultedList<ItemStack> getInventory();
}

In doing such, the other mods which are looking for either Minecraft's ChestBlockEntity (or some extension) will be able to recognise the expanded-storage chests in the appropriate manner.

Unfortunately, until expanded storage starts using the built in ChestBlockEntity, it will not play well with other mods that are meant to protect it. I believe support for this can be added by OPAC, but... Why would they do that? Unless there's a very good reason why ES's dev chose to use a custom entity for their storage blocks, I wouldn't blame Xaero if they didn't even want to look into adding support.

thexaero commented 1 year ago

@purejosh They don't have to use the vanilla chest entity class. Nowhere in my mod do I even reference it. That's not the issue.

purejosh commented 1 year ago

So, are you protecting all Container Classes? Or are you interrupting the interact entirely? I'm curious.

unilock commented 1 year ago

The latest release of Expanded Storage (as of 10 minutes ago) claims to have greatly improved compatibility with claim mods: https://www.curseforge.com/minecraft/mc-mods/expanded-storage/files/4373002

Which I think is referencing these two commits: "Implement a fake pick screen that is a HandledScreen which eliminates the need for all our hacky networking." "Strip out all the now non-needed networking code, opening as spectator needs implementing"

I don't have a test environment set up right now; anyone want to give it a try?

purejosh commented 1 year ago

I'll give it a try here in a couple days when I update my modpack.

purejosh commented 1 year ago

@purejosh They don't have to use the vanilla chest entity class. Nowhere in my mod do I even reference it. That's not the issue.

Also note that I'm not just talking about your mod, when addressing theirs. Ledger, the fabric blocklogger, also doesn't have any insight on these blocks.

thexaero commented 1 year ago

@unilock That does sound like they solved the issue. I'll check it out.

thexaero commented 1 year ago

Yep. It works now :)