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.PotionType;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -41,32 +40,20 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
|
|||
continue;
|
||||
}
|
||||
|
||||
int toAdd = ((effect.getAmplifier() * 6 + 1) * (effect.getDuration() / 30)) / 4;
|
||||
int toAddTimes = 4;
|
||||
while (toAddTimes > 0) {
|
||||
boolean foundEmpty = false;
|
||||
for (EnumFacing dir : EnumFacing.HORIZONTALS) {
|
||||
BlockPos offset = this.pos.offset(dir, 12);
|
||||
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)
|
||||
break;
|
||||
boolean disperseParticles;
|
||||
if (IAuraChunk.getAuraInArea(this.world, this.pos, 35) < 20000) {
|
||||
int toAdd = ((effect.getAmplifier() * 6 + 1) * (effect.getDuration() / 30));
|
||||
while (toAdd > 0) {
|
||||
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
|
||||
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
|
||||
}
|
||||
disperseParticles = true;
|
||||
} else
|
||||
disperseParticles = false;
|
||||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
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;
|
||||
break;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class SpreadEffect implements IDrainSpotEffect {
|
|||
int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE;
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
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);
|
||||
if (drain ? amount < bestAmount : amount > bestAmount) {
|
||||
bestAmount = amount;
|
||||
|
|
Loading…
Reference in a new issue