Closed SawFowl closed 5 years ago
The video and issue description is not good enough. You need more detailed steps.
I am assuming "foreign region" means GriefPrevention claim. I tried this 3 different ways using GP and was unsuccessful.
Do the buckets go away when you relog or move them?
As mentioned above, bucket cancellations have been extensively tested for various conditions, we need very clear and explicit reproduction steps to verify this “dupe”. Likewise, the inventory should be refreshing regardless of circumstances either by logging out or changing slots trying to pick up one of the items from said inventory.
Tomorrow I will try to make a test plugin to check the result of canceling the desired event. I will report the result. If the problem persists, I will provide a test build of the server where you can check it, as well as of course the plugin code.
I found the cause of the problem. There is a conflict with the Thermal Foundation mod. Under the link below you can download a ready-made test build of the server and see for yourself. Be sure to hold 2 buckets in your hand.
https://drive.google.com/open?id=15H4JOoVi9zGuVgtxj_LZ4TWtEWn8bxiL
I'm not able to download that file, google drive just gives me a blank page trying to download it.
It seems that Google has problems. I'll try to think of something. I myself can not download it for some strange reason.
Try this link.
I found out something else.
This code does not work with liquids.
@Listener public void onInteractBlockEvent(InteractBlockEvent event) { event.setCancelled(true); }
can you retest this on latest? there was some changes to interaction events since this issue was made
Got better. The buckets are no longer duplicated, instead they are filled with liquid, which, in general, should also not occur. In addition, there was a permanent flood in the console. SpongeForge version: 1.12.2-2768-7.1.5-RC3535 logs.zip
yeah that spam is caused by https://github.com/SpongePowered/SpongeForge/issues/2574
I think I will continue to use the following code in my plugin for now. `
@Listener
public void fixBucketDupe(InteractItemEvent event) {
if(event.getSource() instanceof Player) {
Player player = (Player) event.getSource();
if(!getGriefPrevention().getClaimManager(player.getWorld()).getClaimAt(player.getLocation()).getUserTrusts().contains(player)) {
if((player.getItemInHand(HandTypes.MAIN_HAND).get().getType().equals(ItemTypes.BUCKET) && player.getItemInHand(HandTypes.MAIN_HAND).get().getQuantity() != 1) ||
(player.getItemInHand(HandTypes.OFF_HAND).get().getType().equals(ItemTypes.BUCKET) && player.getItemInHand(HandTypes.OFF_HAND).get().getQuantity() != 1)) {
event.setCancelled(true);
}
}
}
}
`
@ImMorpheus was InteractBlockEvent supposed to block bucket filling?
ok, so:
[...] trying to use an empty bucket on a block of liquid [...]
This is done by ItemBucket#onItemRightClick
which is called by ItemStack#useItemRightClick
here
The action of picking up a fluid with a bucket is actually linked to CPacketPlayerTryUseItem (thus InteractItemEvent). Simply put: you're not picking up water because you right-clicked on a block with a bucket. You're picking up water because you right-clicked with a bucket in your hand (you can also do that while pointing at a block, but it's not required).
Proof:
Go at the bottom of an ocean, look up, right click with an empty bucket in your hand:
An InteractItemEvent is fired, but no InteractBlockEvent since you haven't right-clicked on a "block".
Simply put, you're using the wrong event. You need to cancel InteractItemEvent.
Closing this.
The dupe is fixed and the Illegal Async PhaseTracker Access was a different issue (fixed)
The fix is not complete. Buckets are filled with liquid.
I guess I'll have to cancel the event myself.
The fix is complete. As I said, that's not an issue because you're cancelling the wrong event.
https://github.com/SpongePowered/SpongeForge/issues/2535#issuecomment-457851582
Then I'll have to use that code. `
@Listener
public void fixBucketDupe(InteractItemEvent.Secondary event) {
if(event.getSource() instanceof Player) {
Player player = (Player) event.getSource();
if(!getGriefPrevention().getClaimManager(player.getWorld()).getClaimAt(player.getLocation()).isTrusted(player.getUniqueId())) {
if(event.getItemStack().createStack().getType().equals(ItemTypes.BUCKET)) {
event.setCancelled(true);
}
}
}
}
`
Actually, it works. Without this code, the bucket will be filled with water.
I think the problem is connected with the Thermal Foundation mod. Perhaps I should write an issue to them.
Honestly I don't even know what you think the issue is here, make a clean issue with what code you expect to work and how it doesn't. From reading the last few messages this sounds more like an issue with GP if anything.
I am currently running
SpongeForge version: 1.12.2-2768-7.1.5-RC3511
Forge version: 14.23.5.2770
Java version: Oracle 1.8.0_191
Operating System: Debian 9.6
Plugins (27): Minecraft, Minecraft Coder Pack, SpongeAPI, Sponge, FastAsyncWorldEdit, BeanCore, CatClearLag, CommandSync, EconomyLite, GriefPrevention, GuiShopManager, Holograms, HuskyCrates, HuskyUI, LuckPerms, Nucleus, PlaceholderAPI, ProjectCore, SkyClaims, StackBan, UltimateChat, UniversalMarket, VirtualChest, VirtualTool, Wasted, WorldEdit, spark
Mods (55): Minecraft, Minecraft Coder Pack, Forge Mod Loader, Minecraft Forge, SpongeAPI, Sponge, AI Improvements, BiblioCraft, Binnie Core, Binnie's Botany, Binnie's Design, Binnie's Extra Bees, Binnie's Extra Trees, Binnie's Genetics, CoFH Core, CoFH World, CodeChicken Lib, Console Filter, Construct's Armory, CraftTweaker JEI Support, CraftTweaker2, CreativeCore, CreativeCoreDummy, CustomNPCs, Ex Nihilo Creatio, Fishing Net Mod, Forestry, Hammer Core, HoloInventory, InstantUnify, Iron Chest, ItemPhysic, Just Enough Items, LagGoggles, MTLib, Mantle, McJtyLib, Mekanism, Mod Tweaker, MrCrayfish's Furniture Mod, Quick Leaf Decay, Redstone Arsenal, Redstone Flux, Solar Flux Reborn, SpongeForge, Thermal Dynamics, Thermal Expansion, Thermal Foundation, Thermal Innovation, Tinkers' Construct, Tiquality, Tree Chopper, UniDict, VanillaFix, WanionLib
Issue Description Dupe occurs when trying to use an empty bucket on a block of liquid in a foreign region. To reproduce the bug, you must have two empty buckets, as well as cancellation of the interaction event with the unit. Video https://youtu.be/hTgckhEa7tw
There is no information on this issue in the logs.