You're in Grave Danger

You're in Grave Danger

18M Downloads

Deletion of items from interaction with Create's mechanical drills.

GoliathX211 opened this issue ยท 14 comments

commented

Create drills break the grave and do not put player items in storage, but only the grave block without any NBT.

To Reproduce
Steps to reproduce the behavior:

  1. Die to create a grave block
  2. Make create contraption break grave block
  3. Place grave and try to obtain items
  4. Notice it doesn't give you your stuff back

Expected behavior
Have it put a grave with NBT in the contraption storage.
Or place all of player items in contraption storage

A possible fix could be to make the graves have the forge:unbreakable tag which should prevent it from being broken by mechanical drills. I believe there is also a tag that create implements to make blocks unbreakable by its machinery.

  • OS: Windows
  • Minecraft Version: 1.19.2
  • Version: youre-in-grave-danger-1.49
commented

I don't know why I've never really tried looking at block tags from create before. It looks to me though however there's only a block tag that will make blocks unmovable, not undestructable, that create uses. If you can prove me wrong, please let me know, but so far I can't find a way to make the graves withstand create block removal contraptions

commented

I do think I am wrong about the tag. I must've been thinking of implementation rather. There is a way that you may be able to prevent Create from breaking your grave blocks by changing the block hardness to -1.
If you look at the code in the following link for BlockBreakingTileEntity#isBreakable(BlockState, float), you will notice that one way to make the method return false is if the block hardness is -1.
Let me know about your opinion on this possible solution.

Forge: BlockBreakingTileEntity.java
Fabric: BlockBreakingTileEntity.java

commented

If I would change hardness to -1 it would fix this yes. (And possibly some other incompat I've either fixed or that I don't know of)
However that would lead to the option of being able to break graves in order to retrieve the items would be impossible to use, as well, graves would not be able to be broken. What I can do is make every item in the grave drop if the grave has not been claimed when it's removed. This does however lead to the grave dropping its contents if you break it in creative mode too, which for server admins could be annoying I guess. It's probably this I will do to "fix" the issue. Should probably implement a config to turn this on and off though in case people actually don't want this.

commented

Breaking graves to retrieve the items in the grave is a functional way to retrieve the items, as long as you've configured the mod that way, yes. And digging into the code of where and how create destroys blocks is just something I can't really bother to do. At least not at the moment. But yeah I guess I could make a way so the grave with added NBT data is dropped, probably wouldn't be too hard, but no matter it will still be a way for players to maliciously destroy people's graves. Just thought dropping all items could be a good(ish) way as someone else suggested that because of this issue too. Might do both (and make it configurable between them), might leave it at dropping all items.
Worst case scenario you can just do /yigd restore or /yigd moderate and restore a player grave that way too.
I have to agree dropping items isn't the best of solutions, but it's the best I have for the amount of effort I'm willing to put into this issue. That or create adds a "unbreakable" block tag

commented

Very fair point. Whatever way you go about it, I respect the commitment of a developer to communicate and fix bugs. I have a mod for another game that I have been putting off updating for a while and I am trying to get back into reading some of the updated codebase to make a new version. Thanks for recognizing the issue.

commented

I'll see what I can do. On first thought it seems really easy but I do create the block object (including hardness) before the config is initialized. Could move it but we'll see. Great idea though

commented

Just another idea, not trying to push anything on you and your development but you already have a config for whether you can break the grave manually, would that allow you to also set the block hardness if it isn't configured that way so there wouldn't be any way to break the block, but it could only go away on interact?

commented

I do understand that there is a lot that I don't know about your implementation and usually people who add issues to the tracker don't usually suggest implementation details. So in that regard that will be the last I suggest to prevent from annoying you further. <3

commented

Is breaking graves to retrieve items a functional way to get items? One thing you might be able to do is rather to include some block data in the item nbt to be serialized on placement. When the Create contraptions break the grave, a grave block is dropped or added to storage. This would also make sure that if another player breaks a grave early, they would not be able to obtain the items.

commented

Mechanical drills and mechanical ploughs both break graves. I haven't tested all of Create's contraptions but I would imagine that in addition, the graves are broken when a contraption has to "settle" on the block that contains it.

commented

If Create contraptions generally just break graves and allow for the items to be retrieved, this could mean that other players could break a player's grave maliciously with contraptions to get the deceased player's items.

commented

Furthermore, I haven't tried making any functionality that would make a grave drop with NBT but I would maybe look into how blocks are placed with (+NBT) when Ctrl + Middle Click picked up in creative mode.

commented

I've put in a config making graves either drop all their contents, nothing, or the grave will all NBT in it now, when it's destroyed without anyone claiming it.
Haven't tested how it works when the grave disappears due to timeout if that setting is enabled but at least this is sort of "safer" or whatever.
Released a new version with this just now

commented

I forgot to thank you. Your work is appreciated and respected. <3