Fabric Mod

PlantFusionMod

Сгенерируй мод для улучшения системы выравнивания растений и сделай селекцию видов растений чтобы все растения Майнкрафта можно было соединять

src/main/java/eu/codexe/plantfusionmod/PlantFusionMod.java
package eu.codexe.plantfusionmod;

import eu.codexe.plantfusionmod.block.ModBlocks;
import eu.codexe.plantfusionmod.command.FusionCommand;
import eu.codexe.plantfusionmod.item.ModItems;
import eu.codexe.plantfusionmod.util.PlantFusionState;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class PlantFusionMod implements ModInitializer {
    public static final String MOD_ID = "plantfusionmod";

    @Override
    public void onInitialize() {
        ModBlocks.register();
        ModItems.register();

        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> FusionCommand.register(dispatcher));

        UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
            ItemStack stack = player.getStackInHand(hand);
            if (!stack.isOf(ModItems.PLANT_SELECTOR)) {
                return ActionResult.PASS;
            }

            if (world.isClient) {
                return ActionResult.SUCCESS;
            }

            BlockPos pos = hitResult.getBlockPos();
            BlockState state = world.getBlockState(pos);
            if (!PlantFusionState.isSupportedPlant(state)) {
                player.sendMessage(Text.translatable("message.plantfusionmod.unsupported_plant"), true);
                return ActionResult.CONSUME;
            }

            PlantFusionState.Selection selection = PlantFusionState.getOrCreate(player);
            if (selection.isEmpty()) {
                selection.setFirst(pos, state);
                player.sendMessage(Text.translatable("message.plantfusionmod.first_selected", state.getBlock().getName().getString()), true);
                world.playSound(null, pos, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, player.getSoundCategory(), 0.7f, 1.2f);
                return ActionResult.CONSUME;
            }

            if (selection.isSamePosition(pos)) {
                selection.clear();