change death type for the guns

This commit is contained in:
ZXMushroom63 2024-12-08 16:28:40 +08:00
parent c2a7bab6dc
commit 3d3de34e26

View File

@ -53,12 +53,12 @@
}
ModAPI.reflect.prototypeStack(itemClass, nmi_ItemPistol);
nmi_ItemPistol.prototype.$onItemRightClick = function ($itemstack, $world, $player) {
var magic = ModAPI.reflect.getClassByName("DamageSource").staticVariables.magic;
var cactus = ModAPI.reflect.getClassByName("DamageSource").staticVariables.cactus;
var world = ModAPI.util.wrap($world);
var entityplayer = ModAPI.util.wrap($player);
var shotentity = entityRayCast(entityplayer, world, 12.0)
if (shotentity != null){
shotentity.attackEntityFrom(magic, 10);
shotentity.attackEntityFrom(cactus, 10);
world.playSoundAtEntity(entityplayer.getRef(), ModAPI.util.str("tile.piston.out"), 1.0, 1.8);
}
return $itemstack;