copygirl / WearableBackpacks

Minecraft mod which adds beautiful, balanced backpacks
MIT License
61 stars 35 forks source link

Dupe Bug with Oops #66

Open Boymann opened 6 years ago

Boymann commented 6 years ago

While the Oops mod is installed (not completely confirmed but 80% sure) if you break the backpack after placing it on the floor 2 backpacks drop.

copygirl commented 6 years ago

This should probably get respolved on Oops' end..? I use onBlockBreak to drop the backpack, for the record.

Boymann commented 6 years ago

I'm pretty new to github, I'll open an issue there too, because I don't think there is a way to forward an issue.

copygirl commented 6 years ago

No problem, we all start out somewhere! I'd appreciate it if you could link this issue there. GitHub will automatically add a notice here about it being mentioned, and that's always helpful.

DreenDex commented 6 years ago

@copygirl its not "Oops" issue. As mod developer, i recommend you use onBlockHarvested instead of onBlockBreak: image

copygirl commented 6 years ago

@DreenDex To do what, exactly?

Not sure what I linked in my first comment. Here's the relevant code from BlockBackpack. I don't exactly remember why I chose to do things this way, but I'm pretty sure it was done like this intentionally for some reason.

asiekierka commented 6 years ago

You're using Block.breakBlock which is called every single time setBlockState() sets the block to air. Nuh-uh. I recommend making it hook one of the harvesting methods,

You can work around "The super method will set the block to air before getDrops." by passing the TileEntity reference from harvestBlock to getDrops - I can also tackle that.

copygirl commented 6 years ago

@asiekierka Feel free to have a fresh go at it. I remember I wanted to have some specific behavior. Such as always dropping the backpack even if it was from an explosion.

asiekierka commented 6 years ago

https://github.com/copygirl/WearableBackpacks/commit/3c61f5813a9f127c460d5bdcf3ee58289f8189f5 should fix it