public void EntityInteraction(IEntity player, IEntity target, McpeInventoryTransaction.ItemUseOnEntityAction action) { switch (action) { case McpeInventoryTransaction.ItemUseOnEntityAction.Interact: { var packet = new InteractEntityPacket(); packet.EntityId = (int)target.EntityId; packet.Type = 0; packet.Hand = 0; SendPacket(packet); } break; case McpeInventoryTransaction.ItemUseOnEntityAction.Attack: { var packet = new InteractEntityPacket(); packet.EntityId = (int)target.EntityId; packet.Type = 1; SendPacket(packet); } break; case McpeInventoryTransaction.ItemUseOnEntityAction.ItemInteract: break; } }
public void EntityInteraction(IEntity player, IEntity target, McpeInventoryTransaction.ItemUseOnEntityAction action) { if (player is Player p) { var itemInHand = p.Inventory[p.Inventory.SelectedSlot]; // WorldProvider?.GetChatReceiver?.Receive(new ChatObject($"(CLIENT) Hit entity: {target.EntityId} | Action: {action.ToString()} | Item: {itemInHand.Id}:{itemInHand.Meta} ({itemInHand.Name})")); var packet = McpeInventoryTransaction.CreateObject(); packet.transaction = new Transaction() { TransactionType = McpeInventoryTransaction.TransactionType.ItemUseOnEntity, ActionType = (int)action, Item = MiNET.Items.ItemFactory.GetItem(itemInHand.Id, itemInHand.Meta, itemInHand.Count), EntityId = target.EntityId }; SendPacket(packet); } }
/// <summary> /// /// </summary> /// <param name="entity">The entity the player has interacted with</param> /// <param name="source">The player that initiated the interaction</param> /// <param name="action">The action that got initiated</param> public EntityInteractEvent(MiNET.Entities.Entity entity, OpenPlayer source, McpeInventoryTransaction.ItemUseOnEntityAction action) : base(entity) { SourcePlayer = source; Action = action; }
public override void EntityInteraction(Entity player, Entity target, McpeInventoryTransaction.ItemUseOnEntityAction action) { }
public void EntityInteraction(IEntity player, IEntity target, McpeInventoryTransaction.ItemUseOnEntityAction action) { }
public abstract void EntityInteraction(Entity player, Entity target, McpeInventoryTransaction.ItemUseOnEntityAction action);
public void EntityInteraction(IEntity player, IEntity target, McpeInventoryTransaction.ItemUseOnEntityAction action) { throw new NotImplementedException(); }