Skip to content

Commit

Permalink
fix(recipes): ✏️Prevent [Multitool] destroy Omniwand on shift + rig…
Browse files Browse the repository at this point in the history
…ht-click
  • Loading branch information
Krutoy242 committed Feb 27, 2024
1 parent 50fe2cc commit d7d621b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/mods/omniwand.zs
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,20 @@ recipes.addShaped('Superwrench', predefined, [
[<ore:gearAluminium>, <omniwand:wand>, <ore:gearTin>],
[null, <ore:gearLead>, null],
]);

// Prevent NuclerCraft: Overhauled destroy omniwand on right-click with Multitool
// Since I cant actually cancel event, i will just give player another Omniwant
events.onPlayerInteractBlock(function(e as crafttweaker.event.PlayerInteractBlockEvent) {
if(
e.world.remote
|| !e.player.isSneaking
|| isNull(e.item)
|| e.item.definition.id != 'nuclearcraft:multitool'
|| isNull(e.item.tag)
|| isNull(e.item.tag.memberGet('omniwand:data'))
) return;

e.player.give(e.item);
e.item.mutable().shrink(e.item.amount);
e.cancel();
});

0 comments on commit d7d621b

Please sign in to comment.