ContainerMenu is an API for BDSX that allows you to create fake interactive container menus !

Overview
logo

ContainerMenu - A BDSX API

ContainerMenu is an API for BDSX that allows you to create fake interactive container menus !


Features

  • Multiple containers support

  • Item transactions detection

  • container close detection

  • possibility to dynamically change items

  • custom container name !

  • easy to use API

Available container types

  • Chest

  • Double chest

  • Trapped chest

  • Double trapped chest

  • Hopper

  • Dropper

  • Dispenser

...and more to come !

Soon to be added

  • Handling of non cancelled item transactions (possibility to take/place items)

  • More container types

Installation

Installing as an npm module

run this command in your bdsx directory :

npm i @bdsx/containermenu

You can also use bdsx's plugin-manager

Installing as a standalone plugin

clone the repository in your plugins directory :

git clone https://github.com/Se7en-dev/ContainerMenu.git

Usage examples

You can simply create and display a fake chest this way :

const container = ContainerMenu.create(player, FakeContainerType.Chest);
container.sendToPlayer();

everything else is handled automatically !

You can add/delete items to the container this way :

// Sets the item in slot 0
container.setItem(0, ItemStack.constructWith("minecraft:diamond", 64));
// Adds the item to the first empty slot
container.addItem(ItemStack.constructWith("minecraft:diamond", 64));
// Set multiple items at once
container.setContents({
            5: ItemStack.constructWith("minecraft:gold_ingot", 1),
            7: ItemStack.constructWith("minecraft:iron_ingot", 1),
            9: ItemStack.constructWith("minecraft:emerald", 1),
        });
// Clears the item in slot 5
container.clearItem(5);
// Clears all items
container.clearContents();

no need to destruct the ItemStacks, it is done automatically after the container is closed

Other features :

// Set a custom name to the container
// (must be called before sending the container)
container.setCustomName("BDSX is awesome !");
// Closes the container client-side, and destructs it.
container.closeContainer();

Using callbacks :

container.onTransaction((action) => {
    // Do something here...
});

container.onContainerClose(() => {
    // Do something here...
});

nb: returning CANCEL for item transactions does not change anything for now. In the future, Items will be able to be placed and taken unless CANCEL is returned.

Simple examples

Sends a message when a diamond is clicked :

const container = ContainerMenu.create(actor, FakeContainerType.Chest);
        container.addItem(ItemStack.constructWith("minecraft:iron_ingot", 1));
        container.addItem(ItemStack.constructWith("minecraft:gold_ingot", 1));
        container.addItem(ItemStack.constructWith("minecraft:diamond", 1));
        container.sendToPlayer();
        container.onTransaction((action) => {
            if(action.type === ItemStackRequestActionType.Take && container.getItem(action.getSrc().slot)?.getName() === "minecraft:diamond") {
                container.closeContainer();
                actor.sendMessage("You have clicked the diamond!");
            }
        });

Sends a message when the player closes the container:

const container = ContainerMenu.create(actor, FakeContainerType.Chest);
        container.sendToPlayer();
        container.onContainerClose(() => {
            actor.sendMessage("Container closed !");
        });

Advanced usage

Item destruction :

When creating a fake container, if destructItems is set to true, items will be automatically destructed on container close. If set to false they won't, and need to be destructed manually (if needed to).

// The items will not be destructed when the container is closed
const container = ContainerMenu.create(actor, FakeContainerType.DoubleChest, false);

This parameter can be overriden when calling item-related methods :

// The old item at slot 0 will not be destructed (destructItems is set to false)
container.setItem(0, ItemStack.constructWith("minecraft:diamond", 1));
// The old item at slot 0 will be destructed (destructItems is overriden to true)
container.setItem(0, ItemStack.constructWith("minecraft:diamond", 1), true);

All items can be destructed at once :

// This is called automatically if destructItems is set to true
container.destructAllItems();

Credits

API base by @Rjlintkh

This plugin is licensed under GNU General Public License v3.0

Feel free to contribute :)

You might also like...

"To-do list" is a tool that helps to organize your day. It simply lists the things that you need to do and allows you to mark them as complete. You will build a simple website that allows for doing that, and you will do it using ES6 and Webpack!

