[Change] Suggested Changes

This commit is contained in:
cdagaming 2019-04-20 12:11:46 -05:00
parent c4c85b4f49
commit 13469053b9
2 changed files with 1 additions and 9 deletions

View File

@ -151,7 +151,7 @@ public final class Settings {
* Blocks that Baritone will attempt to avoid (Used in avoidance) * Blocks that Baritone will attempt to avoid (Used in avoidance)
*/ */
public final Setting<List<Block>> blocksToAvoid = new Setting<>(new ArrayList<>(Arrays.asList( public final Setting<List<Block>> blocksToAvoid = new Setting<>(new ArrayList<>(Arrays.asList(
Blocks.VINE // Leave Empty by Default
))); )));
/** /**

View File

@ -19,10 +19,8 @@ package baritone.utils.pathing;
import baritone.Baritone; import baritone.Baritone;
import baritone.api.utils.BetterBlockPos; import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.BlockUtils;
import baritone.api.utils.IPlayerContext; import baritone.api.utils.IPlayerContext;
import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap;
import net.minecraft.block.Block;
import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntityMob;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -65,18 +63,12 @@ public class Avoidance {
List<Avoidance> res = new ArrayList<>(); List<Avoidance> res = new ArrayList<>();
double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.value; double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.value;
double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.value; double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.value;
double blockCoeff = Baritone.settings().blockAvoidanceCoefficient.value;
if (mobSpawnerCoeff != 1.0D) { if (mobSpawnerCoeff != 1.0D) {
ctx.worldData().getCachedWorld().getLocationsOf("mob_spawner", 1, ctx.playerFeet().x, ctx.playerFeet().z, 2).forEach(mobspawner -> res.add(new Avoidance(mobspawner, mobSpawnerCoeff, Baritone.settings().mobSpawnerAvoidanceRadius.value))); ctx.worldData().getCachedWorld().getLocationsOf("mob_spawner", 1, ctx.playerFeet().x, ctx.playerFeet().z, 2).forEach(mobspawner -> res.add(new Avoidance(mobspawner, mobSpawnerCoeff, Baritone.settings().mobSpawnerAvoidanceRadius.value)));
} }
if (mobCoeff != 1.0D) { if (mobCoeff != 1.0D) {
ctx.world().loadedEntityList.stream().filter(entity -> entity instanceof EntityMob).forEach(entity -> res.add(new Avoidance(new BlockPos(entity), mobCoeff, Baritone.settings().mobAvoidanceRadius.value))); ctx.world().loadedEntityList.stream().filter(entity -> entity instanceof EntityMob).forEach(entity -> res.add(new Avoidance(new BlockPos(entity), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
} }
if (blockCoeff != 1.0D) {
for (Block block : Baritone.settings().blocksToAvoid.value) {
ctx.worldData().getCachedWorld().getLocationsOf(BlockUtils.blockToString(block), 1, ctx.playerFeet().x, ctx.playerFeet().z, 2).forEach(blockPos -> res.add(new Avoidance(blockPos, blockCoeff, Baritone.settings().blockAvoidanceRadius.value)));
}
}
return res; return res;
} }