I'd like to know how to make a custom block that can change orientation based on where it's placed from. I've got my custom block made, it's got all the textures set up, but if I had to guess, you need a server.js to handle the data for orientation. Would this be correct?
If not, please let me know.
I started making a server.js to do this, I didn't finish it, and I don't know if it's syntactically correct.
const aServerSystem = server.registerSystem(0, 0);
// Register script only components and listen for events
aServerSystem.initialize = function () {
// Setup callback for the block placed event.
this.listenForEvent("minecraft:player_placed_block", eventData => this.onBlockPlaced(eventData));
};
aServerSystem.onBlockPlaced = function (eventData) {
// Get the position of the placed block
let placedBlockPos = eventData.data.block_position;
let playerPosComp = this.getComponent(eventData.data.player, "minecraft:position");
let playerPos = playerPosComp.data;
let playerTickComp = this.getComponent(eventData.data.player, "minecraft:tick_world");
let playerTickingArea = playerPosComp.data.ticking_area;
// Compare position of player and block, change orientation based on the relation of the two.
// No idea how to do this...
// Insert code here.
};
EDIT: I noticed I put this in the wrong section. If someone can move it to MCPE Mods/Tools Help & Requests, I'd appreciate it, thanks.
I'd like to know how to make a custom block that can change orientation based on where it's placed from. I've got my custom block made, it's got all the textures set up, but if I had to guess, you need a server.js to handle the data for orientation. Would this be correct?
If not, please let me know.
I started making a server.js to do this, I didn't finish it, and I don't know if it's syntactically correct.
EDIT: I noticed I put this in the wrong section. If someone can move it to MCPE Mods/Tools Help & Requests, I'd appreciate it, thanks.