Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MagicBallEntity extends ProjectileItemEntity {
- public MagicBallEntity(EntityType<MagicBallEntity> type, World worldIn) {
- super(type,worldIn);
- this.setNoGravity(true); //doesn't work
- }
- public MagicBallEntity(LivingEntity entity, World worldIn){
- super(EntityList.MAGIC_PROJECTILE.get(), entity, worldIn);
- }
- public MagicBallEntity(double x, double y, double z, World worldIn){
- super(EntityList.MAGIC_PROJECTILE.get(), x, y, z, worldIn);
- }
- @Override
- protected Item getDefaultItem() {
- return RegistryHandler.MAGIC_BALL.get().asItem();
- }
- @Override
- public IPacket<?> createSpawnPacket() {
- return NetworkHooks.getEntitySpawningPacket(this);
- }
- @Override
- protected void onImpact(RayTraceResult result) {
- if(result.getType() == RayTraceResult.Type.ENTITY)
- {
- Entity entity = ((EntityRayTraceResult)result).getEntity();
- int damage = 0;
- if(entity instanceof Entity)
- {
- damage = 5;
- }
- entity.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getEntity()), (float)damage);
- }
- if(!world.isRemote)
- {
- remove();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement