mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 22:15:06 +00:00
Implemented several more events for players, including a click event, key event, fall event, and the basic entity living hurt, killed, and kills events, among others.
This commit is contained in:
1 parent
6c8c7671b8
commit
6752f8baec
38 files changed
+763
-249
No files matched your search
@@ -23,6 +23,8 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -34,6 +36,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityCommandBlock;
|
||||
import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -697,4 +700,19 @@ public class NoppesUtilServer {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Entity GetDamageSourcee(DamageSource damagesource) {
|
||||
Object entity = damagesource.getEntity();
|
||||
if(entity == null) {
|
||||
entity = damagesource.getSourceOfDamage();
|
||||
}
|
||||
|
||||
if(entity instanceof EntityArrow && ((EntityArrow)entity).shootingEntity instanceof EntityLivingBase) {
|
||||
entity = ((EntityArrow)entity).shootingEntity;
|
||||
} else if(entity instanceof EntityThrowable) {
|
||||
entity = ((EntityThrowable)entity).getThrower();
|
||||
}
|
||||
|
||||
return (Entity)entity;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user