Was mache ich falsch?

Ich bin gerade dabei eine Minecraft Mod zu machen die einen weiteren Crafting Table hinzufügt und wenn man ihn rechtsclicked soll er das Crafting Table GUI von Minecraft öffnen. Tut es auch aber es schließt sich auch sofort wieder.

Oberhalb ist der Prozedur Code

Oberhalb ist der Code vom Block

Oberhalb ist vom Block die Imports

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
4 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
EchoTech
10 months ago

I noticed now that in your use method of your block class (AcaciaCraftingBenchBlock) you do not return InteractionResult.CONSUME when the GUI is successfully opened. So your code can’t know if everything was successful.

Look here ->

Block Interaction – Forge Community Wiki (gemwire.uk)

@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
    int x = pos.getX();
    int y = pos.getY();
    int z = pos.getZ();
    if (!world.isClientSide) {  
        AcaciaCraftingBenchOnBlockRightClickedProcedure.execute(world, x, y, z, player);
        return InteractionResult.CONSUME;  
    }
    return InteractionResult.SUCCESS;
}

try it like that.

I would generally work with try-catch blocks in such a project. You don’t have a single bug treatment in your code if something goes wrong. You can definitely not use your code. I have also noticed many other things that should have been done in principle, but I am not going to go on with it. First change your public InteractionResult use block and see if your problem solves

Welcome to EchoTech