diff options
Diffstat (limited to 'src/main/java/com/sosnitzka/taiga/util')
3 files changed, 2 insertions, 105 deletions
diff --git a/src/main/java/com/sosnitzka/taiga/util/EntityAIPermanentPanic.java b/src/main/java/com/sosnitzka/taiga/util/EntityAIPermanentPanic.java deleted file mode 100644 index 85f01e1..0000000 --- a/src/main/java/com/sosnitzka/taiga/util/EntityAIPermanentPanic.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.sosnitzka.taiga.util; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.ai.EntityAIBase; -import net.minecraft.entity.ai.RandomPositionGenerator; -import net.minecraft.init.Blocks; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - -public class EntityAIPermanentPanic extends EntityAIBase { - private EntityCreature theEntityCreature; - private double speed; - private double randPosX; - private double randPosY; - private double randPosZ; - - public EntityAIPermanentPanic(EntityCreature creature, double speedIn) { - this.theEntityCreature = creature; - this.speed = speedIn; - } - - /** - * Returns whether the EntityAIBase should begin execution. - */ - public boolean shouldExecute() { - - Vec3d vec3d = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4); - - if (vec3d == null) { - return false; - } else { - this.randPosX = vec3d.x; - this.randPosY = vec3d.y; - this.randPosZ = vec3d.z; - - if (this.theEntityCreature.isBurning()) { - BlockPos blockpos = this.getRandPos(this.theEntityCreature.world, this.theEntityCreature, 5, 4); - - if (blockpos != null) { - this.randPosX = (double) blockpos.getX(); - this.randPosY = (double) blockpos.getY(); - this.randPosZ = (double) blockpos.getZ(); - } - } - - return true; - } - - } - - /** - * Execute a one shot task or start executing a continuous task - */ - public void startExecuting() { - this.theEntityCreature.getNavigator().tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, this.speed); - } - - /** - * Returns whether an in-progress EntityAIBase should continue executing - */ - public boolean continueExecuting() { - return !this.theEntityCreature.getNavigator().noPath(); - } - - private BlockPos getRandPos(World worldIn, Entity entityIn, int horizontalRange, int verticalRange) { - BlockPos blockpos = new BlockPos(entityIn); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - int i = blockpos.getX(); - int j = blockpos.getY(); - int k = blockpos.getZ(); - float f = (float) (horizontalRange * horizontalRange * verticalRange * 2); - BlockPos blockpos1 = null; - - for (int l = i - horizontalRange; l <= i + horizontalRange; ++l) { - for (int i1 = j - verticalRange; i1 <= j + verticalRange; ++i1) { - for (int j1 = k - horizontalRange; j1 <= k + horizontalRange; ++j1) { - blockpos$mutableblockpos.setPos(l, i1, j1); - IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos); - Block block = iblockstate.getBlock(); - - if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) { - float f1 = (float) ((l - i) * (l - i) + (i1 - j) * (i1 - j) + (j1 - k) * (j1 - k)); - - if (f1 < f) { - f = f1; - blockpos1 = new BlockPos(blockpos$mutableblockpos); - } - } - } - } - } - - return blockpos1; - } -}
\ No newline at end of file diff --git a/src/main/java/com/sosnitzka/taiga/util/Generator.java b/src/main/java/com/sosnitzka/taiga/util/Generator.java index 7cd351a..31f378d 100644 --- a/src/main/java/com/sosnitzka/taiga/util/Generator.java +++ b/src/main/java/com/sosnitzka/taiga/util/Generator.java @@ -54,7 +54,6 @@ public class Generator { .generate(world, random, new BlockPos(posX, posY, posZ)); } } - } } @@ -64,7 +63,6 @@ public class Generator { generateOreDescending(replaceBlockList, replacementBlock, random, chunkX, chunkZ, world, count, minY, maxY); } - public static void generateOreDescending(List<IBlockState> replaceBlockList, IBlockState replacementBlock, Random random, int chunkX, int chunkZ, World world, int count, int minY, int maxY) { for (int i = 0; i < count; i++) { @@ -195,7 +193,6 @@ public class Generator { } } - public static int generateMeteor(IBlockState centerBlock, IBlockState hullBlock, Random random, int chunkX, int chunkZ, World world, int count, int chance, int minY, int maxY) { Set<Item> validSurface = new HashSet<Item>(); diff --git a/src/main/java/com/sosnitzka/taiga/util/StateMatcher.java b/src/main/java/com/sosnitzka/taiga/util/StateMatcher.java index 87a4949..5c6da46 100644 --- a/src/main/java/com/sosnitzka/taiga/util/StateMatcher.java +++ b/src/main/java/com/sosnitzka/taiga/util/StateMatcher.java @@ -26,10 +26,9 @@ public class StateMatcher implements Predicate<IBlockState> { if (state != null) { if (property != null && value != null) { if (state.getBlock() == this.state.getBlock()) - if (checkLayerForBlocks(3, 3, -1, world, pos) || + return checkLayerForBlocks(3, 3, -1, world, pos) || checkLayerForBlocks(3, 3, 0, world, pos) || - checkLayerForBlocks(3, 3, 1, world, pos)) - return true; + checkLayerForBlocks(3, 3, 1, world, pos); } else return state.getBlock() == this.state.getBlock(); |
