mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-11 22:45:38 -04:00
Rename includeData to requestIncludeData and improve docs.
This commit is contained in:
parent
e496eb156b
commit
334f9fee6f
2 changed files with 8 additions and 8 deletions
fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric
|
@ -71,11 +71,11 @@ public final class PlayerPickItemEvents {
|
|||
* @param player the player attempting to pick an item from a block
|
||||
* @param pos the position of the block being picked from
|
||||
* @param state the state of the block being picked from
|
||||
* @param includeData whether block entity data should be included in the pick item stack
|
||||
* @param requestIncludeData whether the client has requested additional data to be included in the picked item stack
|
||||
* @return a pick item stack to give to the player, or {@code null} if the default pick item stack should be given
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack onPickItemFromBlock(ServerPlayerEntity player, BlockPos pos, BlockState state, boolean includeData);
|
||||
ItemStack onPickItemFromBlock(ServerPlayerEntity player, BlockPos pos, BlockState state, boolean requestIncludeData);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
|
@ -85,10 +85,10 @@ public final class PlayerPickItemEvents {
|
|||
*
|
||||
* @param player the player attempting to pick an item from a entity
|
||||
* @param entity the entity being picked from
|
||||
* @param includeData whether additional data should be included in the pick item stack; unused in vanilla
|
||||
* @param requestIncludeData whether the client has requested additional data to be included in the picked item stack; unused in vanilla
|
||||
* @return a pick item stack to give to the player, or {@code null} if the default pick item stack should be given
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack onPickItemFromEntity(ServerPlayerEntity player, Entity entity, boolean includeData);
|
||||
ItemStack onPickItemFromEntity(ServerPlayerEntity player, Entity entity, boolean requestIncludeData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ public abstract class ServerPlayNetworkHandlerMixin {
|
|||
}
|
||||
|
||||
@WrapOperation(method = "onPickItemFromBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getPickStack(Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;Z)Lnet/minecraft/item/ItemStack;"))
|
||||
public ItemStack onPickItemFromBlock(BlockState state, WorldView world, BlockPos pos, boolean includeData, Operation<ItemStack> operation, @Local PickItemFromBlockC2SPacket packet) {
|
||||
ItemStack stack = PlayerPickItemEvents.BLOCK.invoker().onPickItemFromBlock(player, pos, state, includeData);
|
||||
public ItemStack onPickItemFromBlock(BlockState state, WorldView world, BlockPos pos, boolean includeData, Operation<ItemStack> operation, @Local(argsOnly = true) PickItemFromBlockC2SPacket packet) {
|
||||
ItemStack stack = PlayerPickItemEvents.BLOCK.invoker().onPickItemFromBlock(player, pos, state, packet.includeData());
|
||||
|
||||
if (stack == null) {
|
||||
return operation.call(state, world, pos, includeData);
|
||||
|
@ -62,8 +62,8 @@ public abstract class ServerPlayNetworkHandlerMixin {
|
|||
}
|
||||
|
||||
@WrapOperation(method = "onPickItemFromEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getPickBlockStack()Lnet/minecraft/item/ItemStack;"))
|
||||
public ItemStack onPickItemFromEntity(Entity entity, Operation<ItemStack> operation, @Local PickItemFromEntityC2SPacket packet) {
|
||||
ItemStack stack = PlayerPickItemEvents.ENTITY.invoker().onPickItemFromEntity(player, entity, packet.includeData() && player.isInCreativeMode());
|
||||
public ItemStack onPickItemFromEntity(Entity entity, Operation<ItemStack> operation, @Local(argsOnly = true) PickItemFromEntityC2SPacket packet) {
|
||||
ItemStack stack = PlayerPickItemEvents.ENTITY.invoker().onPickItemFromEntity(player, entity, packet.includeData());
|
||||
|
||||
if (stack == null) {
|
||||
return operation.call(entity);
|
||||
|
|
Loading…
Add table
Reference in a new issue