Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-183346

Issue with the Minecraft Server API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 1.21.10.24 Preview, 1.21.1 Hotfix
    • None
    • Unconfirmed
    • Windows

      Hello,

      I'm having an issue with the Minecraft Bedrock API, specifically with the @minecraft/server API.

      I am trying to create a custom chest, so I came across this code!

      import { world, MinecraftBlockTypes, Items, ItemStack } from "@minecraft/server"// Fetch block 
      const block = world.getDimension("overworld").getBlock({ x: 1, y: 2, z: 3 }); 
      
      // Make it a chest 
      block.setType(MinecraftBlockTypes.chest);
      
      // Get the inventory 
      const inventoryComponent = block.getComponent("inventory"); 
      const inventoryContainer = inventoryComponent.container; 
      
      // Set slot 0 to a stack of 10 apples 
      inventoryContainer.setItem(0, new ItemStack(Items.apple, 10, 0));
       

      This code comes from this link: Link to the source code

      I've tried this code on all versions of the Minecraft server API from 0.1.0 to 1.12.0-beta because I cannot find the 1.13.0-beta version even though this version of the API is mentioned in the documentation.

      [Link to the documentation|https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/minecraft-server?view=minecraft-bedrock-stable]]

       

      The error I'm encountering is as follows:

      [Scripting][error]-Plugin [Industrial Revolution - 1.0.0] - [Main.js] ran with error: [SyntaxError: Could not find export 'MinecraftBlockTypes' in module '@minecraft/server'] 

      How can I fix this error? Is this normal? Why is the documentation so poorly made? Are there alternatives to the official Microsoft documentation?

      Kind regards, RedDefaltos

            RedDefaltos RedDefaltos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: