• Hey! Register here to create your account, engage with the community, and talk about what is new!

How to get the block at a certain location as a "block" value?

NegativeN

New member
Emperor
Joined
Nov 23, 2021
Messages
9
Reaction score
0
Does anyone know if there is a way to parse "item" values to "block" values or a way to get which kind of block is at a location as a "block" value, that would be much appreciated. Like the title says, I'm trying to get the type of block at a certain location but as a "block" value rather than a "item" value.
 
Solution
Do you have the tag in the Set Variable: Get Block Type set to Block ID, Block Name or Item? Because for this to work it should be
set to item.



I'm pretty sure that if you enter the variable that you first entered in the Set Variable: Get Block Type in the Game Action: Set Block it'll work.



I'll try my best to explain: In the first code block, which in this case is the Set Variable: Get Block Type, you have (hopefully) put two items. The first item should be a renamed variable, this will act as a storage for whatever item/block the variable returns. In the second slot you entered any location. When the code is activated the code block will get the material of the location in...

CoderElias

Notorious member
Overlord
Joined
Jun 15, 2022
Messages
95
Reaction score
17

I’m not sure if I understood the question correctly, but if you want to get the material from a specific location, you can use the following Set Variable:


1725255987395.png
 

NegativeN

New member
Emperor
Joined
Nov 23, 2021
Messages
9
Reaction score
0
Yes, but that returns it as an item value, I want to be able to use it in the Game Action: SetBlock so the output has to come out as a block value. Tbh I don't even know if that's possible.
 

CoderElias

Notorious member
Overlord
Joined
Jun 15, 2022
Messages
95
Reaction score
17
Do you have the tag in the Set Variable: Get Block Type set to Block ID, Block Name or Item? Because for this to work it should be
set to item.



I'm pretty sure that if you enter the variable that you first entered in the Set Variable: Get Block Type in the Game Action: Set Block it'll work.



I'll try my best to explain: In the first code block, which in this case is the Set Variable: Get Block Type, you have (hopefully) put two items. The first item should be a renamed variable, this will act as a storage for whatever item/block the variable returns. In the second slot you entered any location. When the code is activated the code block will get the material of the location in item form, it should not be in a string form, then that item will be saved to the first variable. Then, when you want to set a location to whatever block that Set Variable: Get Block Type returned you just enter the variable in the Game Action: Set Block.

Sorry if this hasn't been explained well or isn't what your problem is about.
 
Solution

NegativeN

New member
Emperor
Joined
Nov 23, 2021
Messages
9
Reaction score
0
Sorry for the late reply, but thanks, I thought I tried this. My code is working now. (y)
 
Last edited:
Top Bottom