mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
make the flower generator stop generating if there's enough aura in the arae
This commit is contained in:
parent
cacd51bd4c
commit
fdc6cd38c6
1 changed files with 7 additions and 4 deletions
|
@ -58,11 +58,14 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
||||||
IBlockState state = this.world.getBlockState(pos);
|
IBlockState state = this.world.getBlockState(pos);
|
||||||
MutableInt curr = this.consumedRecently.computeIfAbsent(state, s -> new MutableInt());
|
MutableInt curr = this.consumedRecently.computeIfAbsent(state, s -> new MutableInt());
|
||||||
|
|
||||||
int toAdd = Math.max(0, 50 - curr.getValue());
|
int addAmount = 100;
|
||||||
|
int toAdd = Math.max(0, addAmount - curr.getValue());
|
||||||
if (toAdd > 0) {
|
if (toAdd > 0) {
|
||||||
BlockPos auraPos = AuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
|
BlockPos auraPos = AuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
|
||||||
AuraChunk auraChunk = AuraChunk.getAuraChunk(this.world, auraPos);
|
if (AuraChunk.getAuraInArea(this.world, auraPos, 30) < 20000)
|
||||||
auraChunk.storeAura(auraPos, toAdd);
|
AuraChunk.getAuraChunk(this.world, auraPos).storeAura(auraPos, toAdd);
|
||||||
|
else
|
||||||
|
toAdd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<IBlockState, MutableInt> entry : this.consumedRecently.entrySet()) {
|
for (Map.Entry<IBlockState, MutableInt> entry : this.consumedRecently.entrySet()) {
|
||||||
|
@ -76,7 +79,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
||||||
|
|
||||||
this.world.setBlockToAir(pos);
|
this.world.setBlockToAir(pos);
|
||||||
|
|
||||||
int color = Helper.blendColors(0x5ccc30, 0xe53c16, toAdd / 50F);
|
int color = Helper.blendColors(0x5ccc30, 0xe53c16, toAdd / (float) addAmount);
|
||||||
if (toAdd > 0) {
|
if (toAdd > 0) {
|
||||||
for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--)
|
for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
||||||
|
|
Loading…
Reference in a new issue