To-do-list Description "To-do list" is a tool that helps to organize your day. It simply lists the things that you need to do and allows you to mark t

Oct 18, 2022

A jQuery plugin allowing you to scroll an image within a container element

A jQuery plugin allowing you to scroll an image within a container element

jQuery Scroll Image Inside v0.1 A jQuery plugin allowing you to scroll an image within a container element Usage div id="window" img src="reall

Apr 11, 2021

A free and open source api server for app "Fake Location @ 1.3.0.2"

FakeLocation-Server 中文 Introduction A fake api server for FakeLocation App Unlock all apps limitation and you can use pro version permanently for free

Dec 13, 2022

A free and open source api server for app "Fake Location @ 1.3.0.2"

FakeLocation-Server 中文 Introduction A fake api server for FakeLocation App Unlock all apps limitation and you can use pro version permanently for free

Jul 4, 2022

The (extremely) lightweight alternative to the mmenu.js plugin for creating off-canvas mobile menus.

The (extremely) lightweight alternative to the mmenu.js plugin for creating off-canvas mobile menus.

mmenu light The (extremely) lightweight alternative to the mmenu.js plugin for creating off-canvas mobile menus with the exact look and feel. Examples

Dec 12, 2022

Converts select multiple elements into dropdown menus with checkboxes

jquery-multi-select Converts select multiple elements into dropdown menus with a checkbox for each option. The original select element is hidden

Dec 8, 2022

A pure CSS library for radial lists and menus

A pure CSS library for radial lists and menus

Radial menu and radial list A pure CSS library for inline lists and menus around a circle, flexible and customizable A radial layout organizes a list

Aug 15, 2022

A table component for your Mantine data-rich applications, supporting asynchronous data loading, column sorting, custom cell data rendering, row context menus, dark theme, and more.

A table component for your Mantine data-rich applications, supporting asynchronous data loading, column sorting, custom cell data rendering, row context menus, dark theme, and more.

Mantine DataTable A "dark-theme aware" table component for your Mantine UI data-rich applications, featuring asynchronous data loading support, pagina

Jan 4, 2023

A good looking help command made with discord.js with select menus. Works with prefix and slash commands too!

A good looking help command made with discord.js with select menus. Works with prefix and slash commands too!

fancy-help-command A good looking help command made with discord.js with select menus. Works with prefix and slash commands too! Dependencies: Select

Dec 12, 2022
Owner
Se7en
CS student. I am also interested in cybersecurity and graphic design.
Se7en
Generate deterministic fake values: The same input will always generate the same fake-output.

import { copycat } from '@snaplet/copycat' copycat.email('foo') // => '[email protected]' copycat.email('bar') // => 'Thurman.Schowalter668@

Snaplet 201 Dec 30, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Load LiteXLoader JS plugins in BDSX!

BDSX-LXL: Load LiteXLoader JS plugins in BDSX! Background Both LiteXLoader (LXL) and Bedrock Dedicated Server eXtended (BDSX) are popular options of l

PneuJai 8 Oct 30, 2022
Custom shop plugins available in BDSX.

Custom shop Plugin Custom shop plugins available in BDSX. BDSX 커스텀 상점 플러그인 사용법 엔티티한테 태그를 추가하여 상점을 제작할 수 있습니다. 상점은 엔티티를 공격하여 열 수 있습니다. 태그: shop[아이템1_ID

연두 7 Sep 27, 2022
Jetcap is a free online REST API that you can use whenever you need some fake data ✨

Jetcap Jetcap is a simple fake REST API for testing and prototyping. When to use ✨ Jetcap is a free online REST API that you can use whenever you need

Rades Pratama 8 Nov 13, 2022
A free JavaScript plugin to create custom right click context menus.

CtxMenu (Javascript) A modern, light weight, object oriented solution for adding right click context menus for your website. demo Installation Downloa

Nils Söderman 18 Oct 13, 2022
Base-mock-api - Repo to storage my fake api's to use in my 2022 projects.

Base Mock API's Project made 100% with JavaScript, with the objective of creating endpoints to use in projects. Prerequisites Before you begin, ensure

Arthur Cabral 0 Nov 20, 2022
A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic animation.

Lava-Lamp Description: A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic anima

Richard Hung 38 Jun 4, 2022