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

Server crashes on load block #96

Open
Nat392 opened this issue Aug 10, 2023 · 4 comments
Open

Server crashes on load block #96

Nat392 opened this issue Aug 10, 2023 · 4 comments

Comments

@Nat392
Copy link

Nat392 commented Aug 10, 2023

Hello, I've had this crash for a few days and I can't find the cause. It happens about 1 out of every 3 reboots, with the same ID and block.

A PLUGIN WAS INVOLVED IN THIS CRASH
BAD PLUGIN: Customies

Thread: AsyncWorker#1
Error: Block ID 10811 is already used by another block
File: pmsrc/src/block/RuntimeBlockStateRegistry
Line: 93
Type: InvalidArgumentException
Backtrace:
#0 /home/container/plugins/Customies/src/block/CustomiesBlockFactory(88): pocketmine\block\RuntimeBlockStateRegistry->register(object sulfu\core\block\SulfuOre#45127)
#1 /home/container/plugins/Customies/src/task/AsyncRegisterBlocksTask(39): customiesdevs\customies\block\CustomiesBlockFactory->registerBlock(object Closure#17, string[19] customies:sulfu_ore, null, null, object Closure#45144, object Closure#45142)
#2 pmsrc/src/scheduler/AsyncTask(82): customiesdevs\customies\task\AsyncRegisterBlocksTask->onRun()
#3 (): pocketmine\scheduler\AsyncTask->run()
        $id = BlockTypeIds::newId();
        CustomiesBlockFactory::getInstance()->registerBlock(
            static fn() => new SulfuOre(new BI($id), "sulfu_ore", new BlockTypeInfo(new BlockBreakInfo(0.3))),
            BlockIdentifier::SULFU_ORE,
            new Model(
                [
                    new Material(Material::TARGET_ALL, "sulfu_ore", Material::RENDER_METHOD_ALPHA_TEST)
                ],
                "geometry.block",
                new Vector3(-8, 0, -8),
                new Vector3(16, 16, 16),
                1
            ),
            new CreativeInventoryInfo(CreativeInventoryInfo::CATEGORY_ITEMS, CreativeInventoryInfo::NONE)
        );

And apparently, I'm not the only one this happens to, according to a reply I got on the discord.

Thanks!

@TitaniumLB6571
Copy link

you have to create a new id everytime you make a new block, by every new instance just add $id = BlockTypeIds::newId();

Otherwise you will register the blocks with the same $Id variable, do you understand?

if not here is example

$id = 1;

registerBlock($id (which = 1))

registering a new block with same $id variable

registerBlock($id (which = 1))

then you get that error

so just create new $Id variable above the instance of registering the block
like so

$id = 1;

registerBlock($id (which = 1))

$id = 2;

registerBlock($id (which = 2))

@Nat392
Copy link
Author

Nat392 commented Aug 18, 2023

That's what I do, but it doesn't change anything.

@Nat392
Copy link
Author

Nat392 commented Aug 18, 2023

$id is only for the first block, after $id2, etc.

@Phqzing
Copy link

Phqzing commented Jun 11, 2024

same problem as mine

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

No branches or pull requests

3 participants