copygirl's Wearable Backpacks

copygirl's Wearable Backpacks

15M Downloads

Dupe Bug with Oops

Boymann opened this issue ยท 8 comments

commented

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.

commented

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

commented

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.

commented

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.

commented

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

commented

@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.

commented

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.

commented

@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.

commented

3c61f58 should fix it