Skip to content

MiNET-CobwebSMP 1.13.0.20 (1.21.30)

Choose a tag to compare

@github-actions github-actions released this 01 Oct 07:47
· 73 commits to master since this release

Added new item events: ItemTransaction, ItemDrop.

Download MiNET.zip to get started.
Download MiNET.dll for updating.

Examples:

            player.ItemDrop += (o, eventArgs) =>
            {
                var item = eventArgs.Item;
                if (item is ItemMap)
                {
                    eventArgs.Cancel = true; // Player won't be able to drop ItemMap;
                }
            };

            player.ItemTransaction += (o, eventArgs) =>
            {
                if (eventArgs.Action is TakeAction action) // specify action type if needed
                {
                    if (action.Source.Slot == 8) // specify slot number if needed
                    {
                        eventArgs.Cancel = true; // Prevent player from taking things from inventory slot 8.
                    }
                    eventArgs.Cancel = true; // Prevent player from taking things.
                }

                if (eventArgs.Action is PlaceAction action2) // specify action type if needed
                {
                    if (action2.Destination.ContainerId == 7) // ContainerId 7 = Dropper (ContainerId enum coming soon)
                    {
                        eventArgs.Cancel = true; // Prevent player from placing things in dropper.
                    }
                }
                eventArgs.Cancel = true; // Lock player inventory completely
            };
        };