Split up and reorganise WizardryUtilities
This commit is contained in:
@@ -5,9 +5,10 @@ import electroblob.wizardry.entity.EntityLevitatingBlock;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -92,12 +93,12 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
double radius = 6; // TODO: Support for spell properties and modifiers
|
||||
|
||||
boolean suckInBlocks = getCaster() instanceof EntityPlayer && WizardryUtilities.canDamageBlocks(getCaster(), world)
|
||||
boolean suckInBlocks = getCaster() instanceof EntityPlayer && EntityUtils.canDamageBlocks(getCaster(), world)
|
||||
&& ItemArtefact.isArtefactActive((EntityPlayer)getCaster(), WizardryItems.charm_black_hole);
|
||||
|
||||
if(suckInBlocks){
|
||||
|
||||
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(new BlockPos(this), radius);
|
||||
List<BlockPos> sphere = BlockUtils.getBlockSphere(new BlockPos(this), radius);
|
||||
|
||||
int blocksUnhooked = 0;
|
||||
|
||||
@@ -105,7 +106,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
if(rand.nextInt(Math.max(1, (int)this.getDistanceSq(pos) * 3)) == 0){
|
||||
|
||||
if(!WizardryUtilities.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
if(!BlockUtils.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
&& world.isBlockNormalCube(pos, false)){
|
||||
// Checks that the block above is not solid, since this causes the falling block to vanish.
|
||||
// && !world.isBlockNormalCube(pos.up(), false)){
|
||||
@@ -124,7 +125,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
|
||||
}
|
||||
|
||||
List<Entity> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
List<Entity> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world, Entity.class);
|
||||
|
||||
targets.removeIf(t -> !(t instanceof EntityLivingBase || (suckInBlocks && t instanceof EntityFallingBlock)));
|
||||
@@ -137,7 +138,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|
||||
if(!(target instanceof EntityPlayer && ((getCaster() instanceof EntityPlayer && !Wizardry.settings.playersMoveEachOther)
|
||||
|| ItemArtefact.isArtefactActive((EntityPlayer)target, WizardryItems.amulet_anchoring)))){
|
||||
|
||||
WizardryUtilities.undoGravity(target);
|
||||
EntityUtils.undoGravity(target);
|
||||
if(target instanceof EntityLevitatingBlock) ((EntityLevitatingBlock)target).suspend();
|
||||
|
||||
// Sucks the target in
|
||||
|
||||
@@ -4,11 +4,11 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -38,7 +38,7 @@ public class EntityBlizzard extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
@@ -46,11 +46,11 @@ public class EntityBlizzard extends EntityMagicConstruct {
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target,
|
||||
EntityUtils.attackEntityWithoutKnockback(target,
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.FROST),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, DamageSource.MAGIC,
|
||||
EntityUtils.attackEntityWithoutKnockback(target, DamageSource.MAGIC,
|
||||
1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Entrapment;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
@@ -46,32 +46,32 @@ public class EntityBubble extends EntityMagicConstruct {
|
||||
|
||||
// Synchronises the rider field
|
||||
if((this.rider == null || this.rider.get() == null)
|
||||
&& WizardryUtilities.getRider(this) instanceof EntityLivingBase
|
||||
&& !WizardryUtilities.getRider(this).isDead){
|
||||
this.rider = new WeakReference<>((EntityLivingBase)WizardryUtilities.getRider(this));
|
||||
&& EntityUtils.getRider(this) instanceof EntityLivingBase
|
||||
&& !EntityUtils.getRider(this).isDead){
|
||||
this.rider = new WeakReference<>((EntityLivingBase)EntityUtils.getRider(this));
|
||||
}
|
||||
|
||||
// Prevents dismounting
|
||||
if(WizardryUtilities.getRider(this) == null && this.rider != null && this.rider.get() != null
|
||||
if(EntityUtils.getRider(this) == null && this.rider != null && this.rider.get() != null
|
||||
&& !this.rider.get().isDead){
|
||||
this.rider.get().startRiding(this);
|
||||
}
|
||||
|
||||
// Stops the bubble bursting instantly.
|
||||
if(this.ticksExisted < 1 && !isDarkOrb) ((EntityLivingBase)WizardryUtilities.getRider(this)).hurtTime = 0;
|
||||
if(this.ticksExisted < 1 && !isDarkOrb) ((EntityLivingBase)EntityUtils.getRider(this)).hurtTime = 0;
|
||||
|
||||
this.move(MoverType.SELF, 0, 0.03, 0);
|
||||
|
||||
if(isDarkOrb){
|
||||
|
||||
if(WizardryUtilities.getRider(this) != null
|
||||
&& WizardryUtilities.getRider(this).ticksExisted % Spells.entrapment.getProperty(Entrapment.DAMAGE_INTERVAL).intValue() == 0){
|
||||
if(EntityUtils.getRider(this) != null
|
||||
&& EntityUtils.getRider(this).ticksExisted % Spells.entrapment.getProperty(Entrapment.DAMAGE_INTERVAL).intValue() == 0){
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(
|
||||
EntityUtils.getRider(this).attackEntityFrom(
|
||||
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
|
||||
1 * damageMultiplier);
|
||||
}else{
|
||||
WizardryUtilities.getRider(this).attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
EntityUtils.getRider(this).attackEntityFrom(DamageSource.MAGIC, 1 * damageMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class EntityBubble extends EntityMagicConstruct {
|
||||
|
||||
// Bubble bursts if the entity is hurt (see event handler) or killed, or if the bubble has existed for more than
|
||||
// 10 seconds.
|
||||
if(WizardryUtilities.getRider(this) == null && this.ticksExisted > 1){
|
||||
if(EntityUtils.getRider(this) == null && this.ticksExisted > 1){
|
||||
if(!this.isDarkOrb) this.playSound(WizardrySounds.ENTITY_BUBBLE_POP, 1.5f, 1.0f);
|
||||
this.setDead();
|
||||
}
|
||||
@@ -100,8 +100,8 @@ public class EntityBubble extends EntityMagicConstruct {
|
||||
|
||||
@Override
|
||||
public void despawn(){
|
||||
if(WizardryUtilities.getRider(this) != null){
|
||||
((EntityLivingBase)WizardryUtilities.getRider(this)).dismountEntity(this);
|
||||
if(EntityUtils.getRider(this) != null){
|
||||
((EntityLivingBase)EntityUtils.getRider(this)).dismountEntity(this);
|
||||
}
|
||||
if(!this.isDarkOrb) this.playSound(WizardrySounds.ENTITY_BUBBLE_POP, 1.5f, 1.0f);
|
||||
super.despawn();
|
||||
|
||||
@@ -2,7 +2,7 @@ package electroblob.wizardry.entity.construct;
|
||||
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -25,7 +25,7 @@ public class EntityCombustionRune extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -34,7 +34,7 @@ public class EntityCombustionRune extends EntityMagicConstruct {
|
||||
float strength = Spells.combustion_rune.getProperty(Spell.BLAST_RADIUS).floatValue();
|
||||
|
||||
world.newExplosion(this.getCaster(), this.posX, this.posY, this.posZ, strength, true,
|
||||
getCaster() != null && WizardryUtilities.canDamageBlocks(getCaster(), world));
|
||||
getCaster() != null && EntityUtils.canDamageBlocks(getCaster(), world));
|
||||
|
||||
// The trap is destroyed once triggered.
|
||||
this.setDead();
|
||||
|
||||
@@ -4,9 +4,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -36,7 +36,7 @@ public class EntityDecay extends EntityMagicConstruct {
|
||||
0.6F + rand.nextFloat() * 0.15F);
|
||||
|
||||
if(!this.world.isRemote){
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
for(EntityLivingBase target : targets){
|
||||
if(target != this.getCaster()){
|
||||
|
||||
@@ -2,9 +2,10 @@ package electroblob.wizardry.entity.construct;
|
||||
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Earthquake;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -46,7 +47,7 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
if(!WizardryUtilities.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
if(!BlockUtils.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
|
||||
&& world.isBlockNormalCube(pos, false)
|
||||
// Checks that the block above is not solid, since this causes the falling sand to vanish.
|
||||
&& !world.isBlockNormalCube(pos.up(), false)){
|
||||
@@ -61,7 +62,7 @@ public class EntityEarthquake extends EntityMagicConstruct {
|
||||
|
||||
}
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities
|
||||
List<EntityLivingBase> targets = EntityUtils
|
||||
.getEntitiesWithinRadius((this.ticksExisted * speed) + 1.5, this.posX, this.posY, this.posZ, world);
|
||||
|
||||
// In this particular instance, the caster is completely unaffected because they will always be in the
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
@@ -32,7 +32,7 @@ public class EntityFireRing extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(2.5d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
@@ -29,7 +29,7 @@ public class EntityFireSigil extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(width/2, posX, posY, posZ, world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
|
||||
@@ -6,10 +6,8 @@ import electroblob.wizardry.entity.projectile.EntityMagicArrow;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -100,7 +98,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
// If they will be inside the forcefield next tick, sets their position and velocity such that they appear to
|
||||
// bounce off the forcefield and creates impact particle effects and sounds where they hit it
|
||||
|
||||
List<Entity> targets = WizardryUtilities.getEntitiesWithinRadius(radius + SEARCH_BORDER_SIZE, posX, posY, posZ, world, Entity.class);
|
||||
List<Entity> targets = EntityUtils.getEntitiesWithinRadius(radius + SEARCH_BORDER_SIZE, posX, posY, posZ, world, Entity.class);
|
||||
|
||||
targets.remove(this);
|
||||
targets.removeIf(t -> t instanceof EntityXPOrb); // Gets annoying since they're attracted to the player
|
||||
@@ -117,7 +115,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
Vec3d currentPos = Arrays.stream(WizardryUtilities.getVertices(target.getEntityBoundingBox()))
|
||||
Vec3d currentPos = Arrays.stream(GeometryUtils.getVertices(target.getEntityBoundingBox()))
|
||||
.min(Comparator.comparingDouble(v -> v.distanceTo(this.getPositionVector())))
|
||||
.orElse(target.getPositionVector()); // This will never happen, it's just here to make the compiler happy
|
||||
|
||||
@@ -130,7 +128,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
boolean flag;
|
||||
|
||||
if(WizardryUtilities.isLiving(target)){
|
||||
if(EntityUtils.isLiving(target)){
|
||||
// Non-allied living entities shouldn't be inside at all
|
||||
flag = nextTickDistance <= radius;
|
||||
}else{
|
||||
@@ -143,7 +141,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
// Ring of interdiction
|
||||
if(getCaster() instanceof EntityPlayer && ItemArtefact.isArtefactActive((EntityPlayer)getCaster(),
|
||||
WizardryItems.ring_interdiction) && WizardryUtilities.isLiving(target)){
|
||||
WizardryItems.ring_interdiction) && EntityUtils.isLiving(target)){
|
||||
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, getCaster(),
|
||||
MagicDamage.DamageType.MAGIC), 1);
|
||||
}
|
||||
@@ -151,7 +149,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
Vec3d targetRelativePos = currentPos.subtract(this.getPositionVector());
|
||||
|
||||
double nudgeVelocity = this.contains(target) ? -0.1 : 0.1;
|
||||
if(WizardryUtilities.isLiving(target)) nudgeVelocity = 0.25;
|
||||
if(EntityUtils.isLiving(target)) nudgeVelocity = 0.25;
|
||||
Vec3d extraVelocity = targetRelativePos.normalize().scale(nudgeVelocity);
|
||||
|
||||
// ...make it bounce off!
|
||||
@@ -216,7 +214,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
/** Returns true if the given bounding box is completely inside this forcefield (the surface counts as outside). */
|
||||
public boolean contains(AxisAlignedBB box){
|
||||
return Arrays.stream(WizardryUtilities.getVertices(box)).allMatch(this::contains);
|
||||
return Arrays.stream(GeometryUtils.getVertices(box)).allMatch(this::contains);
|
||||
}
|
||||
|
||||
/** Returns true if the given entity is completely inside this forcefield (the surface counts as outside). */
|
||||
@@ -303,7 +301,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
double searchRadius = 20;
|
||||
|
||||
List<EntityForcefield> forcefields = WizardryUtilities.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
List<EntityForcefield> forcefields = EntityUtils.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
vec.y, vec.z, world, EntityForcefield.class);
|
||||
|
||||
forcefields.removeIf(f -> !f.contains(vec));
|
||||
@@ -317,7 +315,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
double searchRadius = 20;
|
||||
|
||||
List<EntityForcefield> forcefields = WizardryUtilities.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
List<EntityForcefield> forcefields = EntityUtils.getEntitiesWithinRadius(searchRadius, vec.x,
|
||||
vec.y, vec.z, world, EntityForcefield.class);
|
||||
|
||||
forcefields.removeIf(f -> !f.contains(box));
|
||||
@@ -348,7 +346,7 @@ public class EntityForcefield extends EntityMagicConstruct implements ICustomHit
|
||||
|
||||
// If the player is trying to interact across a forcefield boundary, cancel the event
|
||||
// The most pragmatic solution here is to use the centres - it's not perfect, but it's simple!
|
||||
if(getSurroundingForcefield(event.getWorld(), WizardryUtilities.getCentre(box))
|
||||
if(getSurroundingForcefield(event.getWorld(), GeometryUtils.getCentre(box))
|
||||
!= getSurroundingForcefield(event.getWorld(), event.getEntityPlayer().getPositionVector())){
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -32,14 +32,14 @@ public class EntityFrostSigil extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(this.isValidTarget(target)){
|
||||
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, this.getCaster() != null
|
||||
EntityUtils.attackEntityWithoutKnockback(target, this.getCaster() != null
|
||||
? MagicDamage.causeIndirectMagicDamage(this, this.getCaster(), DamageType.FROST)
|
||||
: DamageSource.MAGIC, Spells.frost_sigil.getProperty(Spell.DAMAGE).floatValue()
|
||||
* damageMultiplier);
|
||||
|
||||
@@ -8,11 +8,11 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.LightningHammer;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -105,7 +105,7 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
|
||||
double seekerRange = Spells.lightning_hammer.getProperty(Spell.EFFECT_RADIUS).doubleValue();
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(seekerRange, this.posX,
|
||||
this.posY + 1, this.posZ, world);
|
||||
|
||||
int maxTargets = Spells.lightning_hammer.getProperty(LightningHammer.SECONDARY_MAX_TARGETS).intValue();
|
||||
@@ -113,7 +113,7 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
if(WizardryUtilities.isLiving(target) && this.isValidTarget(target)
|
||||
if(EntityUtils.isLiving(target) && this.isValidTarget(target)
|
||||
&& target.ticksExisted % Spells.lightning_hammer.getProperty(LightningHammer.ATTACK_INTERVAL).floatValue() == 0){
|
||||
|
||||
if(world.isRemote){
|
||||
@@ -129,9 +129,9 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
float damage = Spells.lightning_hammer.getProperty(Spell.SPLASH_DAMAGE).floatValue() * damageMultiplier;
|
||||
|
||||
if(this.getCaster() != null){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
this, getCaster(), DamageType.SHOCK), damage);
|
||||
WizardryUtilities.applyStandardKnockback(this, target);
|
||||
EntityUtils.applyStandardKnockback(this, target);
|
||||
}else{
|
||||
target.attackEntityFrom(DamageSource.MAGIC, damage);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class EntityHammer extends EntityMagicConstruct {
|
||||
}
|
||||
|
||||
if(this.fallDistance > 10){
|
||||
WizardryUtilities.getEntitiesWithinRadius(10, posX, posY, posZ, world, EntityPlayer.class)
|
||||
EntityUtils.getEntitiesWithinRadius(10, posX, posY, posZ, world, EntityPlayer.class)
|
||||
.forEach(p -> Wizardry.proxy.shakeScreen(p, 6));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -36,7 +36,7 @@ public class EntityHealAura extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(2.5, posX, posY, posZ, world);
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(2.5, posX, posY, posZ, world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.GeometryUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
@@ -27,9 +27,9 @@ public class EntityIceSpike extends EntityMagicConstruct {
|
||||
|
||||
public void setFacing(EnumFacing facing){
|
||||
this.facing = facing;
|
||||
this.setRotation(-facing.getHorizontalAngle(), WizardryUtilities.getPitch(facing));
|
||||
this.setRotation(-facing.getHorizontalAngle(), GeometryUtils.getPitch(facing));
|
||||
float yaw = (-facing.getHorizontalAngle()) * (float)Math.PI/180;
|
||||
float pitch = (WizardryUtilities.getPitch(facing) - 90) * (float)Math.PI/180;
|
||||
float pitch = (GeometryUtils.getPitch(facing) - 90) * (float)Math.PI/180;
|
||||
Vec3d min = this.getPositionVector().add(new Vec3d(-width/2, 0, -width/2).rotatePitch(pitch).rotateYaw(yaw));
|
||||
Vec3d max = this.getPositionVector().add(new Vec3d(width/2, height, width/2).rotatePitch(pitch).rotateYaw(yaw));
|
||||
this.setEntityBoundingBox(new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z));
|
||||
|
||||
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.construct;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -34,7 +34,7 @@ public class EntityLightningSigil extends EntityMagicConstruct {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(1.0d, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
@@ -60,7 +60,7 @@ public class EntityLightningSigil extends EntityMagicConstruct {
|
||||
// Secondary chaining effect
|
||||
double seekerRange = Spells.lightning_sigil.getProperty(Spell.EFFECT_RADIUS).doubleValue();
|
||||
|
||||
List<EntityLivingBase> secondaryTargets = WizardryUtilities.getEntitiesWithinRadius(seekerRange,
|
||||
List<EntityLivingBase> secondaryTargets = EntityUtils.getEntitiesWithinRadius(seekerRange,
|
||||
target.posX, target.posY + target.height / 2, target.posZ, world);
|
||||
|
||||
for(int j = 0; j < Math.min(secondaryTargets.size(),
|
||||
|
||||
@@ -4,7 +4,7 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.item.ISpellCastingItem;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.util.AllyDesignationSystem;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -147,7 +147,7 @@ public abstract class EntityMagicConstruct extends Entity implements IEntityOwna
|
||||
@Nullable
|
||||
public EntityLivingBase getCaster(){ // Kept despite the above method because it returns an EntityLivingBase
|
||||
|
||||
Entity entity = WizardryUtilities.getEntityByUUID(world, getOwnerId());
|
||||
Entity entity = EntityUtils.getEntityByUUID(world, getOwnerId());
|
||||
|
||||
if(entity != null && !(entity instanceof EntityLivingBase)){ // Should never happen
|
||||
Wizardry.logger.warn("{} has a non-living owner!", this);
|
||||
|
||||
@@ -4,10 +4,10 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -69,7 +69,7 @@ public class EntityStormcloud extends EntityMagicConstruct {
|
||||
if(target.ticksExisted % 150 == 0){ // Use target's lifetime so they don't all get hit at once, looks better
|
||||
|
||||
if(!this.world.isRemote){
|
||||
WizardryUtilities.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
EntityUtils.attackEntityWithoutKnockback(target, MagicDamage.causeIndirectMagicDamage(
|
||||
this, this.getCaster(), MagicDamage.DamageType.SHOCK), damage);
|
||||
}else{
|
||||
ParticleBuilder.create(Type.LIGHTNING).pos(target.posX, posY + height/2, target.posZ)
|
||||
|
||||
@@ -7,11 +7,9 @@ import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.spell.Tornado;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.*;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -60,7 +58,7 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
this.move(MoverType.SELF, velX, motionY, velZ);
|
||||
|
||||
BlockPos pos = new BlockPos(this);
|
||||
Integer y = WizardryUtilities.getNearestSurface(world, pos.up(3), EnumFacing.UP, 5, true, WizardryUtilities.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
Integer y = BlockUtils.getNearestSurface(world, pos.up(3), EnumFacing.UP, 5, true, BlockUtils.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
|
||||
if(y != null){
|
||||
|
||||
@@ -74,7 +72,7 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
if(!this.world.isRemote){
|
||||
|
||||
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
|
||||
this.posZ, this.world);
|
||||
|
||||
for(EntityLivingBase target : targets){
|
||||
@@ -125,7 +123,7 @@ public class EntityTornado extends EntityMagicConstruct {
|
||||
|
||||
BlockPos pos1 = new BlockPos(blockX, this.posY + 3, blockZ);
|
||||
|
||||
Integer blockY = WizardryUtilities.getNearestSurface(world, pos1, EnumFacing.UP, 5, true, WizardryUtilities.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
Integer blockY = BlockUtils.getNearestSurface(world, pos1, EnumFacing.UP, 5, true, BlockUtils.SurfaceCriteria.NOT_AIR_TO_AIR);
|
||||
|
||||
if(blockY != null){
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.SpellMinion;
|
||||
import electroblob.wizardry.spell.ZombieApocalypse;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.WizardryUtilities.Operations;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
@@ -49,7 +49,7 @@ public class EntityZombieSpawner extends EntityMagicConstruct {
|
||||
zombie.setLifetime(Spells.zombie_apocalypse.getProperty(SpellMinion.MINION_LIFETIME).intValue());
|
||||
IAttributeInstance attribute = zombie.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
|
||||
attribute.applyModifier(new AttributeModifier(SpellMinion.POTENCY_ATTRIBUTE_MODIFIER,
|
||||
damageMultiplier - 1, Operations.MULTIPLY_CUMULATIVE));
|
||||
damageMultiplier - 1, EntityUtils.Operations.MULTIPLY_CUMULATIVE));
|
||||
zombie.setHealth(zombie.getMaxHealth()); // Need to set this because we may have just modified the value
|
||||
zombie.hurtResistantTime = 30; // Prevent fall damage
|
||||
zombie.hideParticles(); // Hide spawn particles or they pop out the top of the hidden box
|
||||
|
||||
Reference in New Issue
Block a user