#egg / EggTrape
1 messages · Page 1 of 1 (latest)
world.afterEvents.projectileHitEntity.subscribe(e => {
// logic in here
/*
mabye you can save a cobweb structure and load it in the hit position
and also
*/
e.source // is the source, write code like if (e.source.name == "exemplePlayerName") {console.log(hey)}
e.location // the location, vector 3
})
good luck
world.afterEvents.projectileHitEntity.subscribe((data) => {
const hurtEntity = data.getEntityHit().entity;
if (data.projectile.typeId !== "minecraft:egg") return;
if (hurtEntity.typeId !== "minecraft:player") return;
hurtEntity.runCommandAsync(`fill ~-1 ~-1 ~-1 ~1 ~1 ~1 web [] replace air`);
});```
You can change to fill with web in a native way as it is better than using commands
In this example that I made the area is filled around the player that was hit in 3x3x3 and just replaces air so it doesnt break other blocks