Attempted to call getBlock() for coordinates that reside within a ticking area in a single-player world.
Expected: getBlock() returns a Block object.
Actual: "Script Error: Something went wrong..."
Repro steps:
Create a behavior pack with the attached file as a server script
Create a circular ticking area named "mytickingarea" at 0 65 0 with a radius of 1 (seems to happen for any ticking area, actually, but this is what I did)
Teleport to 0 65 0 in survival mode (create a pillar if necessary)
Start destroying the block you're standing on
The script error will display
Β
Β
Attachments
Comments 9
I'm having the same issue, cannot get block from within a ticking area, it throws either using coordinates or blockPosition Object
[media]yeah I am having a similar problem where the obj getblock returns is null I upvoted hop it gets fixed soon
Thank you for your report!
However, this issue has been temporarily resolved as Awaiting Response
Is this still an issue in the latest version?
If it is, please be sure to include steps to reproduce the problem:
Steps to Reproduce:
1.
2.
3.Observed Results:
(Briefly describe what happens)Expected Results:
(Briefly describe what should happen)
If your ticket does not look like the example given here, then it's likely to be closed as incomplete.
This ticket will automatically reopen when you reply.
Quick Links:
π Issue Guidelines β π¬ Mojang Support β π§ Suggestions β π Minecraft Wiki
I am also witnessing this issue, in v1.16.40.
Steps to Reproduce:
Create a behaviour pack with a server side script:
{{}}let serverSystem = server.registerSystem(0, 0); serverSystem.debug = function (msg) { let BroadcastEventData = serverSystem.createEventData("minecraft:display_chat_event"); BroadcastEventData.data.message = msg; serverSystem.broadcastEvent("minecraft:display_chat_event", BroadcastEventData); }; serverSystem.initialize = function() { serverSystem.listenForEvent("minecraft:block_interacted_with", (eventData) => serverSystem.checkBlock(eventData)); }; serverSystem.checkBlock = function (eventData) { const { block_position } = eventData.data; const { x, y, z } = block_position; const tickingArea = this.getTickingArea(); const block = this.getBlock(tickingArea, x, y, z); serverSystem.debug(JSON.stringify(block)); }; serverSystem.getTickingArea = function () { let tickingAreas = this.getComponent(server.level, 'minecraft:ticking_areas'); return tickingAreas.data['custom']; };
Install your behaviour pack
Create a Creative world with experimental gameplay and cheats turned on.
Enable your behaviour pack on your newly-created world
Enter the world
Create a ticking area:
/tickingarea add circle ~ ~ ~ 1 custom
Add a button of any kind to the ground immediately in front of you
Interact with the button
Observed Results:
The text
<ServerScript> null
appears in the chat log.
Expected Results:
**A JSON representation of the block's properties should appear in the chat log.
update: I have found a workaround, by grabbing the players ticking area instead which is usually preferred anyways.
Β
const world = this.getComponent(eventData.data.player, "minecraft:tick_world"); this.log(this.getBlock(world.data.ticking_area, x, y, z));
Thank you for your report!
After consideration, the issue is being closed as Won't Fix.
Please note that this is not the same as Working as Intended, as this bug report correctly describes behavior in the game that might not be the intended or desirable behavior, but it will not be fixed right now. Sometimes, this is because the issue reported is minor and/or impossible to change without large architectural changes to the code base.
Quick Links:
π Bug Tracker Guidelines β π¬ Community Support β π§ Mojang Support (Technical Issues) β π§ Microsoft Support (Account Issues)
π Project Summary β βοΈ Feedback and Suggestions β π Game Wiki
Also I can add, that the same method with entity ticking area is working fine. The bug also happens on version 1.16.0.57.
Also executing getBlock({}, 0, 0, 0) crashes Minecraft completely.