Actually Additions

Actually Additions

66M Downloads

Vampirism bat mode makes storage crate upgrades destroy crate contents without upgrading

Tarod7 opened this issue ยท 7 comments

commented

version 1.10.2 minecraft with forge 12.18.3.2281

on Actually Additions r105 with Vampirism 1.1.0 beta.2

Going to post this over on the Vampirism mod issue page as well.

to get into bat mode you use the
/vampirism level Vampire 10 "playername"
command

Let me know if you anything clairified.

commented

This doesn't make any sense at all, as I just use the normal right clicking behavior code.
Something weird must be going on with Vampirism.

commented

Bat mode is supposed to disable most actions. I'm not sure if that has anything todo with it.

commented

This is what he said in the other thread.

Thx for reporting. I might have found the problem already, but I don't have time to think about a solution right now.
Just writing down, what I found out:
When upgrading a chest, ActualllyAdditions copies the inventory from the old tile entity, then changes the block and writes the items to the new inventory in Item#onUse and returns EnumActionResult.SUCCESS

public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float par8, float par9, float par10){

After the blocks have been changed, Forge posts a BlockEvent.PlaceEvent which is canceled by Vampirism.
ForgeHooks#onPlaceItemIntoWorld around line 800.
Because the event is canceled, Forge rolls back any block changes. During that rollback the chest/tile entity content is somehow lost. It seems that Forge tries to reconver the TE data, but it does not seem to work.
Will take a closer look at this soon

commented

Looks like he may have made it so instead of disabling block placement it lets you place and immediately breaks the block and returns it to you.

commented

Seems to be an issue on Vampirism's side then. Closing for now.

commented

Is there a specific reason you are clearing out the old chest's/TileEntity's inventory?

The problem is: The BlockPlace event is thrown after the item placed the block. If the event is canceled by any mod (e.g. Vampirism) Minecraft restores the Block and the TileEntity. But since you cleared the inventory of the old tile before it was stored (during setBockState of the new chest), it's inventory is empty and all items are lost.