mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58: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.PacketParticleStream;
|
||||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockFlower;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -52,10 +51,13 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
||||||
int addAmount = 200;
|
int addAmount = 200;
|
||||||
int toAdd = Math.max(0, addAmount - curr.getValue());
|
int toAdd = Math.max(0, addAmount - curr.getValue());
|
||||||
if (toAdd > 0) {
|
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, this.pos, 35) < 20000) {
|
||||||
if (NaturesAuraAPI.TYPE_OVERWORLD.isPresentInWorld(this.world) && IAuraChunk.getAuraInArea(this.world, auraPos, 30) < 20000)
|
int remain = toAdd;
|
||||||
IAuraChunk.getAuraChunk(this.world, auraPos).storeAura(auraPos, toAdd);
|
while (remain > 0) {
|
||||||
else
|
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
|
||||||
|
remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, remain);
|
||||||
|
}
|
||||||
|
} else
|
||||||
toAdd = 0;
|
toAdd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,11 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickable
|
||||||
while (!this.scheduledBigTrees.isEmpty()) {
|
while (!this.scheduledBigTrees.isEmpty()) {
|
||||||
BlockPos pos = this.scheduledBigTrees.remove();
|
BlockPos pos = this.scheduledBigTrees.remove();
|
||||||
if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) {
|
if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) {
|
||||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 25, this.pos);
|
int toAdd = 500;
|
||||||
IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, 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(
|
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||||
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 12,
|
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 12,
|
||||||
|
|
|
@ -47,10 +47,12 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
|
||||||
boolean foundEmpty = false;
|
boolean foundEmpty = false;
|
||||||
for (EnumFacing dir : EnumFacing.HORIZONTALS) {
|
for (EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||||
BlockPos offset = this.pos.offset(dir, 12);
|
BlockPos offset = this.pos.offset(dir, 12);
|
||||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, offset, 15, offset);
|
if (IAuraChunk.getAuraInArea(this.world, offset, 15) < 20000) {
|
||||||
if (IAuraChunk.getAuraInArea(this.world, spot, 15) < 20000) {
|
int remain = toAdd;
|
||||||
IAuraChunk chunk = IAuraChunk.getAuraChunk(this.world, spot);
|
while (remain > 0) {
|
||||||
chunk.storeAura(spot, toAdd);
|
BlockPos spot = IAuraChunk.getLowestSpot(this.world, offset, 15, offset);
|
||||||
|
remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
|
||||||
|
}
|
||||||
|
|
||||||
foundEmpty = true;
|
foundEmpty = true;
|
||||||
toAddTimes--;
|
toAddTimes--;
|
||||||
|
|
|
@ -29,8 +29,8 @@ public class BalanceEffect implements IDrainSpotEffect {
|
||||||
return;
|
return;
|
||||||
IAuraChunk highestChunk = IAuraChunk.getAuraChunk(world, highestPos);
|
IAuraChunk highestChunk = IAuraChunk.getAuraChunk(world, highestPos);
|
||||||
int toTransfer = Math.min(25, highestChunk.getDrainSpot(highestPos).intValue());
|
int toTransfer = Math.min(25, highestChunk.getDrainSpot(highestPos).intValue());
|
||||||
highestChunk.drainAura(highestPos, toTransfer);
|
int stored = auraChunk.storeAura(pos, toTransfer);
|
||||||
auraChunk.storeAura(pos, toTransfer);
|
highestChunk.drainAura(highestPos, stored);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue