Не работает gui

Версия Minecraft
1.19+
API
Fabric
3
1
0
помогите новичку разобраться, не работает gui у блока, все что можно уже просмотрел, что-то поисправлял в коде, но все равно(
AmethystCleanerBlock:
public class AmethystCleanerBlock extends BlockWithEntity implements BlockEntityProvider {
    private static final VoxelShape SHAPE = AmethystCleanerBlock.createCuboidShape(0,0,0,16, 12,16);
    public AmethystCleanerBlock(Settings settings) {
        super(settings);
    }

    @Override
    public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
        return SHAPE;
    }

    @Override
    public BlockRenderType getRenderType(BlockState state) {
        return BlockRenderType.MODEL;
    }

    @Nullable
    @Override
    public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
        return new AmethystCleanerBlockEntity(pos, state);
    }

    @Override
    public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
        if(state.getBlock()!=newState.getBlock()){
            BlockEntity blockEntity = world.getBlockEntity(pos);
            if(blockEntity instanceof  AmethystCleanerBlockEntity){
                ItemScatterer.spawn(world, pos, (AmethystCleanerBlockEntity)blockEntity);
                world.updateComparators(pos, this);
            }
        }
        super.onStateReplaced(state, world, pos, newState, moved);
    }

    @Override
    public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
        if(!world.isClient){
            NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos);
            if(screenHandlerFactory != null){
                player.openHandledScreen(screenHandlerFactory);
            }
        }
        return ActionResult.SUCCESS;
    }

    @Nullable
    @Override
    public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
        return checkType(type, AVBlockEntities.AMETHYST_CLEANER_BLOCK_ENTITY_TYPE,AmethystCleanerBlockEntity::tick);
    }
}
AmethystCleanerBlockEntity:
public class AmethystCleanerBlockEntity extends BlockEntity implements NamedScreenHandlerFactory, ImplementedInventory {
    private final DefaultedList<ItemStack> inventory= DefaultedList.ofSize(2,ItemStack.EMPTY);
    private static final int INPUT_SLOT = 0;
    private static final int OUTPUT_SLOT = 1;
    protected final PropertyDelegate propertyDelegate;
    private int progress = 0;
    private int maxProgress= 100;

    public AmethystCleanerBlockEntity(BlockPos pos, BlockState state) {
        super(AVBlockEntities.AMETHYST_CLEANER_BLOCK_ENTITY_TYPE, pos, state);
        this.propertyDelegate = new PropertyDelegate() {
            @Override
            public int get(int index) {
                return switch(index){
                    case 0 -> AmethystCleanerBlockEntity.this.progress;
                    case 1 -> AmethystCleanerBlockEntity.this.maxProgress;
                    default -> 0;
                };
            }

            @Override
            public void set(int index, int value) {
                switch(index){
                case 0 -> AmethystCleanerBlockEntity.this.progress = value;
                case 1 -> AmethystCleanerBlockEntity.this.maxProgress = value;}
            }

            @Override
            public int size() {
                return 2;
            }
        };
    }


    public void writeScreenOpeningData(ServerPlayerEntity player, PacketByteBuf buf) {
        buf.writeBlockPos(this.pos);
    }

    @Override
    public Text getDisplayName() {
        return Text.literal("Amethyst Cleaner");
    }

    @Nullable
    @Override
    public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player) {
        return new AVCleanerScreenHandler(syncId, inv, this, this.propertyDelegate);

    }

    @Override
    public DefaultedList<ItemStack> getItems() {
        return inventory;
    }

    public static void tick(World world, BlockPos blockPos, BlockState state, AmethystCleanerBlockEntity entity) {
        if(world.isClient()) {
            return;
        }
        if(hasRecipe(entity)){
            entity.progress++;
            markDirty(world,blockPos,state);
            if(entity.progress>= entity.maxProgress){
                craftItem(entity);
            }
        }else{
            entity.resetProgress();
            markDirty(world,blockPos,state);
        }
    }

    private static boolean hasRecipe(AmethystCleanerBlockEntity entity) {
        SimpleInventory inventory = new SimpleInventory(entity.size());
        for(int i = 0;i< entity.size();i++){
            inventory.setStack(i,entity.getStack(i));
        }
        boolean hasAmethystInFSlot = entity.getStack(1).getItem()== Items.AMETHYST_SHARD;
        return  hasAmethystInFSlot && canInsertAmountIntoOutputSlot(inventory) && canInsertItemIntoOutputSlot(inventory, items.PURE_AMETHYST);
    }

    private static boolean canInsertItemIntoOutputSlot(SimpleInventory inventory, Item output) {
        return inventory.getStack(2).getItem() == output || inventory.getStack(2).isEmpty();
    }

    private static boolean canInsertAmountIntoOutputSlot(SimpleInventory inventory) {
        return inventory.getStack(2).getMaxCount() > inventory.getStack(2).getCount();
    }
    private static void craftItem(AmethystCleanerBlockEntity entity) {
        SimpleInventory inventory = new SimpleInventory(entity.size());
        for (int i = 0; i < entity.size(); i++) {
            inventory.setStack(i, entity.getStack(i));
        }

        if(hasRecipe(entity)) {
            entity.removeStack(1, 1);

            entity.setStack(2, new ItemStack(Items.AMETHYST_SHARD,
                    entity.getStack(2).getCount() + 1));

            entity.resetProgress();
        }
    }
    private void resetProgress() {
        this.progress = 0;
    }

    @Override
    protected void writeNbt(NbtCompound nbt){
        super.writeNbt(nbt);
        Inventories.writeNbt(nbt, inventory);
        nbt.putInt("amethyst_cleaner.progress", progress);
    }
    @Override
    public void readNbt(NbtCompound nbt) {
        super.readNbt(nbt);
        Inventories.readNbt(nbt, inventory);
        progress = nbt.getInt("amethyst_cleaner.progress");
    }

}
AVCleanerScreenHandler:
public class AVCleanerScreenHandler extends ScreenHandler {
    private final Inventory inventory;
    private final PropertyDelegate propertyDelegate;
    protected AVCleanerScreenHandler(int syncId, PlayerInventory inventory) {
        this(syncId, inventory, new SimpleInventory(2), new ArrayPropertyDelegate(2));
    }
    public AVCleanerScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate delegate) {
        super(AVScreenHadlers.AV_SCREEN_HANDLER, syncId);
        checkSize(inventory, 2);
        this.inventory = inventory;
        inventory.onOpen(playerInventory.player);
        this.propertyDelegate = delegate;

        this.addSlot(new Slot(inventory, 0, 90, 15));
        this.addSlot(new Slot(inventory, 1, 90, 60));

        addPlayerInventory(playerInventory);
        addPlayerHotbar(playerInventory);

        addProperties(delegate);
    }

    @Override
    public ItemStack transferSlot(PlayerEntity player, int invSlot) {
        ItemStack newStack = ItemStack.EMPTY;
        Slot slot = this.slots.get(invSlot);
        if (slot != null && slot.hasStack()) {
            ItemStack originalStack = slot.getStack();
            newStack = originalStack.copy();
            if (invSlot < this.inventory.size()) {
                if (!this.insertItem(originalStack, this.inventory.size(), this.slots.size(), true)) {
                    return ItemStack.EMPTY;
                }
            } else if (!this.insertItem(originalStack, 0, this.inventory.size(), false)) {
                return ItemStack.EMPTY;
            }

            if (originalStack.isEmpty()) {
                slot.setStack(ItemStack.EMPTY);
            } else {
                slot.markDirty();
            }
        }

        return newStack;
    }
    public boolean isCrafting() {
        return propertyDelegate.get(0) > 0;
    }

    public int getScaledProgress() {
        int progress = this.propertyDelegate.get(0);
        int maxProgress = this.propertyDelegate.get(1);  // Max Progress
        int progressArrowSize = 26; // This is the width in pixels of your arrow

        return maxProgress != 0 && progress != 0 ? progress * progressArrowSize / maxProgress : 0;
    }

    @Override
    public boolean canUse(PlayerEntity player) {
        return this.inventory.canPlayerUse(player);
    }
    private void addPlayerInventory(PlayerInventory playerInventory) {
        for (int i = 0; i < 3; ++i) {
            for (int l = 0; l < 9; ++l) {
                this.addSlot(new Slot(playerInventory, l + i * 9 + 9, 8 + l * 18, 86 + i * 18));
            }
        }
    }

    private void addPlayerHotbar(PlayerInventory playerInventory) {
        for (int i = 0; i < 9; ++i) {
            this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 144));
        }
    }
}
AVCleanerScreen:
public class AVCleanerScreen extends HandledScreen<AVCleanerScreenHandler> {
    private static final Identifier TEXTURE =
            new Identifier(Amethystvoid.MOD_ID, "textures/gui/amethyst_cleaner.png");

    public AVCleanerScreen(AVCleanerScreenHandler handler, PlayerInventory inventory, Text title) {
        super(handler, inventory, title);
    }

    @Override
    protected void init() {
        super.init();
        titleX = (backgroundWidth - textRenderer.getWidth(title)) / 2;
    }

    @Override
    protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
        RenderSystem.setShader(GameRenderer::getPositionTexShader);
        RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
        RenderSystem.setShaderTexture(0, TEXTURE);
        int x = (width - backgroundWidth) / 2;
        int y = (height - backgroundHeight) / 2;
        drawTexture(matrices, x, y, 0, 0, backgroundWidth, backgroundHeight);

        renderProgressArrow(matrices, x, y);
    }

    private void renderProgressArrow(MatrixStack matrices, int x, int y) {
        if(handler.isCrafting()) {
            drawTexture(matrices, x + 105, y + 33, 176, 0, 8, handler.getScaledProgress());
        }
    }

    @Override
    public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
        renderBackground(matrices);
        super.render(matrices, mouseX, mouseY, delta);
        drawMouseoverTooltip(matrices, mouseX, mouseY);
    }
}
 
Краш-лог
[14:01:03] [Server thread/ERROR] (Minecraft) Failed to handle packet net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket@24608b69, suppressing error
java.lang.UnsupportedOperationException: Unable to construct this menu by type
at net.minecraft.screen.ScreenHandler.getType(ScreenHandler.java:90) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.network.ServerPlayerEntity.openHandledScreen(ServerPlayerEntity.java:1047) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at ru.filden.amethystvoid.block.entity.AmethystCleanerBlock.onUse(AmethystCleanerBlock.java:58) ~[main/:?]
at net.minecraft.block.AbstractBlock$AbstractBlockState.onUse(AbstractBlock.java:964) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.network.ServerPlayerInteractionManager.interactBlock(ServerPlayerInteractionManager.java:338) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.network.ServerPlayNetworkHandler.onPlayerInteractBlock(ServerPlayNetworkHandler.java:1145) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:34) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:8) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.network.NetworkThreadUtils.method_11072(NetworkThreadUtils.java:22) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.ServerTask.run(ServerTask.java:18) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:157) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:776) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:159) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:131) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer.java:758) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:752) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:140) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer.java:737) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:669) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:257) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
at java.lang.Thread.run(Thread.java:842) [?:?]
Краш-лог:
[14:01:03] [Server thread/ERROR] (Minecraft) Failed to handle packet net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket@24608b69, suppressing error
 java.lang.UnsupportedOperationException: Unable to construct this menu by type
	at net.minecraft.screen.ScreenHandler.getType(ScreenHandler.java:90) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.network.ServerPlayerEntity.openHandledScreen(ServerPlayerEntity.java:1047) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at ru.filden.amethystvoid.block.entity.AmethystCleanerBlock.onUse(AmethystCleanerBlock.java:58) ~[main/:?]
	at net.minecraft.block.AbstractBlock$AbstractBlockState.onUse(AbstractBlock.java:964) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.network.ServerPlayerInteractionManager.interactBlock(ServerPlayerInteractionManager.java:338) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.network.ServerPlayNetworkHandler.onPlayerInteractBlock(ServerPlayNetworkHandler.java:1145) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:34) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:8) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.network.NetworkThreadUtils.method_11072(NetworkThreadUtils.java:22) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.ServerTask.run(ServerTask.java:18) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:157) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:776) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:159) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:131) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer.java:758) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:752) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:140) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer.java:737) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:669) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:257) ~[minecraft-merged-c713afbca6-1.19.2-net.fabricmc.yarn.1_19_2.1.19.2+build.28-v2.jar:?]
	at java.lang.Thread.run(Thread.java:842) [?:?]
Сверху