Split up and reorganise WizardryUtilities

This commit is contained in:
Electroblob77
2020-06-13 23:29:01 +01:00
parent 57e96458d5
commit 238b9d04bb
189 changed files with 1724 additions and 1731 deletions
@@ -3,10 +3,7 @@ package electroblob.wizardry.entity;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.AllyDesignationSystem;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.WizardryUtilities;
import electroblob.wizardry.util.*;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling;
@@ -81,7 +78,7 @@ public class EntityLevitatingBlock extends EntityFallingBlock implements IEntity
}
if(this.getCaster() == null && this.casterUUID != null){
Entity entity = WizardryUtilities.getEntityByUUID(world, casterUUID);
Entity entity = EntityUtils.getEntityByUUID(world, casterUUID);
if(entity instanceof EntityLivingBase){
this.caster = new WeakReference<>((EntityLivingBase)entity);
}
@@ -5,7 +5,7 @@ import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.spell.Meteor;
import electroblob.wizardry.util.WizardryUtilities;
import electroblob.wizardry.util.EntityUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.item.EntityFallingBlock;
@@ -76,7 +76,7 @@ public class EntityMeteor extends EntityFallingBlock {
this.setDead();
}else{
WizardryUtilities.getEntitiesWithinRadius(15, posX, posY, posZ, world, EntityPlayer.class)
EntityUtils.getEntitiesWithinRadius(15, posX, posY, posZ, world, EntityPlayer.class)
.forEach(p -> Wizardry.proxy.shakeScreen(p, 10));
}
}
@@ -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
@@ -369,7 +369,7 @@ public class EntityEvilWizard extends EntityMob implements ISpellCaster, IEntity
Element element = this.getElement();
// Adds armour.
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
for(EntityEquipmentSlot slot : InventoryUtils.ARMOUR_SLOTS){
this.setItemStackToSlot(slot, new ItemStack(WizardryItems.getArmour(element, slot)));
}
@@ -4,8 +4,8 @@ import electroblob.wizardry.client.DrawingUtils;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.BlockUtils;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
@@ -161,7 +161,7 @@ public class EntityPhoenix extends EntitySummonedCreature implements ISpellCaste
public void onLivingUpdate(){
// Makes the phoenix hover.
Integer floorLevel = WizardryUtilities.getNearestFloor(world, new BlockPos(this), 4);
Integer floorLevel = BlockUtils.getNearestFloor(world, new BlockPos(this), 4);
if(floorLevel == null || this.posY - floorLevel > 3){
this.motionY = -0.1;
@@ -1,7 +1,7 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.WizardryUtilities.Operations;
import electroblob.wizardry.util.EntityUtils;
import net.minecraft.entity.EntityFlying;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
@@ -73,7 +73,7 @@ public class EntitySkeletonMinion extends AbstractSkeleton implements ISummonedC
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata){
// Can't call super, so the code from the next level up (EntityLiving) had to be copied as well.
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, Operations.MULTIPLY_FLAT));
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, EntityUtils.Operations.MULTIPLY_FLAT));
if(this.rand.nextFloat() < 0.05F){
this.setLeftHanded(true);
@@ -1,9 +1,9 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
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.EntityFlying;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
@@ -67,7 +67,7 @@ public class EntitySpiderMinion extends EntityCaveSpider implements ISummonedCre
// Can't call super, so the code from the next level up (EntityLiving) had to be copied as well.
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, Operations.MULTIPLY_FLAT));
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, EntityUtils.Operations.MULTIPLY_FLAT));
if(this.rand.nextFloat() < 0.05F){
this.setLeftHanded(true);
@@ -3,9 +3,9 @@ package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.item.ISpellCastingItem;
import electroblob.wizardry.registry.WizardrySounds;
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.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
@@ -124,7 +124,7 @@ public class EntitySpiritHorse extends EntityHorse {
private EntityLivingBase getOwner(){
// I think the DataManager stores any objects, so it now stores the UUID instead of its string representation.
Entity owner = WizardryUtilities.getEntityByUUID(world, this.getOwnerUniqueId());
Entity owner = EntityUtils.getEntityByUUID(world, this.getOwnerUniqueId());
if(owner instanceof EntityLivingBase){
return (EntityLivingBase)owner;
@@ -1,7 +1,7 @@
package electroblob.wizardry.entity.living;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.WizardryUtilities.Operations;
import electroblob.wizardry.util.EntityUtils;
import net.minecraft.entity.EntityFlying;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityLivingData;
@@ -75,7 +75,7 @@ public class EntityWitherSkeletonMinion extends EntityWitherSkeleton implements
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata){
// Can't call super, so the code from the next level up (EntityLiving) had to be copied as well.
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, Operations.MULTIPLY_FLAT));
.applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, EntityUtils.Operations.MULTIPLY_FLAT));
if(this.rand.nextFloat() < 0.05F){
this.setLeftHanded(true);
@@ -469,7 +469,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
if(!world.isRemote && !this.getCustomer().isCreative() && Wizardry.settings.discoveryMode){
// Sound and text only happen server-side, in survival, with discovery mode on
WizardryUtilities.playSoundAtPlayer(this.getCustomer(), WizardrySounds.MISC_DISCOVER_SPELL, 1.25f, 1);
EntityUtils.playSoundAtPlayer(this.getCustomer(), WizardrySounds.MISC_DISCOVER_SPELL, 1.25f, 1);
this.getCustomer().sendMessage(new TextComponentTranslation("spell.discover",
spell.getNameForTranslationFormatted()));
}
@@ -673,7 +673,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
}else if(randomiser < 8){
return new ItemStack(WizardryItems.arcane_tome, 1, 1);
}else if(randomiser < 10){
EntityEquipmentSlot slot = WizardryUtilities.ARMOUR_SLOTS[rand.nextInt(WizardryUtilities.ARMOUR_SLOTS.length)];
EntityEquipmentSlot slot = InventoryUtils.ARMOUR_SLOTS[rand.nextInt(InventoryUtils.ARMOUR_SLOTS.length)];
if(this.getElement() != Element.MAGIC && rand.nextInt(4) > 0){
// This means it is more likely for armour sold to be of the same element as the wizard if the
// wizard has an element.
@@ -755,7 +755,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
Element element = this.getElement();
// Adds armour.
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
for(EntityEquipmentSlot slot : InventoryUtils.ARMOUR_SLOTS){
this.setItemStackToSlot(slot, new ItemStack(WizardryItems.getArmour(element, slot)));
}
@@ -888,7 +888,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp
// Makes wizards angry if a player breaks a block in their tower
if(!(event.getPlayer() instanceof FakePlayer)){
List<EntityWizard> wizards = WizardryUtilities.getEntitiesWithinRadius(64, event.getPos().getX(),
List<EntityWizard> wizards = EntityUtils.getEntitiesWithinRadius(64, event.getPos().getX(),
event.getPos().getY(), event.getPos().getZ(), event.getWorld(), EntityWizard.class);
if(!wizards.isEmpty()){
@@ -2,8 +2,8 @@ package electroblob.wizardry.entity.living;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.EntityUtils;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.world.EnumDifficulty;
import javax.annotation.Nonnull;
@@ -91,6 +91,6 @@ public interface ISpellCaster {
* skeletons, which are: Easy - 10, Normal - 6, Hard - 2, Peaceful - 10 (rarely used).
*/
default int getAimingError(EnumDifficulty difficulty) {
return WizardryUtilities.getDefaultAimingError(difficulty);
return EntityUtils.getDefaultAimingError(difficulty);
}
}
@@ -118,7 +118,7 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData, IEntityOw
if(this instanceof Entity){ // Bit of a cheat but it saves having yet another method just to get the world
Entity entity = WizardryUtilities.getEntityByUUID(((Entity)this).world, getOwnerId());
Entity entity = EntityUtils.getEntityByUUID(((Entity)this).world, getOwnerId());
if(entity != null && !(entity instanceof EntityLivingBase)){ // Should never happen
Wizardry.logger.warn("{} has a non-living owner!", this);
@@ -395,7 +395,7 @@ public interface ISummonedCreature extends IEntityAdditionalSpawnData, IEntityOw
// no summoner.
if(DamageSafetyChecker.attackEntitySafely(event.getEntity(), newSource, event.getAmount(), event.getSource(), false)){
// Uses event.getSource().getTrueSource() as this means the target is knocked back from the minion
WizardryUtilities.applyStandardKnockback(event.getSource().getTrueSource(), event.getEntityLiving());
EntityUtils.applyStandardKnockback(event.getSource().getTrueSource(), event.getEntityLiving());
((ISummonedCreature)event.getSource().getTrueSource()).onSuccessfulAttack(event.getEntityLiving());
// If the target revenge-targeted the summoner, make it revenge-target the minion instead
// (if it didn't revenge-target, do nothing)
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
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.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumParticleTypes;
@@ -69,7 +69,7 @@ public class EntityFirebomb extends EntityBomb {
double range = Spells.firebomb.getProperty(Spell.BLAST_RADIUS).floatValue() * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(range, this.posX, this.posY,
this.posZ, this.world);
for(EntityLivingBase target : targets){
@@ -7,10 +7,10 @@ import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.InventoryUtils;
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.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -65,7 +65,7 @@ public class EntityForceArrow extends EntityMagicArrow {
if(!player.capabilities.isCreativeMode && ItemArtefact.isArtefactActive(player, WizardryItems.ring_mana_return)){
for(ItemStack stack : WizardryUtilities.getPrioritisedHotbarAndOffhand(player)){
for(ItemStack stack : InventoryUtils.getPrioritisedHotbarAndOffhand(player)){
if(stack.getItem() instanceof ISpellCastingItem && stack.getItem() instanceof IManaStoringItem
&& Arrays.asList(((ISpellCastingItem)stack.getItem()).getSpells(stack)).contains(Spells.force_arrow)){
((IManaStoringItem)stack.getItem()).rechargeMana(stack, mana);
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
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.EnumParticleTypes;
import net.minecraft.util.math.RayTraceResult;
@@ -53,7 +53,7 @@ public class EntityForceOrb extends EntityBomb {
double blastRadius = Spells.force_orb.getProperty(Spell.BLAST_RADIUS).floatValue() * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(blastRadius, this.posX,
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(blastRadius, this.posX,
this.posY, this.posZ, this.world);
for(EntityLivingBase target : targets){
@@ -4,11 +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.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 net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
@@ -74,7 +72,7 @@ public class EntityIceCharge extends EntityBomb {
double radius = Spells.ice_charge.getProperty(Spell.EFFECT_RADIUS).floatValue() * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(radius, this.posX, this.posY,
this.posZ, this.world);
// Slows targets
@@ -93,8 +91,8 @@ public class EntityIceCharge extends EntityBomb {
BlockPos pos = new BlockPos(this.posX + i, this.posY, this.posZ + j);
Integer y = WizardryUtilities.getNearestSurface(world, pos, EnumFacing.UP, 7, true,
WizardryUtilities.SurfaceCriteria.SOLID_LIQUID_TO_AIR);
Integer y = BlockUtils.getNearestSurface(world, pos, EnumFacing.UP, 7, true,
BlockUtils.SurfaceCriteria.SOLID_LIQUID_TO_AIR);
if(y != null){
@@ -4,10 +4,8 @@ import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
@@ -47,12 +45,12 @@ public class EntityIceball extends EntityMagicProjectile {
}else{
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
if(this.getThrower() == null || EntityUtils.canDamageBlocks(this.getThrower(), world)){
BlockPos pos = rayTrace.getBlockPos();
if(rayTrace.sideHit == EnumFacing.UP && !world.isRemote && world.isSideSolid(pos, EnumFacing.UP)
&& WizardryUtilities.canBlockBeReplaced(world, pos.up())){
&& BlockUtils.canBlockBeReplaced(world, pos.up())){
world.setBlockState(pos.up(), Blocks.SNOW_LAYER.getDefaultState());
}
}
@@ -3,7 +3,7 @@ package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.WizardryUtilities;
import electroblob.wizardry.util.EntityUtils;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.projectile.EntityLargeFireball;
import net.minecraft.nbt.NBTTagCompound;
@@ -51,7 +51,7 @@ public class EntityLargeMagicFireball extends EntityMagicFireball {
protected void onImpact(RayTraceResult rayTrace){
if(!world.isRemote){
boolean flag = this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world);
boolean flag = this.getThrower() == null || EntityUtils.canDamageBlocks(this.getThrower(), world);
this.world.newExplosion(null, this.posX, this.posY, this.posZ, getExplosionPower() * blastMultiplier, flag, flag);
}
@@ -3,11 +3,8 @@ package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.AllyDesignationSystem;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.*;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.RayTracer;
import electroblob.wizardry.util.WizardryUtilities;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -237,7 +234,7 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE
}
if(this.getCaster() == null && this.casterUUID != null){
Entity entity = WizardryUtilities.getEntityByUUID(world, casterUUID);
Entity entity = EntityUtils.getEntityByUUID(world, casterUUID);
if(entity instanceof EntityLivingBase){
this.caster = new WeakReference<>((EntityLivingBase)entity);
}
@@ -3,10 +3,10 @@ package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.Spells;
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.WizardryUtilities;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -84,7 +84,7 @@ public class EntityMagicFireball extends EntityMagicProjectile {
}else{
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
if(this.getThrower() == null || EntityUtils.canDamageBlocks(this.getThrower(), world)){
BlockPos blockpos = rayTrace.getBlockPos().offset(rayTrace.sideHit);
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
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.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
@@ -74,7 +74,7 @@ public class EntityPoisonBomb extends EntityBomb {
double range = Spells.poison_bomb.getProperty(Spell.EFFECT_RADIUS).floatValue() * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(range, this.posX, this.posY,
this.posZ, this.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.EntityUtils;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.ParticleBuilder.Type;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
@@ -57,7 +57,7 @@ public class EntitySmokeBomb extends EntityBomb {
double range = Spells.smoke_bomb.getProperty(Spell.BLAST_RADIUS).floatValue() * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(range, this.posX, this.posY,
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(range, this.posX, this.posY,
this.posZ, this.world);
int duration = Spells.smoke_bomb.getProperty(Spell.EFFECT_DURATION).intValue();
@@ -3,11 +3,11 @@ package electroblob.wizardry.entity.projectile;
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.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -55,7 +55,7 @@ public class EntitySparkBomb extends EntityBomb {
double seekerRange = Spells.spark_bomb.getProperty(Spell.EFFECT_RADIUS).doubleValue() * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, this.posY,
List<EntityLivingBase> targets = EntityUtils.getEntitiesWithinRadius(seekerRange, this.posX, this.posY,
this.posZ, this.world);
for(int i = 0; i < Math.min(targets.size(), Spells.spark_bomb.getProperty(SECONDARY_MAX_TARGETS).intValue()); i++){