mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
fixed the spread effect loading chunks and make the potion generator not do the custom spread anymore
This commit is contained in:
parent
a9b39cf3da
commit
75ae345a75
2 changed files with 11 additions and 24 deletions
|
@ -9,7 +9,6 @@ import net.minecraft.potion.Potion;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.potion.PotionType;
|
import net.minecraft.potion.PotionType;
|
||||||
import net.minecraft.potion.PotionUtils;
|
import net.minecraft.potion.PotionUtils;
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -41,32 +40,20 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int toAdd = ((effect.getAmplifier() * 6 + 1) * (effect.getDuration() / 30)) / 4;
|
boolean disperseParticles;
|
||||||
int toAddTimes = 4;
|
if (IAuraChunk.getAuraInArea(this.world, this.pos, 35) < 20000) {
|
||||||
while (toAddTimes > 0) {
|
int toAdd = ((effect.getAmplifier() * 6 + 1) * (effect.getDuration() / 30));
|
||||||
boolean foundEmpty = false;
|
while (toAdd > 0) {
|
||||||
for (EnumFacing dir : EnumFacing.HORIZONTALS) {
|
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
|
||||||
BlockPos offset = this.pos.offset(dir, 12);
|
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).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--;
|
|
||||||
if (toAddTimes <= 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!foundEmpty)
|
disperseParticles = true;
|
||||||
break;
|
} else
|
||||||
}
|
disperseParticles = false;
|
||||||
|
|
||||||
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(), 5,
|
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 5,
|
||||||
PotionUtils.getPotionColor(type), toAddTimes < 4 ? 1 : 0));
|
PotionUtils.getPotionColor(type), disperseParticles ? 1 : 0));
|
||||||
|
|
||||||
addedOne = true;
|
addedOne = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class SpreadEffect implements IDrainSpotEffect {
|
||||||
int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE;
|
int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE;
|
||||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||||
BlockPos offset = pos.offset(facing, 15);
|
BlockPos offset = pos.offset(facing, 15);
|
||||||
if (offset.getY() >= 0 && offset.getY() <= world.getHeight()) {
|
if (world.isBlockLoaded(offset) && offset.getY() >= 0 && offset.getY() <= world.getHeight()) {
|
||||||
int amount = IAuraChunk.getAuraInArea(world, offset, 14);
|
int amount = IAuraChunk.getAuraInArea(world, offset, 14);
|
||||||
if (drain ? amount < bestAmount : amount > bestAmount) {
|
if (drain ? amount < bestAmount : amount > bestAmount) {
|
||||||
bestAmount = amount;
|
bestAmount = amount;
|
||||||
|
|
Loading…
Reference in a new issue