-
-
Notifications
You must be signed in to change notification settings - Fork 30
Fix siege cubes remaining in player inventory on death via keepinventory #1913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This will prevent a siege cube from remaining in the player inventory on death when the gamerule keepinventory is true. This is to prevent a player from taking a siege cube into its TARDIS by setting their spawn point inside that TARDIS and dying with the siege cube in their inventory while outside of the TARDIS.
| public void ait$onDeath(DamageSource damageSource, CallbackInfo ci) { | ||
| ServerPlayerEntity player = (ServerPlayerEntity) (Object) this; | ||
|
|
||
| ServerTardisManager.getInstance().forEach(tardis -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ow. this is real bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy of your code. 😆
See here: https://github.com/amblelabs/ait/blame/bb56218359c19bebf28dd57c59a954fb00227022/src/main/java/dev/amble/ait/core/tardis/handler/SiegeHandler.java#L64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a part of my refactor, however, it wasn't my code. It was taken from here: cd7fa6b#diff-6d014cd6ae1f468da6e5be563db99c534c44490e608d092fbb092162b9269a6cL341-L351 and moved to the SiegeHandler so git blame thinks that it was me who put it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
29456f4 that's the commit that introduced it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you did the same thing as I did then. Copy it without changing it. :P
But jokes aside, I guess the point is moot anyways, now that this is not going to be used at all.
| if (!Objects.equals(tardis.siege().getHeldPlayerUUID(), player.getUuid())) | ||
| return; | ||
|
|
||
| for (ItemStack itemStack : player.getInventory().main) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats horrible
|
just prevent dropping siege cubes inside the tardis |
I thought about this first, but I assumed that if someone's game crashes while they have a cube in their inventory then there would be no exterior in the world anymore (not even in intem form). But I just tested in ingame and it seems the disconnect event ( with the real bad code :P ) is actually preventing that from happening as well. So I'll just prevent the dropping of the item in the same TARDIS then as you suggested. 🫡 |
|
Hmm, this problem is a bit more extensive than I initially thought. Will have to analyze this a bit more to cover all the bases. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
About the PR
Prevents siege cubes from staying in a player's inventory on death when the gamerule
keepinventoryis true.Originally reported by
amokdevon Discord here: https://discord.com/channels/1213989169878274068/1421125485362020525/1421134182800818206Why / Balance
So that a player, who set their spawn point inside a TARDIS, cannot take the siege cube inside of that TARDIS by dying with the siege cube in their inventory (while keepinventory is true).
Technical details
I hooked into the
onDeath()method of theServerPlayerand then check for siege cube items.If one is found, I remove it and place the TARDIS exterior at the position of the player.
That code is basically just copied over from how it is done when a player is disconnecting from the server with a siege cube in their inventory (see
ServerPlayConnectionEvents.DISCONNECTevent of theSiegeHandler)Requirements
Changelog
🆑