Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions block-update-system/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 1 addition & 4 deletions blocks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
dependencies {
compileOnly(project(":core"))
compileOnly(project(":block-update-system"))
compileOnly(project(":entity-meta"))
compileOnly(project(":datapack-loading"))
api(project(":core"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package net.minestom.vanilla.blocks;

import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
import net.minestom.server.MinecraftServer;
import net.minestom.vanilla.blocks.group.VanillaBlockBehaviour;
import net.minestom.vanilla.blocks.group.behaviour.BehaviourGroup;

public class BlockBehaviorRuleRegistrations {
private static final ComponentLogger logger = MinecraftServer.LOGGER;

public static void registerDefault() {
register(VanillaBlockBehaviour.CRAFTING_TABLE);
register(VanillaBlockBehaviour.ANVIL);
register(VanillaBlockBehaviour.BREWING_STAND);
register(VanillaBlockBehaviour.LOOM);
register(VanillaBlockBehaviour.GRINDSTONE);
register(VanillaBlockBehaviour.SMITHING_TABLE);
register(VanillaBlockBehaviour.CARTOGRAPHY_TABLE);
register(VanillaBlockBehaviour.STONECUTTER);
register(VanillaBlockBehaviour.ENCHANTING_TABLE);
register(VanillaBlockBehaviour.TRAPDOOR);
register(VanillaBlockBehaviour.FENCE_GATE);
register(VanillaBlockBehaviour.COPPER);
register(VanillaBlockBehaviour.WOODEN_DOORS);
register(VanillaBlockBehaviour.SIGNS);
register(VanillaBlockBehaviour.CAKE);
register(VanillaBlockBehaviour.CANDLE_CAKE);
register(VanillaBlockBehaviour.STRIPPABLE_WOOD);
}

public static void register(BehaviourGroup... blockGroups) {
var blockManager = MinecraftServer.getBlockManager();
int count = 0;

for (BehaviourGroup group : blockGroups) {
var blockGroup = group.getBlockGroup();
for (var block : blockGroup.allMatching()) {
count++;
var handler = group.createHandler(block);
blockManager.registerHandler(block.key().asString(), () -> handler);
}
}

logger.info("Registered " + count + " handlers");
}
}
Loading