Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mrzorse.startrek.entities;
- import com.mrzorse.startrek.api.weaponeffects.SimpleEffects;
- import com.mrzorse.startrek.api.weapons.WeaponShot;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.block.Block;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.monster.EntityBlaze;
- import net.minecraft.entity.passive.EntityCow;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.projectile.EntityFireball;
- import net.minecraft.entity.projectile.EntityThrowable;
- import net.minecraft.init.Blocks;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.MovingObjectPosition;
- import net.minecraft.util.Vec3;
- import net.minecraft.util.MovingObjectPosition.MovingObjectType;
- import net.minecraft.world.EnumDifficulty;
- import net.minecraft.world.World;
- public class EntityPhaserBoltStun extends EntityThrowable{
- private double explosionRadius = 1.0F;
- private double toh = 1.0F;
- private int life = 300;
- private int color;
- private int distanceTraveled;
- public EntityPhaserBoltStun(World par1World) {
- super(par1World);
- }
- public EntityPhaserBoltStun(World par1World, double arg1Double, double arg2Double, double arg3Double, WeaponShot shot) {
- super(par1World, arg1Double, arg2Double, arg3Double);
- // this.life = shot.getRange();
- // this.color = shot.getColor();
- }
- public void onUpdate(){
- super.onUpdate();
- if(this.isInWater()){
- this.setDead();
- }
- distanceTraveled+=Vec3.createVectorHelper(motionX,motionY,motionZ).lengthVector();
- if(distanceTraveled > 35){
- this.setDead();
- }
- }
- public EntityPhaserBoltStun(World par1World, EntityLivingBase arg1EntityLivingBase) {
- super(par1World, arg1EntityLivingBase);
- }
- // @Override
- // protected void onImpact(MovingObjectPosition mop) {
- // //System.out.println("Phaser is firing");
- // System.out.println(mop.entityHit);
- //
- // if (mop.entityHit != null) {
- // System.out.println("Hit a Entity");
- //
- //
- // mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
- // }
- //
- //
- //
- // }
- public boolean canBeCollidedWith()
- {
- return true;
- }
- @SideOnly(Side.CLIENT)
- protected void onImpact(MovingObjectPosition mop)
- {
- System.out.println(worldObj.isRemote);
- if(mop.typeOfHit == MovingObjectType.BLOCK){
- Block blockHit = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
- if(blockHit == Blocks.water || blockHit == Blocks.lava){
- this.setDead();
- }
- }
- if(mop.entityHit != null){
- //Amount of damage done to entity
- byte b0 = 1;
- //This causes the entity to get damaged or hurt
- EntityLivingBase target = (EntityLivingBase)mop.entityHit;
- mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0);
- SimpleEffects.setPotionEffects(target, 1000, 100, "blindness");
- SimpleEffects.setPotionEffects(target, 1000, 100, "slowness");
- SimpleEffects.setPotionEffects(target, 1000, 100, "mining fatigue");
- }
- for (int i = 0; i < 8; ++i)
- {
- this.worldObj.spawnParticle("reddust", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
- }
- this.setDead();
- if (!this.worldObj.isRemote)
- {
- this.setDead();
- }
- }
- protected float getGravityVelocity()
- {
- return 0.0F;
- }
- // public float getLife()
- // {
- // return 1f-((float)distanceTraveled/(float)life);
- // }
- public int getColor()
- {
- return color;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement