Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -9,35 +9,28 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class TileDemonPylon extends TileTicking implements IDemonWillConduit
|
||||
{
|
||||
public DemonWillHolder holder = new DemonWillHolder();
|
||||
public class TileDemonPylon extends TileTicking implements IDemonWillConduit {
|
||||
public final int maxWill = 100;
|
||||
public final double drainRate = 1;
|
||||
public DemonWillHolder holder = new DemonWillHolder();
|
||||
|
||||
public TileDemonPylon()
|
||||
{
|
||||
public TileDemonPylon() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
if (getWorld().isRemote)
|
||||
{
|
||||
public void onUpdate() {
|
||||
if (getWorld().isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values())
|
||||
{
|
||||
for (EnumDemonWillType type : EnumDemonWillType.values()) {
|
||||
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
|
||||
|
||||
for (EnumFacing side : EnumFacing.HORIZONTALS)
|
||||
{
|
||||
for (EnumFacing side : EnumFacing.HORIZONTALS) {
|
||||
BlockPos offsetPos = pos.offset(side, 16);
|
||||
double sideAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), offsetPos, type);
|
||||
if (sideAmount > currentAmount)
|
||||
{
|
||||
if (sideAmount > currentAmount) {
|
||||
double drainAmount = Math.min((sideAmount - currentAmount) / 2, drainRate);
|
||||
double drain = WorldDemonWillHandler.drainWill(getWorld(), offsetPos, type, drainAmount, true);
|
||||
WorldDemonWillHandler.fillWill(getWorld(), pos, type, drain, true);
|
||||
|
@ -47,14 +40,12 @@ public class TileDemonPylon extends TileTicking implements IDemonWillConduit
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tag)
|
||||
{
|
||||
public void deserialize(NBTTagCompound tag) {
|
||||
holder.readFromNBT(tag, "Will");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tag)
|
||||
{
|
||||
public NBTTagCompound serialize(NBTTagCompound tag) {
|
||||
holder.writeToNBT(tag, "Will");
|
||||
return tag;
|
||||
}
|
||||
|
@ -62,26 +53,21 @@ public class TileDemonPylon extends TileTicking implements IDemonWillConduit
|
|||
// IDemonWillConduit
|
||||
|
||||
@Override
|
||||
public int getWeight()
|
||||
{
|
||||
public int getWeight() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill) {
|
||||
if (amount <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!canFill(type))
|
||||
{
|
||||
if (!canFill(type)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!doFill)
|
||||
{
|
||||
if (!doFill) {
|
||||
return Math.min(maxWill - holder.getWill(type), amount);
|
||||
}
|
||||
|
||||
|
@ -89,17 +75,14 @@ public class TileDemonPylon extends TileTicking implements IDemonWillConduit
|
|||
}
|
||||
|
||||
@Override
|
||||
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain)
|
||||
{
|
||||
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain) {
|
||||
double drained = amount;
|
||||
double current = holder.getWill(type);
|
||||
if (current < drained)
|
||||
{
|
||||
if (current < drained) {
|
||||
drained = current;
|
||||
}
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
if (doDrain) {
|
||||
return holder.drainWill(type, amount);
|
||||
}
|
||||
|
||||
|
@ -107,20 +90,17 @@ public class TileDemonPylon extends TileTicking implements IDemonWillConduit
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumDemonWillType type)
|
||||
{
|
||||
public boolean canFill(EnumDemonWillType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumDemonWillType type)
|
||||
{
|
||||
public boolean canDrain(EnumDemonWillType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentWill(EnumDemonWillType type)
|
||||
{
|
||||
public double getCurrentWill(EnumDemonWillType type) {
|
||||
return holder.getWill(type);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue