Added wasp spawners, made wasp movement more random and frequent
This commit is contained in:
parent
25f5dd9b4e
commit
442fc76cd3
|
@ -19,8 +19,6 @@ public class EntityWasp extends EntityFlyingMob
|
|||
|
||||
/** Cooldown time between target loss and new target aquirement. */
|
||||
private int aggroCooldown;
|
||||
public int prevAttackCounter;
|
||||
public int attackCounter;
|
||||
|
||||
public EntityWasp(World world)
|
||||
{
|
||||
|
@ -44,7 +42,6 @@ public class EntityWasp extends EntityFlyingMob
|
|||
}
|
||||
|
||||
this.despawnEntity();
|
||||
this.prevAttackCounter = this.attackCounter;
|
||||
double d0 = this.waypointX - this.posX;
|
||||
double d1 = this.waypointY - this.posY;
|
||||
double d2 = this.waypointZ - this.posZ;
|
||||
|
@ -52,14 +49,14 @@ public class EntityWasp extends EntityFlyingMob
|
|||
|
||||
if (d3 < 1.0D || d3 > 3600.0D)
|
||||
{
|
||||
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 4.0F);
|
||||
this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 4.0F);
|
||||
this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 4.0F);
|
||||
}
|
||||
|
||||
if (this.courseChangeCooldown-- <= 0)
|
||||
{
|
||||
this.courseChangeCooldown += this.rand.nextInt(5) + 2;
|
||||
this.courseChangeCooldown += this.rand.nextInt(2) + 2;
|
||||
d3 = (double)MathHelper.sqrt_double(d3);
|
||||
|
||||
if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3))
|
||||
|
@ -109,22 +106,11 @@ public class EntityWasp extends EntityFlyingMob
|
|||
float f1 = this.targetedEntity.getDistanceToEntity(this);
|
||||
|
||||
this.attackEntity(this.targetedEntity, f1);
|
||||
|
||||
++this.attackCounter;
|
||||
}
|
||||
else if (this.attackCounter > 0)
|
||||
{
|
||||
--this.attackCounter;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI;
|
||||
|
||||
if (this.attackCounter > 0)
|
||||
{
|
||||
--this.attackCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package biomesoplenty.worldgen;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import biomesoplenty.api.Blocks;
|
||||
|
@ -67,6 +68,15 @@ public class WorldGenHive extends WorldGenerator
|
|||
|
||||
public void generateHiveCube(World world, int origx, int origy, int origz, int height, int width, int cubeno, float chance, int honeychance)
|
||||
{
|
||||
world.setBlock(origx, origy - (height / 2), origz, Block.mobSpawner.blockID);
|
||||
|
||||
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(origx, origy - (height / 2), origz);
|
||||
|
||||
if (tileentitymobspawner != null)
|
||||
{
|
||||
tileentitymobspawner.getSpawnerLogic().setMobID("BiomesOPlenty.Wasp");
|
||||
}
|
||||
|
||||
for (int hLayer = 0; hLayer < height; hLayer++)
|
||||
{
|
||||
for (int i = -width; i < width; i++)
|
||||
|
@ -76,9 +86,9 @@ public class WorldGenHive extends WorldGenerator
|
|||
if ((hLayer == 0 || hLayer == (height - 1)) && (world.rand.nextFloat() <= chance)) world.setBlock(origx + i, origy - hLayer, origz + j, Blocks.hive.get().blockID);
|
||||
else if ((i == -width || i == (width - 1) || j == -width || j == (width - 1)) && (world.rand.nextFloat() <= chance)) world.setBlock(origx + i, origy - hLayer, origz + j, Blocks.hive.get().blockID);
|
||||
|
||||
if (honeychance == 0)
|
||||
{
|
||||
if (hLayer > (height / 2))
|
||||
{
|
||||
if (honeychance == 0)
|
||||
{
|
||||
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlock(origx + i, origy - hLayer, origz + j, Fluids.honey.get().blockID);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue