mojira.dev

mrpatches123

Assigned

No issues.

Reported

MCPE-176276 faceLocation and blockFace in 1.6.0-beta for playerPlaceBlock and itemUseOn are backwards Awaiting Response MCPE-152538 Minecraft randomly crashes on world save or load Invalid MCPE-151952 /immutableworld true and /ability @s worldbuilder true do not allow me to build. Incomplete REALMS-9078 Realms freeze, disconnect everyone, and not saving when everyone leaves. Fixed MCPE-140926 /dialogue open @s @s <scene>, will not run any commands if not opped Fixed MCPE-131345 Time-lapse of all events that occurred after going inactive. Incomplete MCPE-129777 The filter, distance_to_nearest_player, in minecraft:damage_sensor does not trigger if value > 1.39 Incomplete MCPE-128897 Durability causes custom item duplication on death Fixed MCPE-118105 if has_damage = fatal and target is other in minecraft:damage_sensor if I stand on a cactus or magma_block it runs the event on repeat. Duplicate MCPE-84500 When I /give or /replaceitem in the inventory, it causes hotbar scroll lag Incomplete MCPE-71326 Command Block not updating unless messed with or powered. Works As Intended MCPE-69955 Save on Realms corrupts at randomly. Duplicate

Comments

in 1.20.51 the hierarchy (heirs to the leader and the leader) switches to the new villagers when more villagers are added to the village via breeding. Will do more testing soon.

Edit.
even if the leader can sleep in its bed, the leader position can be assigned to newly created villages breading or spawning.

[media]


Pack as requested
only works for 1.19.30
sub minor updates don't matter. it will work as long as the current beta version for release is 1.6.0-beta

import { world, Vector, system, Direction } from '@minecraft/server';

const DirectionToVector = {
	[Direction.Down]: Vector.down,
	[Direction.Up]: Vector.up,
	[Direction.North]: Vector.forward,
	[Direction.South]: Vector.back,
	[Direction.West]: Vector.left,
	[Direction.East]: Vector.right,
};
function floorVector3(vector) {
	return {
		x: Math.floor(vector.x),
		y: Math.floor(vector.y),
		z: Math.floor(vector.z),
	};
}
world.beforeEvents.itemUseOn.subscribe(async (event) => {
	try {

		const { source, block, blockFace, faceLocation } = event;


		// logVector3(DirectionToVector[blockFace]);
		const placeLocation = Vector.add(block.location, DirectionToVector[blockFace]);
		const predictedPlaceLocation = Vector.add(block.location, floorVector3(faceLocation));
		await null;
		world.sendMessage('============================================');
		world.sendMessage(JSON.stringify({ "§7not Floored faceLocation§f": faceLocation }, null));
		world.sendMessage(JSON.stringify({ blockFace, "§7Floored faceLocation§f": floorVector3(faceLocation) }));
		world.sendMessage('§7Floored faceLocation + block.location: §cminecraft:villager_angry paricle and red_stained_glass');
		world.sendMessage('§7blockFace converted to vector + block.location: §aminecraft:villager_happy paricle and lime_stained_glass\n§7(if place location for both is correct it will be lime)');
		world.sendMessage('§7block.location: §fminecraft:endrod paricle(will be where faceLocation is relitive from) and glass ');
		source.dimension.spawnParticle('minecraft:villager_angry', predictedPlaceLocation);
		source.dimension.spawnParticle('minecraft:endrod', block.location);
		source.dimension.spawnParticle('minecraft:villager_happy', placeLocation);
		source.dimension.getBlock(block.location).setType('glass');
		source.dimension.getBlock(predictedPlaceLocation).setType('red_stained_glass');
		source.dimension.getBlock(placeLocation).setType('lime_stained_glass');
	} catch (error) {
		console.warn(error, error.stack);
	}
});
function rotationToDirection(rotation) {
	let { x, y } = rotation;

	x = (x / 45 + 2) | 0;
	y = ((y + 45) / 90 + 2) | 0;
	if (x < 1) return 'Up (y + 1)';
	else if ((x > 2)) return 'Down (y - 1)';
	switch (y) {
		case 2:
			return 'North (z + 1)';
		case 4:
		case 0:
			return 'South (z - 1)';
		case 1:
			return 'East (x + 1)';
		case 3:
			return 'West (x - 1)';
	}
};
system.runInterval(() => {
	const players = world.getAllPlayers();
	players.forEach(player => {
		player.onScreenDisplay.setActionBar(rotationToDirection(player.getRotation()) ?? "None" + '\n(based off Direction Enum on docs)');
	});
});

reference for each direction: https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/direction
The docs could be wrong for why blockFace is backwards in the z direction but idk

Edit:
cleaned up the code so it better represents the cases and doesn't need content log on
Pack has the same code

 

The code below ran in preview 1.19.70.22 if the player uses on the block, for instance, x: 1, y: 2, z: 3. should output:

import { world } from "@minecraft/server";

world.events.beforeItemUseOn.subscribe((event) => {
    const blockLocation = event.getBlockLocation();
    let keys = [];
    for (const key in event) {
        keys.push(key);
    }
    const { x, y, z } = blockLocation ?? {};
    console.warn('hello, ', x, y, z, keys.join(', '));
});

[Scripting][warning]-hello, 1 2 3 getBlockLocation, item, source, blockFace, faceLocationX, faceLocationY, cancel

but instead outputs

[Scripting][warning]-hello,  undefined undefined undefined getBlockLocation, item, source, blockFace, faceLocationX, faceLocationY, cancel

As you can see the method getBlockLocation is defined on the BeforeItemUseOnEvent class instance passed as a parameter in the event callback so the method always returns undefined.

new code and console output to further prove getBlockLocation is defined on the BeforeItemUseOnEvent instance.

import { world } from "@minecraft/server";world.events.beforeItemUseOn.subscribe((event) => {
    const blockLocation = event.getBlockLocation();
    let eventClone = {};
    for (const key in event) {
        eventClone[key] = typeof event[key];
    }
    const { x = 'undefined', y = 'undefined', z = 'undefined' } = blockLocation ?? {};
    world.sendMessage(JSON.stringify({ t: 'test', blockLocation: { x, y, z }, eventClone }, null, 4));
});

 

[media]

Happens in 1.19.20 as well.

still happens but a loading bar appears.

You do have to wait a about 10 seconds for the op to be removed since the command will execute immediately after the op is removed and will not run after a few seconds.

you set 1 to a string ie "1" it must be an int ie "minecraft:direction": 1

I added a sample world for testing. Just remove op for the experiment and use op for the control group. The interact thing isn’t required it just fixes the issue of players completely acting like npcs

Apparently, if a player is wearing armor and they receive an amount damage that would kill them without armor, it triggers as fatal even though the player is not dead.

Steps to Reproduce:
1. create a damage sensor component in player.json with a test for fatal that runs a command on "other" which is the attacker.
2. give the player a full set of any diamond armor.
3. crit hit the player with a sharpness 5 diamond sword.
Observed Results:
the command runs even though the player attacked is alive
Expected Results:
no command is run

Steps to Reproduce:
1. Download the More Tools Addon at https://mcpedl.com/more-tools-addon/ and apply the addon.
2. make sure and check all experiments but /gametest.
3. run /give @s sp:lapis_chestplate and /give @s sp:redstone_chestplate.
4. equip one of the chestplates
5. Try and equip the other chestplate from the hotbar.

Observed Results:
It does not replace.

Expected Results:
Works like vanilla armor and replaces.

It is an issue with the latest version.