Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -8,7 +8,8 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -16,27 +17,23 @@ 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;
|
||||
|
@ -53,14 +50,12 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
|
|||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
protected float getGravityVelocity() {
|
||||
return 0F;
|
||||
}
|
||||
|
||||
@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(var1 * var1 + var3 * var3 + var5 * var5);
|
||||
var1 /= var9;
|
||||
var3 /= var9;
|
||||
|
@ -80,33 +75,26 @@ 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(RayTraceResult mop)
|
||||
{
|
||||
if (mop.typeOfHit == RayTraceResult.Type.ENTITY && mop.entityHit != null)
|
||||
{
|
||||
if (mop.entityHit == shootingEntity)
|
||||
{
|
||||
protected void onImpact(RayTraceResult mop) {
|
||||
if (mop.typeOfHit == RayTraceResult.Type.ENTITY && mop.entityHit != null) {
|
||||
if (mop.entityHit == shootingEntity) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.onImpact(mop.entityHit);
|
||||
} else if (mop.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
} else if (mop.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
EnumFacing sideHit = mop.sideHit;
|
||||
BlockPos blockPos = mop.getBlockPos().offset(sideHit);
|
||||
|
||||
if (getEntityWorld().isAirBlock(blockPos))
|
||||
{
|
||||
if (getEntityWorld().isAirBlock(blockPos)) {
|
||||
getEntityWorld().setBlockState(blockPos, RegistrarBloodMagicBlocks.BLOOD_LIGHT.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
@ -114,23 +102,18 @@ 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 (getEntityWorld().isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ)))
|
||||
{
|
||||
if (getEntityWorld().isAirBlock(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ))) {
|
||||
getEntityWorld().setBlockState(new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), Blocks.FIRE.getDefaultState());
|
||||
}
|
||||
|
||||
|
@ -138,59 +121,50 @@ public class EntityBloodLight extends EntityThrowable implements IThrowableEntit
|
|||
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)
|
||||
{
|
||||
public void setThrower(Entity entity) {
|
||||
if (entity instanceof EntityLivingBase)
|
||||
this.shootingEntity = (EntityLivingBase) entity;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package WayofTime.bloodmagic.entity.projectile;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.meteor.MeteorRegistry;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
|
@ -11,27 +13,20 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.IThrowableEntity;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.meteor.MeteorRegistry;
|
||||
|
||||
public class EntityMeteor extends EntityThrowable implements IThrowableEntity
|
||||
{
|
||||
public class EntityMeteor extends EntityThrowable implements IThrowableEntity {
|
||||
public ItemStack meteorStack = ItemStack.EMPTY;
|
||||
protected int ticksInAir = 0;
|
||||
protected int maxTicksInAir = 600;
|
||||
|
||||
protected double radiusModifier = 1;
|
||||
protected double explosionModifier = 1;
|
||||
protected double fillerChance = 0;
|
||||
|
||||
public ItemStack meteorStack = ItemStack.EMPTY;
|
||||
|
||||
public EntityMeteor(World world)
|
||||
{
|
||||
public EntityMeteor(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMeteor(World world, double x, double y, double z, double velX, double velY, double velZ, double radiusModifier, double explosionModifier, double fillerChance)
|
||||
{
|
||||
public EntityMeteor(World world, double x, double y, double z, double velX, double velY, double velZ, double radiusModifier, double explosionModifier, double fillerChance) {
|
||||
super(world);
|
||||
this.setSize(1F, 1F);
|
||||
this.setPosition(x, y, z);
|
||||
|
@ -44,39 +39,31 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity()
|
||||
{
|
||||
protected float getGravityVelocity() {
|
||||
return 0.03F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (this.ticksExisted > this.maxTicksInAir)
|
||||
{
|
||||
if (this.ticksExisted > this.maxTicksInAir) {
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult mop)
|
||||
{
|
||||
if (mop.typeOfHit == RayTraceResult.Type.ENTITY && mop.entityHit != null)
|
||||
{
|
||||
protected void onImpact(RayTraceResult mop) {
|
||||
if (mop.typeOfHit == RayTraceResult.Type.ENTITY && mop.entityHit != null) {
|
||||
this.onImpact(mop.entityHit);
|
||||
} else if (mop.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
} else if (mop.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
generateMeteor(mop.getBlockPos());
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
protected void onImpact(Entity mop)
|
||||
{
|
||||
if (mop instanceof EntityLivingBase)
|
||||
{
|
||||
protected void onImpact(Entity mop) {
|
||||
if (mop instanceof EntityLivingBase) {
|
||||
doDamage(100, mop);
|
||||
}
|
||||
|
||||
|
@ -86,24 +73,20 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
|
|||
this.setDead();
|
||||
}
|
||||
|
||||
protected void doDamage(int i, Entity mop)
|
||||
{
|
||||
protected void doDamage(int i, Entity mop) {
|
||||
mop.attackEntityFrom(this.getDamageSource(), i);
|
||||
}
|
||||
|
||||
public void generateMeteor(BlockPos pos)
|
||||
{
|
||||
public void generateMeteor(BlockPos pos) {
|
||||
MeteorRegistry.generateMeteorForItem(meteorStack, getEntityWorld(), pos, Blocks.STONE.getDefaultState(), radiusModifier, explosionModifier, fillerChance);
|
||||
}
|
||||
|
||||
public DamageSource getDamageSource()
|
||||
{
|
||||
public DamageSource getDamageSource() {
|
||||
return DamageSource.ANVIL;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
@ -117,8 +100,7 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
|
|||
}
|
||||
|
||||
@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);
|
||||
|
@ -132,20 +114,17 @@ public class EntityMeteor extends EntityThrowable implements IThrowableEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
protected boolean canTriggerWalking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
public boolean canBeCollidedWith() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThrower(Entity entity)
|
||||
{
|
||||
public void setThrower(Entity entity) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package WayofTime.bloodmagic.entity.projectile;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -9,40 +12,30 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class EntitySentientArrow extends EntityTippedArrow
|
||||
{
|
||||
public class EntitySentientArrow extends EntityTippedArrow {
|
||||
public double reimbursedAmountOnHit = 0;
|
||||
public EnumDemonWillType type = EnumDemonWillType.DEFAULT;
|
||||
|
||||
public EntitySentientArrow(World worldIn)
|
||||
{
|
||||
public EntitySentientArrow(World worldIn) {
|
||||
super(worldIn);
|
||||
}
|
||||
|
||||
public EntitySentientArrow(World worldIn, double x, double y, double z)
|
||||
{
|
||||
public EntitySentientArrow(World worldIn, double x, double y, double z) {
|
||||
super(worldIn, x, y, z);
|
||||
}
|
||||
|
||||
public EntitySentientArrow(World worldIn, EntityLivingBase shooter, EnumDemonWillType type, double reinburseAmount)
|
||||
{
|
||||
public EntitySentientArrow(World worldIn, EntityLivingBase shooter, EnumDemonWillType type, double reinburseAmount) {
|
||||
super(worldIn, shooter);
|
||||
this.reimbursedAmountOnHit = reinburseAmount;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void reimbursePlayer(EntityLivingBase hitEntity, float damage)
|
||||
{
|
||||
if (this.shootingEntity instanceof EntityPlayer)
|
||||
{
|
||||
if (hitEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob))
|
||||
{
|
||||
public void reimbursePlayer(EntityLivingBase hitEntity, float damage) {
|
||||
if (this.shootingEntity instanceof EntityPlayer) {
|
||||
if (hitEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(hitEntity instanceof IMob)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -51,8 +44,7 @@ public class EntitySentientArrow extends EntityTippedArrow
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void writeEntityToNBT(NBTTagCompound tag) {
|
||||
super.writeEntityToNBT(tag);
|
||||
|
||||
tag.setDouble("reimbursement", reimbursedAmountOnHit);
|
||||
|
@ -60,8 +52,7 @@ public class EntitySentientArrow extends EntityTippedArrow
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
public void readEntityFromNBT(NBTTagCompound tag) {
|
||||
super.readEntityFromNBT(tag);
|
||||
|
||||
reimbursedAmountOnHit = tag.getDouble("reimbursement");
|
||||
|
@ -69,8 +60,7 @@ public class EntitySentientArrow extends EntityTippedArrow
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getArrowStack()
|
||||
{
|
||||
protected ItemStack getArrowStack() {
|
||||
return new ItemStack(Items.ARROW);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,20 +9,16 @@ import net.minecraft.util.EnumParticleTypes;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntitySoulSnare extends EntityThrowable
|
||||
{
|
||||
public EntitySoulSnare(World worldIn)
|
||||
{
|
||||
public class EntitySoulSnare extends EntityThrowable {
|
||||
public EntitySoulSnare(World worldIn) {
|
||||
super(worldIn);
|
||||
}
|
||||
|
||||
public EntitySoulSnare(World worldIn, EntityLivingBase throwerIn)
|
||||
{
|
||||
public EntitySoulSnare(World worldIn, EntityLivingBase throwerIn) {
|
||||
super(worldIn, throwerIn);
|
||||
}
|
||||
|
||||
public EntitySoulSnare(World worldIn, double x, double y, double z)
|
||||
{
|
||||
public EntitySoulSnare(World worldIn, double x, double y, double z) {
|
||||
super(worldIn, x, y, z);
|
||||
}
|
||||
|
||||
|
@ -30,30 +26,24 @@ public class EntitySoulSnare extends EntityThrowable
|
|||
* Called when this EntityThrowable hits a block or entity.
|
||||
*/
|
||||
@Override
|
||||
protected void onImpact(RayTraceResult result)
|
||||
{
|
||||
if (result.entityHit == this.getThrower() && this.ticksExisted < 20)
|
||||
{
|
||||
protected void onImpact(RayTraceResult result) {
|
||||
if (result.entityHit == this.getThrower() && this.ticksExisted < 20) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.entityHit != null && result.entityHit != this.getThrower())
|
||||
{
|
||||
if (result.entityHit instanceof EntityLivingBase && result.entityHit.getEntityWorld().rand.nextDouble() < 0.25)
|
||||
{
|
||||
if (result.entityHit != null && result.entityHit != this.getThrower()) {
|
||||
if (result.entityHit instanceof EntityLivingBase && result.entityHit.getEntityWorld().rand.nextDouble() < 0.25) {
|
||||
((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_SNARE, 300, 0));
|
||||
}
|
||||
|
||||
result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) 0);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 8; ++j)
|
||||
{
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
this.getEntityWorld().spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (!this.getEntityWorld().isRemote)
|
||||
{
|
||||
if (!this.getEntityWorld().isRemote) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue