Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/main/java/dev/amble/ait/mixin/server/ServerPlayerMixin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package dev.amble.ait.mixin.server;

import dev.amble.ait.core.AITItems;
import dev.amble.ait.core.item.SiegeTardisItem;
import dev.amble.ait.core.tardis.manager.ServerTardisManager;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -11,6 +17,8 @@
import dev.amble.ait.core.tardis.util.TardisUtil;
import dev.amble.ait.core.world.TardisServerWorld;

import java.util.Objects;

@Mixin(ServerPlayerEntity.class)
public class ServerPlayerMixin {

Expand All @@ -31,4 +39,26 @@ public class ServerPlayerMixin {
if (player.hasVehicle() && player.getVehicle() instanceof FlightTardisEntity)
ci.cancel();
}

@Inject(method = "onDeath", at = @At("HEAD"))
public void ait$onDeath(DamageSource damageSource, CallbackInfo ci) {
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;

ServerTardisManager.getInstance().forEach(tardis -> {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not.

Copy link
Member

@drtheodor drtheodor Sep 26, 2025

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.

Copy link
Member

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

Copy link
Member Author

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 (!tardis.siege().isActive())
return;

if (!Objects.equals(tardis.siege().getHeldPlayerUUID(), player.getUuid()))
return;

for (ItemStack itemStack : player.getInventory().main) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats horrible

if (itemStack.isOf(AITItems.SIEGE_ITEM)) {
if (tardis.getUuid().equals(SiegeTardisItem.getTardisIdStatic(itemStack))) {
player.getInventory().setStack(player.getInventory().getSlotWithStack(itemStack), Items.AIR.getDefaultStack());
}
}
}
SiegeTardisItem.placeTardis(tardis, SiegeTardisItem.fromEntity(player));
});
}
}
Loading