Changed formatting to have bracing on a new line
This commit is contained in:
parent
e5eddd6c45
commit
e48eedb874
189 changed files with 6092 additions and 4041 deletions
|
@ -13,24 +13,28 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fml.common.registry.IThrowableEntity;
|
||||
|
||||
public class EntityBloodLight extends EntityThrowable implements IThrowableEntity, IEntityAdditionalSpawnData {
|
||||
public class EntityBloodLight extends EntityThrowable implements IThrowableEntity, IEntityAdditionalSpawnData
|
||||
{
|
||||
|
||||
public EntityLivingBase shootingEntity;
|
||||
protected int ticksInAir = 0;
|
||||
protected int maxTicksInAir = 600;
|
||||
|
||||
public EntityBloodLight(World world) {
|
||||
public EntityBloodLight(World world)
|
||||
{
|
||||
super(world);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntityBloodLight(World world, double x, double y, double z) {
|
||||
public EntityBloodLight(World world, double x, double y, double z)
|
||||
{
|
||||
super(world);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
this.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
public EntityBloodLight(World world, EntityLivingBase player) {
|
||||
public EntityBloodLight(World world, EntityLivingBase player)
|
||||
{
|
||||
super(world, player);
|
||||
shootingEntity = player;
|
||||
float par3 = 0.8F;
|
||||
|
@ -47,17 +51,20 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
|
|||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity() {
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
return 0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getVelocity() {
|
||||
protected float getVelocity()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) {
|
||||
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8)
|
||||
{
|
||||
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5);
|
||||
var1 /= var9;
|
||||
var3 /= var9;
|
||||
|
@ -77,27 +84,33 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
if (this.ticksExisted > this.maxTicksInAir) {
|
||||
if (this.ticksExisted > this.maxTicksInAir)
|
||||
{
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition mop) {
|
||||
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) {
|
||||
if (mop.entityHit == shootingEntity) {
|
||||
protected void onImpact(MovingObjectPosition mop)
|
||||
{
|
||||
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
|
||||
{
|
||||
if (mop.entityHit == shootingEntity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.onImpact(mop.entityHit);
|
||||
}
|
||||
else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
EnumFacing sideHit = mop.sideHit;
|
||||
BlockPos blockPos = mop.getBlockPos().offset(sideHit);
|
||||
|
||||
if (worldObj.isAirBlock(blockPos)) {
|
||||
if (worldObj.isAirBlock(blockPos))
|
||||
{
|
||||
worldObj.setBlockState(blockPos, ModBlocks.bloodLight.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
@ -105,70 +118,84 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
|
|||
this.setDead();
|
||||
}
|
||||
|
||||
protected void onImpact(Entity mop) {
|
||||
if (mop == shootingEntity && ticksInAir > 3) {
|
||||
protected void onImpact(Entity mop)
|
||||
{
|
||||
if (mop == shootingEntity && ticksInAir > 3)
|
||||
{
|
||||
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
|
||||
this.setDead();
|
||||
}
|
||||
else {
|
||||
if (mop instanceof EntityLivingBase) {
|
||||
} else
|
||||
{
|
||||
if (mop instanceof EntityLivingBase)
|
||||
{
|
||||
((EntityLivingBase) mop).setRevengeTarget(shootingEntity);
|
||||
doDamage(1, mop);
|
||||
}
|
||||
}
|
||||
|
||||
if (worldObj.isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ))) {
|
||||
if (worldObj.isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ)))
|
||||
{
|
||||
worldObj.setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.fire.getDefaultState());
|
||||
}
|
||||
|
||||
// spawnHitParticles("magicCrit", 8);
|
||||
// spawnHitParticles("magicCrit", 8);
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
protected void doDamage(int i, Entity mop) {
|
||||
protected void doDamage(int i, Entity mop)
|
||||
{
|
||||
mop.attackEntityFrom(this.getDamageSource(), i);
|
||||
}
|
||||
|
||||
public DamageSource getDamageSource() {
|
||||
public DamageSource getDamageSource()
|
||||
{
|
||||
return DamageSource.causeMobDamage(shootingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteBuf data) {
|
||||
public void writeSpawnData(ByteBuf data)
|
||||
{
|
||||
data.writeByte(this.ticksInAir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteBuf data) {
|
||||
public void readSpawnData(ByteBuf data)
|
||||
{
|
||||
this.ticksInAir = data.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound nbt) {
|
||||
public void writeEntityToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeEntityToNBT(nbt);
|
||||
nbt.setInteger(Constants.NBT.PROJECTILE_TICKS_IN_AIR, ticksInAir);
|
||||
nbt.setInteger(Constants.NBT.PROJECTILE_MAX_TICKS_IN_AIR, maxTicksInAir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
public void readEntityFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readEntityFromNBT(nbt);
|
||||
ticksInAir = nbt.getInteger(Constants.NBT.PROJECTILE_TICKS_IN_AIR);
|
||||
maxTicksInAir = nbt.getInteger(Constants.NBT.PROJECTILE_MAX_TICKS_IN_AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTriggerWalking() {
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThrower(Entity entity) {
|
||||
if (entity instanceof EntityLivingBase) this.shootingEntity = (EntityLivingBase) entity;
|
||||
public void setThrower(Entity entity)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
this.shootingEntity = (EntityLivingBase) entity;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue