blob: 05540c90e7ec35137002eb55d43e1cb1f6a07874 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package com.anthonyhilyard.iceberg.mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.server.level.ServerPlayer;
import com.anthonyhilyard.iceberg.network.IcebergNetworkProtocol;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(ItemEntity.class)
public class ItemEntityMixin
{
@Inject(method = { "playerTouch" },
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;take(Lnet/minecraft/world/entity/Entity;I)V", ordinal = 0, shift = Shift.AFTER))
private void onPlayerTouch(Player player, CallbackInfo info)
{
if (player instanceof ServerPlayer)
{
IcebergNetworkProtocol.sendItemPickupEvent((ServerPlayer)player, ((ItemEntity)(Object)this).getItem());
}
}
}
|