Galacticraft Extended Item Compatibility with Graves
Mochnant opened this issue ยท 8 comments
It does not appear that OpenBlocks graves store Galacticraft extended items (oxygen mask, tanks, cold weather clothing, etc). Can support for this be added? Thank you!
See related thread where Galacticraft added API support for this:
micdoodle8/Galacticraft#1259
New API function:
micdoodle8.mods.galacticraft.api.inventory.AccessInventoryGC.getGCInventoryForPlayer(player)
Umm, before I add dependency on extra API, I would like to point out that there is already well accepted solution, build directly into Forge.
Wrapping this with
event.entityLiving.captureDrops = true;
...
event.entityLiving.captureDrops = false;
and changing Entity.dropPlayerItemWithRandomChoice
to just Entity.func_146097_a
will cause items to be added to event, instead of just dropping in world (it will be dropped after event is handled).
Changing it will cause items to be added to event which we handle here (notice low priority on event), instead of being hidden from all mods. No change in behaviour expected.
Also, I suspect (based on quick look at drops code) that current behaviour may destroy normal drops (see 'ForgeHooks.java:351' which is actual implementation of Entity.dropPlayerItemWithRandomChoice
. capturedDrops
is same collection as one actually used at EntityPlayer.java:737
and contains all item to be dropped)!
Hi, I'm co-dev of Galacticraft. Thank you for this, it is super helpful.
Especially this:
Also, I suspect (based on quick look at drops code) that current behaviour may destroy normal drops (see 'ForgeHooks.java:351' which is actual implementation of Entity.dropPlayerItemWithRandomChoice. capturedDrops is same collection as one actually used at EntityPlayer.java:737 and contains all item to be dropped)!
That in our code which was added around 1 week back is indeed causing loss of vanilla inventory items, as you suspect! micdoodle8/Galacticraft#1395 micdoodle8/Galacticraft#1288
I'll see if I can fix all of this together now.
micdoodle8/Galacticraft@f6c9831
Easy after you told me how. Thank you once again, I really appreciate it.
I see the
player.capturedDrops.clear();
in ForgeHooks.onPlayerTossEvent which I guess was the source of the inventory loss, thanks for the heads up on that.
If anything else is needed for 100% compatibility with OpenBlocks, please let me know.
@boq Not sure when this version will be released and make it to my server, but I think it is likely safe to close this now on the OpenBlocks end. I'll reopen if required later. Thanks again!
For reference, the commit in Galacticraft:
micdoodle8/Galacticraft@f6c9831
@Mochnant that commit is already in the latest Galacticraft version 3.0.7.256. We've flagged it as a "Stable" build to encourage players to update to it. If your players are on 3.0.7.252 already then you can safely update the server to .256 even before all the players have updated - .252 players will still be able to connect to the server OK.
@radfast Thank you for that info. Unfortunately we're using Crackpack which on 3.0.6.250, and the update may be a little while. I'll see if I can poke the Crackpack folks.