Fire item_used_on_block when an axe, honeycomb, disc or vault key is used on a block
This commit is contained in:
@@ -8586,6 +8586,8 @@ impl Game<'_> {
|
||||
else {
|
||||
return Ok(false);
|
||||
};
|
||||
// BlockTransformer.transformBlock: ITEM_USED_ON_BLOCK before the swap.
|
||||
self.trigger_block("minecraft:item_used_on_block", pos, stack);
|
||||
self.level_set(pos, new)?;
|
||||
// BlockTransformer.TransformParticle.send.
|
||||
self.transform_particle(&particle, pos);
|
||||
@@ -8832,6 +8834,8 @@ impl Game<'_> {
|
||||
if let Some(waxed) = old.and_then(|old| self.res.transformers().waxed(registry, &old))
|
||||
&& let Ok(state) = registry.resolve(&waxed)
|
||||
{
|
||||
// HoneycombItem.useOn: ITEM_USED_ON_BLOCK before the swap.
|
||||
self.trigger_block("minecraft:item_used_on_block", hit.pos, stack);
|
||||
self.level_set(hit.pos, state)?;
|
||||
self.level_event_at(3003, hit.pos, 0);
|
||||
self.audio.play(
|
||||
|
||||
@@ -90,6 +90,8 @@ impl Game<'_> {
|
||||
self.set_has_record(pos, true);
|
||||
self.start_song(pos, &song);
|
||||
self.jukebox_changed(pos);
|
||||
// ServerPlayerGameMode.useItemOn: the action was consumed.
|
||||
self.trigger_block("minecraft:item_used_on_block", pos, stack);
|
||||
true
|
||||
}
|
||||
/// Level event 1010: the song from the jukebox, and the "Now Playing" overlay.
|
||||
|
||||
@@ -169,6 +169,8 @@ impl Game<'_> {
|
||||
self.consume_held();
|
||||
}
|
||||
}
|
||||
// ServerPlayerGameMode.useItemOn: the action was consumed.
|
||||
self.trigger_block("minecraft:item_used_on_block", pos, &stack);
|
||||
Ok(true)
|
||||
}
|
||||
fn vault_events(&mut self, key: Pos, events: Vec<VaultEvent>) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user