Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

events #7

Open
LorddesTodes opened this issue Nov 3, 2024 · 4 comments
Open

events #7

LorddesTodes opened this issue Nov 3, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@LorddesTodes
Copy link

make it so we can add events to a block like it does an event when a player walks ontop of the block

@wolfieboy09 wolfieboy09 self-assigned this Nov 3, 2024
@wolfieboy09 wolfieboy09 added the enhancement New feature or request label Nov 4, 2024
@wolfieboy09
Copy link
Owner

An idea would be using

ComputerCraftEvents.peripheral(event => {
    // First Param: peripheral type
    // Second Param: What block it goes to
    // Note: you can use regex for the second param

    event.registerPeripheral("absorber", "kubejs:absorber")
        .mainThreadMethod("get_fuel", (container, direction, arguments) => {
        
        })
    event.registerEvent("absorber", "kubejs:absorber")
        .mainThreadEvent("some_event", (container, direction) => {
                let aabb = AABB.ofBlock(container.up.pos)
                level.getEntitiesWithin(aabb).forEach(entity => {
                     return entity.UUID
                });
        })
})

(code from leon in the discord server).

Using event.registerEvent.

I'll see what I can do

@LorddesTodes
Copy link
Author

yes exactly like that but i didnt knew how i can make a example

@wolfieboy09
Copy link
Owner

That was a fast response.

didnt knew how i can make a example
It's okay. Leon created an example

@wolfieboy09
Copy link
Owner

I'll get started on that feature. Will have to figure it out lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants