mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-21 12:32:33 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
1eaf9b7991
commit
62390a0d0f
79 files changed
+3118
-1929
No files matched your search
@@ -4,10 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -18,8 +14,13 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.utils.EntityUtils;
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* This class is based off of EntityHomingShard.class created by <Azanor> as part of Thaumcraft 5
|
||||
@@ -30,14 +31,14 @@ public class EntityHomingShard extends EntityThrowable implements IEntityAdditio
|
||||
private boolean persistent;
|
||||
private EntityLivingBase target;
|
||||
|
||||
private static final Material[] MATS =
|
||||
{ Material.plants, Material.air, Material.leaves, Material.portal, Material.vine, Material.web };
|
||||
private static final Material[] MATS = { Material.plants, Material.air, Material.leaves, Material.portal,
|
||||
Material.vine, Material.web };
|
||||
|
||||
public EntityHomingShard (final World world) {
|
||||
public EntityHomingShard(final World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityHomingShard (final World world, final EntityLivingBase thrower, final EntityLivingBase target,
|
||||
public EntityHomingShard(final World world, final EntityLivingBase thrower, final EntityLivingBase target,
|
||||
final int strength, final boolean persistent) {
|
||||
super(world, thrower);
|
||||
this.target = target;
|
||||
@@ -45,8 +46,12 @@ public class EntityHomingShard extends EntityThrowable implements IEntityAdditio
|
||||
this.persistent = persistent;
|
||||
setStrength(strength);
|
||||
final Vec3 vec = thrower.getLookVec();
|
||||
setLocationAndAngles(thrower.posX + vec.xCoord / 2.0D, thrower.posY + thrower.getEyeHeight() + vec.yCoord / 2.0D,
|
||||
thrower.posZ + vec.zCoord / 2.0D, thrower.rotationYaw, thrower.rotationPitch);
|
||||
setLocationAndAngles(
|
||||
thrower.posX + vec.xCoord / 2.0D,
|
||||
thrower.posY + thrower.getEyeHeight() + vec.yCoord / 2.0D,
|
||||
thrower.posZ + vec.zCoord / 2.0D,
|
||||
thrower.rotationYaw,
|
||||
thrower.rotationPitch);
|
||||
final float f = 0.5F;
|
||||
final float ry = thrower.rotationYaw + (rand.nextFloat() - rand.nextFloat()) * 60.0F;
|
||||
final float rp = thrower.rotationPitch + (rand.nextFloat() - rand.nextFloat()) * 60.0F;
|
||||
@@ -56,31 +61,31 @@ public class EntityHomingShard extends EntityThrowable implements IEntityAdditio
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInPass (final int pass) {
|
||||
public boolean shouldRenderInPass(final int pass) {
|
||||
return pass == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityInit () {
|
||||
public void entityInit() {
|
||||
super.entityInit();
|
||||
dataWatcher.addObject(17, (byte) 0);
|
||||
}
|
||||
|
||||
public void setStrength (final int strength) {
|
||||
public void setStrength(final int strength) {
|
||||
dataWatcher.updateObject(17, Byte.valueOf((byte) strength));
|
||||
}
|
||||
|
||||
public int getStrength () {
|
||||
public int getStrength() {
|
||||
return dataWatcher.getWatchableObjectByte(17);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getGravityVelocity () {
|
||||
protected float getGravityVelocity() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData (final ByteBuf buf) {
|
||||
public void writeSpawnData(final ByteBuf buf) {
|
||||
int id = -1;
|
||||
if (target != null) {
|
||||
id = target.getEntityId();
|
||||
@@ -89,7 +94,7 @@ public class EntityHomingShard extends EntityThrowable implements IEntityAdditio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData (final ByteBuf buf) {
|
||||
public void readSpawnData(final ByteBuf buf) {
|
||||
final int id = buf.readInt();
|
||||
if (id >= 0) {
|
||||
target = (EntityLivingBase) worldObj.getEntityByID(id);
|
||||
@@ -97,12 +102,17 @@ public class EntityHomingShard extends EntityThrowable implements IEntityAdditio
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact (final MovingObjectPosition mop) {
|
||||
protected void onImpact(final MovingObjectPosition mop) {
|
||||
if (!worldObj.isRemote && mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY
|
||||
&& (getThrower() == null || getThrower() != null && mop.entityHit != getThrower())) {
|
||||
mop.entityHit.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()),
|
||||
mop.entityHit.attackEntityFrom(
|
||||
DamageSource.causeIndirectMagicDamage(this, getThrower()),
|
||||
2.0F + getStrength() * 0.5F);
|
||||
worldObj.playSoundAtEntity(this, "thaumcraft:zap", 1.0F, 1.0F + (rand.nextFloat() - rand.nextFloat()) * 0.2F);
|
||||
worldObj.playSoundAtEntity(
|
||||
this,
|
||||
"thaumcraft:zap",
|
||||
1.0F,
|
||||
1.0F + (rand.nextFloat() - rand.nextFloat()) * 0.2F);
|
||||
worldObj.setEntityState(this, (byte) 16);
|
||||
setDead();
|
||||
}
|
||||
@@ -122,31 +132,34 @@ public class EntityHomingShard extends EntityThrowable implements IEntityAdditio
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void handleHealthUpdate (final byte b) {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleHealthUpdate(final byte b) {
|
||||
if (b == 16) {
|
||||
Thaumcraft.proxy.burst(worldObj, posX, posY, posZ, 0.3F);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
super.handleHealthUpdate(b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate () {
|
||||
public void onUpdate() {
|
||||
final double motion = Math.abs(motionX) + Math.abs(motionY) + Math.abs(motionZ);
|
||||
if (motion > 0.0D && worldObj.isRemote) {
|
||||
Thaumcraft.proxy.sparkle((float) posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F,
|
||||
Thaumcraft.proxy.sparkle(
|
||||
(float) posX + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F,
|
||||
(float) posY + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F,
|
||||
(float) posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F, 0.5F, 0, 0.0F);
|
||||
(float) posZ + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.25F,
|
||||
0.5F,
|
||||
0,
|
||||
0.0F);
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (persistent && (target == null || target.isDead || target.getDistanceSqToEntity(this) > 1250.0D)) {
|
||||
final ArrayList<Entity> ents =
|
||||
EntityUtils.getEntitiesInRange(worldObj, posX, posY, posZ, this, targetClass, 16.0D);
|
||||
final ArrayList<Entity> ents = EntityUtils
|
||||
.getEntitiesInRange(worldObj, posX, posY, posZ, this, targetClass, 16.0D);
|
||||
|
||||
for (final Entity entity : ents) {
|
||||
if (entity instanceof EntityLivingBase && !entity.isDead
|
||||
|
||||
Reference in new issue
Block a user