player swaps hands event
This commit is contained in:
1 parent
9d619f4797
commit
786e282889
7 files changed
+30
No files matched your search
@@ -3267,6 +3267,7 @@ __on_player_places_block(player, item_tuple, hand, block) // player have just pl
|
|||||||
__on_player_interacts_with_entity(player, entity, hand)
|
__on_player_interacts_with_entity(player, entity, hand)
|
||||||
__on_player_chooses_recipe(player, recipe, full_stack)
|
__on_player_chooses_recipe(player, recipe, full_stack)
|
||||||
__on_player_switches_slot(player, from, to)
|
__on_player_switches_slot(player, from, to)
|
||||||
|
__on_player_swaps_hands(player)
|
||||||
__on_player_attacks_entity(player, entity)
|
__on_player_attacks_entity(player, entity)
|
||||||
__on_player_takes_damage(player, amount, source, source_entity)
|
__on_player_takes_damage(player, amount, source, source_entity)
|
||||||
__on_player_deals_damage(player, amount, entity)
|
__on_player_deals_damage(player, amount, entity)
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ __on_player_places_block(player, item_tuple, hand, block) // player have just pl
|
|||||||
__on_player_interacts_with_entity(player, entity, hand)
|
__on_player_interacts_with_entity(player, entity, hand)
|
||||||
__on_player_chooses_recipe(player, recipe, full_stack)
|
__on_player_chooses_recipe(player, recipe, full_stack)
|
||||||
__on_player_switches_slot(player, from, to)
|
__on_player_switches_slot(player, from, to)
|
||||||
|
__on_player_swaps_hands(player)
|
||||||
__on_player_attacks_entity(player, entity)
|
__on_player_attacks_entity(player, entity)
|
||||||
__on_player_takes_damage(player, amount, source, source_entity)
|
__on_player_takes_damage(player, amount, source, source_entity)
|
||||||
__on_player_deals_damage(player, amount, entity)
|
__on_player_deals_damage(player, amount, entity)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ __on_player_starts_sprinting
|
|||||||
__on_player_stops_sneaking
|
__on_player_stops_sneaking
|
||||||
__on_player_stops_sprinting
|
__on_player_stops_sprinting
|
||||||
__on_player_switches_slot
|
__on_player_switches_slot
|
||||||
|
__on_player_swaps_hands
|
||||||
__on_player_uses_item
|
__on_player_uses_item
|
||||||
__on_player_wakes_up
|
__on_player_wakes_up
|
||||||
__on_statistic
|
__on_statistic
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
__on_player_stops_sneaking
|
__on_player_stops_sneaking
|
||||||
__on_player_stops_sprinting
|
__on_player_stops_sprinting
|
||||||
__on_player_switches_slot
|
__on_player_switches_slot
|
||||||
|
__on_player_swaps_hands
|
||||||
__on_player_uses_item
|
__on_player_uses_item
|
||||||
__on_player_wakes_up
|
__on_player_wakes_up
|
||||||
__on_statistic
|
__on_statistic
|
||||||
|
|||||||
@@ -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_STARTS_SPRINTING;
|
||||||
import static carpet.script.CarpetEventServer.Event.PLAYER_STOPS_SNEAKING;
|
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_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_SWITCHES_SLOT;
|
||||||
import static carpet.script.CarpetEventServer.Event.PLAYER_USES_ITEM;
|
import static carpet.script.CarpetEventServer.Event.PLAYER_USES_ITEM;
|
||||||
import static carpet.script.CarpetEventServer.Event.PLAYER_WAKES_UP;
|
import static carpet.script.CarpetEventServer.Event.PLAYER_WAKES_UP;
|
||||||
@@ -67,6 +68,17 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
|
|||||||
PLAYER_DROPS_ITEM.onPlayerEvent(player);
|
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(
|
@Inject(method = "onPlayerAction", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;dropSelectedItem(Z)Z",
|
target = "Lnet/minecraft/server/network/ServerPlayerEntity;dropSelectedItem(Z)Z",
|
||||||
|
|||||||
@@ -532,6 +532,14 @@ public class CarpetEventServer
|
|||||||
}, player::getCommandSource);
|
}, 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)
|
PLAYER_TAKES_DAMAGE("player_takes_damage", 4, false)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -264,3 +264,9 @@ __on_player_switches_slot(player, from, to) ->
|
|||||||
print(' - from: '+ from);
|
print(' - from: '+ from);
|
||||||
print(' - to: '+ to);
|
print(' - to: '+ to);
|
||||||
);
|
);
|
||||||
|
|
||||||
|
__on_player_swaps_hands(player) -> (
|
||||||
|
print('');
|
||||||
|
print('__on_player_swaps_hands(player)');
|
||||||
|
print(' Player '+player+' swaps hands.')
|
||||||
|
);
|
||||||
Reference in new issue
Block a user