mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-26 05:08:34 +01:00
fixed an issue with machines not properly creating positive aura spots
This commit is contained in:
parent
71a28a67bb
commit
91445f5f6d
4 changed files with 20 additions and 13 deletions
|
@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
|||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -52,10 +51,13 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
int addAmount = 200;
|
||||
int toAdd = Math.max(0, addAmount - curr.getValue());
|
||||
if (toAdd > 0) {
|
||||
BlockPos auraPos = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
|
||||
if (NaturesAuraAPI.TYPE_OVERWORLD.isPresentInWorld(this.world) && IAuraChunk.getAuraInArea(this.world, auraPos, 30) < 20000)
|
||||
IAuraChunk.getAuraChunk(this.world, auraPos).storeAura(auraPos, toAdd);
|
||||
else
|
||||
if (NaturesAuraAPI.TYPE_OVERWORLD.isPresentInWorld(this.world) && IAuraChunk.getAuraInArea(this.world, this.pos, 35) < 20000) {
|
||||
int remain = toAdd;
|
||||
while (remain > 0) {
|
||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
|
||||
remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, remain);
|
||||
}
|
||||
} else
|
||||
toAdd = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,11 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickable
|
|||
while (!this.scheduledBigTrees.isEmpty()) {
|
||||
BlockPos pos = this.scheduledBigTrees.remove();
|
||||
if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) {
|
||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 25, this.pos);
|
||||
IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, 500);
|
||||
int toAdd = 500;
|
||||
while (toAdd > 0) {
|
||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 25, this.pos);
|
||||
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
|
||||
}
|
||||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 12,
|
||||
|
|
|
@ -47,10 +47,12 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
|
|||
boolean foundEmpty = false;
|
||||
for (EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
BlockPos offset = this.pos.offset(dir, 12);
|
||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, offset, 15, offset);
|
||||
if (IAuraChunk.getAuraInArea(this.world, spot, 15) < 20000) {
|
||||
IAuraChunk chunk = IAuraChunk.getAuraChunk(this.world, spot);
|
||||
chunk.storeAura(spot, toAdd);
|
||||
if (IAuraChunk.getAuraInArea(this.world, offset, 15) < 20000) {
|
||||
int remain = toAdd;
|
||||
while (remain > 0) {
|
||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, offset, 15, offset);
|
||||
remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
|
||||
}
|
||||
|
||||
foundEmpty = true;
|
||||
toAddTimes--;
|
||||
|
|
|
@ -29,8 +29,8 @@ public class BalanceEffect implements IDrainSpotEffect {
|
|||
return;
|
||||
IAuraChunk highestChunk = IAuraChunk.getAuraChunk(world, highestPos);
|
||||
int toTransfer = Math.min(25, highestChunk.getDrainSpot(highestPos).intValue());
|
||||
highestChunk.drainAura(highestPos, toTransfer);
|
||||
auraChunk.storeAura(pos, toTransfer);
|
||||
int stored = auraChunk.storeAura(pos, toTransfer);
|
||||
highestChunk.drainAura(highestPos, stored);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue