player swaps hands event
This commit is contained in:
1 parent
9d619f4797
commit
786e282889
7 files changed
+30
No files matched your search
@@ -37,6 +37,7 @@ import static carpet.script.CarpetEventServer.Event.PLAYER_STARTS_SNEAKING;
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_STARTS_SPRINTING;
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_STOPS_SNEAKING;
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_STOPS_SPRINTING;
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_SWAPS_HANDS;
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_SWITCHES_SLOT;
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_USES_ITEM;
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_WAKES_UP;
|
||||
@@ -67,6 +68,17 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
|
||||
PLAYER_DROPS_ITEM.onPlayerEvent(player);
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerAction", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;",
|
||||
ordinal = 0,
|
||||
shift = At.Shift.BEFORE
|
||||
))
|
||||
private void onHandSwap(PlayerActionC2SPacket playerActionC2SPacket_1, CallbackInfo ci)
|
||||
{
|
||||
PLAYER_SWAPS_HANDS.onPlayerEvent(player);
|
||||
}
|
||||
|
||||
@Inject(method = "onPlayerAction", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;dropSelectedItem(Z)Z",
|
||||
|
||||
@@ -532,6 +532,14 @@ public class CarpetEventServer
|
||||
}, player::getCommandSource);
|
||||
}
|
||||
},
|
||||
PLAYER_SWAPS_HANDS("player_swaps_hands", 1, false)
|
||||
{
|
||||
@Override
|
||||
public void onPlayerEvent(ServerPlayerEntity player)
|
||||
{
|
||||
handler.call( () -> Collections.singletonList(((c, t) -> new EntityValue(player))), player::getCommandSource);
|
||||
}
|
||||
},
|
||||
PLAYER_TAKES_DAMAGE("player_takes_damage", 4, false)
|
||||
{
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user