Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
src/main/java/WayofTime/bloodmagic/tile
|
@ -1,7 +1,8 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.api.iface.IPurificationAsh;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.util.helper.PurificationHelper;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -10,63 +11,51 @@ import net.minecraft.util.ITickable;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import WayofTime.bloodmagic.api.iface.IPurificationAsh;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.util.helper.PurificationHelper;
|
||||
|
||||
public class TilePurificationAltar extends TileInventory implements ITickable
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public class TilePurificationAltar extends TileInventory implements ITickable {
|
||||
public AreaDescriptor purityArea = new AreaDescriptor.Rectangle(new BlockPos(-5, -5, -5), 11);
|
||||
|
||||
public double totalPurity = 0;
|
||||
public double maxPurity = 0;
|
||||
public double purityRate = 0;
|
||||
|
||||
public TilePurificationAltar()
|
||||
{
|
||||
public TilePurificationAltar() {
|
||||
super(1, "purificationAltar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (totalPurity <= 0)
|
||||
{
|
||||
public void update() {
|
||||
if (totalPurity <= 0) {
|
||||
ItemStack stack = this.getStackInSlot(0);
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof IPurificationAsh)
|
||||
{
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof IPurificationAsh) {
|
||||
totalPurity = ((IPurificationAsh) stack.getItem()).getTotalPurity(stack);
|
||||
maxPurity = ((IPurificationAsh) stack.getItem()).getMaxPurity(stack);
|
||||
purityRate = ((IPurificationAsh) stack.getItem()).getPurityRate(stack);
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
AxisAlignedBB aabb = purityArea.getAABB(getPos());
|
||||
List<EntityAnimal> animalList = getWorld().getEntitiesWithinAABB(EntityAnimal.class, aabb);
|
||||
if (animalList.isEmpty())
|
||||
{
|
||||
if (animalList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasPerformed = false;
|
||||
|
||||
for (EntityAnimal animal : animalList)
|
||||
{
|
||||
for (EntityAnimal animal : animalList) {
|
||||
double added = PurificationHelper.addPurity(animal, Math.min(purityRate, totalPurity), maxPurity);
|
||||
if (added > 0)
|
||||
{
|
||||
if (added > 0) {
|
||||
totalPurity -= purityRate;
|
||||
hasPerformed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPerformed)
|
||||
{
|
||||
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof WorldServer)
|
||||
{
|
||||
if (hasPerformed) {
|
||||
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof WorldServer) {
|
||||
WorldServer server = (WorldServer) getWorld();
|
||||
server.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 1, 0.02, 0.03, 0.02, 0, new int[0]);
|
||||
}
|
||||
|
@ -74,8 +63,7 @@ public class TilePurificationAltar extends TileInventory implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tag)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tag) {
|
||||
super.deserialize(tag);
|
||||
totalPurity = tag.getDouble("totalPurity");
|
||||
maxPurity = tag.getDouble("maxPurity");
|
||||
|
@ -83,8 +71,7 @@ public class TilePurificationAltar extends TileInventory implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tag) {
|
||||
super.serialize(tag);
|
||||
|
||||
tag.setDouble("totalPurity", totalPurity);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue