fix commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#modloaded dimdoors
|
||||
|
||||
import crafttweaker.damage.IDamageSource;
|
||||
import crafttweaker.entity.IEntityLivingBase;
|
||||
import crafttweaker.event.PlayerInteractEntityEvent;
|
||||
|
||||
import mods.contenttweaker.Color;
|
||||
import mods.contenttweaker.VanillaFactory;
|
||||
import mods.contenttweaker.IItemRightClick;
|
||||
import mods.contenttweaker.Commands;
|
||||
|
||||
events.onPlayerInteractEntity(function(event as PlayerInteractEntityEvent) {
|
||||
if (event.world.isRemote()) {
|
||||
return;
|
||||
}
|
||||
val heldItem = event.item;
|
||||
// [edit item name in the bracket handler]
|
||||
if (!isNull(heldItem) && heldItem.definition.id.matches(<contenttweaker:warren_blindfold>.definition.id)) {
|
||||
if (!event.target instanceof IEntityLivingBase) {
|
||||
return;
|
||||
}
|
||||
val target as IEntityLivingBase = event.target;
|
||||
if (target.definition.id != "dimdoors:mob_monolith" || !target.isAlive()) {
|
||||
return;
|
||||
}
|
||||
// [edit damage here]
|
||||
val DAMAGE = 100.0f;
|
||||
// [can remove this var if reusuable]
|
||||
val oldHealth = target.health;
|
||||
// Handle kill as if by player
|
||||
if (target.health <= DAMAGE) {
|
||||
target.onDeath(IDamageSource.createPlayerDamage(event.player));
|
||||
// Allows for proper death
|
||||
target.health = 0;
|
||||
|
||||
|
||||
} else {
|
||||
target.attackEntityFrom(<damagesource:OUT_OF_WORLD>, DAMAGE);
|
||||
// summon item above player
|
||||
// player.sendChat("Look up!");
|
||||
Commands.call("summon Item ~ ~4 ~ {Item:{id:\"contenttweaker:eye_of_limbo\",Count:1b}}", event.player, event.world, true, true);
|
||||
}
|
||||
// [remove this clause if reusuable]
|
||||
if (target.health < oldHealth) {
|
||||
// [add anything here to handle on each successful use]
|
||||
heldItem.mutable().shrink(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user