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
@@ -1,7 +1,7 @@
package electroblob.wizardry.tileentity;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.WizardryUtilities;
import electroblob.wizardry.util.EntityUtils;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
@@ -52,7 +52,7 @@ public class TileEntityPlayerSave extends TileEntity {
@Nullable
public EntityLivingBase getCaster(){
Entity entity = WizardryUtilities.getEntityByUUID(world, casterUUID);
Entity entity = EntityUtils.getEntityByUUID(world, casterUUID);
if(entity != null && !(entity instanceof EntityLivingBase)){ // Should never happen
Wizardry.logger.warn("{} has a non-living owner!", this);
@@ -11,10 +11,8 @@ import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.spell.ArcaneLock;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.*;
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;
@@ -54,7 +52,7 @@ public class TileEntityShrineCore extends TileEntity implements ITickable {
private void initContainmentField(BlockPos pos){
float r = PotionContainment.getContainmentDistance(0);
this.containmentField = new AxisAlignedBB(-r, -r, -r, r, r, r).offset(WizardryUtilities.getCentre(pos));
this.containmentField = new AxisAlignedBB(-r, -r, -r, r, r, r).offset(GeometryUtils.getCentre(pos));
}
public void linkContainer(TileEntity container){
@@ -94,7 +92,7 @@ public class TileEntityShrineCore extends TileEntity implements ITickable {
float angle = world.rand.nextFloat() * 2 * (float)Math.PI;
double x1 = this.pos.getX() + 0.5 + 5 * MathHelper.sin(angle);
double z1 = this.pos.getZ() + 0.5 + 5 * MathHelper.cos(angle);
Integer y1 = WizardryUtilities.getNearestFloor(world, new BlockPos(x1, this.pos.getY(), z1), 8);
Integer y1 = BlockUtils.getNearestFloor(world, new BlockPos(x1, this.pos.getY(), z1), 8);
if(y1 == null){
// Fallback to the position of the shrine core if it failed to find a position (unlikely)
x1 = this.pos.getX() + 1; // Offset it so the wizard isn't inside the block
@@ -128,7 +126,7 @@ public class TileEntityShrineCore extends TileEntity implements ITickable {
private boolean areWizardsDead(){
for(UUID uuid : linkedWizards){
Entity entity = WizardryUtilities.getEntityByUUID(world, uuid);
Entity entity = EntityUtils.getEntityByUUID(world, uuid);
if(entity instanceof EntityEvilWizard && entity.isEntityAlive()) return false;
}
@@ -1,7 +1,7 @@
package electroblob.wizardry.tileentity;
import electroblob.wizardry.util.BlockUtils;
import electroblob.wizardry.util.NBTExtras;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
@@ -108,7 +108,7 @@ public class TileEntityStatue extends TileEntity implements ITickable {
// Breaks the block at light levels of 7 or below, with a higher chance the lower the light level.
// The chance is (8 - light level)/12, so at light 0 the chance is 3/4 and at light 7 the chance is 1/12.
if(!this.world.isRemote && this.timer % 200 == 0 && this.timer > lifetime && !this.isIce && this.position == 1){
if(WizardryUtilities.getLightLevel(world, pos) < this.world.rand.nextInt(12) - 3){
if(BlockUtils.getLightLevel(world, pos) < this.world.rand.nextInt(12) - 3){
// This is all that is needed because destroyBlock invokes the breakBlock function in
// BlockPetrifiedStone
// and that function handles all the spawning and stuff.