use of net.minecraft.entity.passive.EntitySquid in project FoodCraft-Reloaded by LasmGratel.
the class ItemShp method onItemUseFinish.
@Nonnull
public ItemStack onItemUseFinish(ItemStack stack, @Nullable World worldIn, EntityLivingBase entityLiving) {
EntitySquid squid = new EntitySquid(worldIn);
squid.setPosition(entityLiving.posX, entityLiving.posY, entityLiving.posZ);
worldIn.spawnEntity(squid);
return super.onItemUseFinish(stack, worldIn, entityLiving);
}
use of net.minecraft.entity.passive.EntitySquid in project PneumaticCraft by MineMaarten.
the class BlockSquidPlant method executeFullGrownEffect.
@Override
public void executeFullGrownEffect(World world, int x, int y, int z, Random rand) {
if (world.getBlockMetadata(x, y, z) == 14) {
int nearbyEntityCount = world.getEntitiesWithinAABB(EntitySquid.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(SPAWN_RANGE * 2, 4.0D, SPAWN_RANGE * 2)).size();
if (nearbyEntityCount < MAX_NEARBY_ENTITIES) {
EntitySquid squid = new EntitySquid(world);
double randXmotion = rand.nextDouble() - 0.5D;
// rand.nextDouble();
double randYmotion = 1D;
double randZmotion = rand.nextDouble() - 0.5D;
squid.setLocationAndAngles(x + 0.5D, y + 0.5D, z + 0.5D, rand.nextFloat() * 360.0F, 0.0F);
squid.motionX = randXmotion;
squid.motionY = randYmotion;
squid.motionZ = randZmotion;
world.spawnEntityInWorld(squid);
squid.spawnExplosionParticle();
squid.playSound("mob.newsound.chickenplop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
world.setBlockMetadataWithNotify(x, y, z, 11, 3);
}
} else {
world.setBlockMetadataWithNotify(x, y, z, 14, 2);
world.scheduleBlockUpdate(x, y, z, this, 60);
}
}
use of net.minecraft.entity.passive.EntitySquid in project takumicraft by TNTModders.
the class TakumiEvents method checkSpawn.
@SubscribeEvent
public void checkSpawn(LivingSpawnEvent.CheckSpawn e) {
if (e.getWorld().provider.getDimensionType() == TakumiWorldCore.TAKUMI_WORLD) {
if (!(e.getEntityLiving() instanceof ITakumiEntity)) {
e.setResult(Result.DENY);
}
}
if (e.getEntityLiving().getClass() == EntityCreeper.class) {
((EntityLiving) e.getEntityLiving()).tasks.addTask(0, new EntityAIFollowCatCreeper((EntityCreeper) e.getEntityLiving()));
}
if (!e.getWorld().isRemote) {
if (e.getEntityLiving().getRNG().nextInt(5) == 0 && e.getEntityLiving() instanceof EntitySlime) {
EntitySlimeCreeper slimeCreeper = new EntitySlimeCreeper(e.getWorld());
slimeCreeper.copyLocationAndAnglesFrom(e.getEntityLiving());
slimeCreeper.setSlimeSize(e.getEntityLiving().getRNG().nextBoolean() ? 1 : e.getEntityLiving().getRNG().nextBoolean() ? 2 : 4, false);
if (slimeCreeper.getCanSpawnHere()) {
e.getWorld().spawnEntity(slimeCreeper);
e.setResult(Result.DENY);
}
}
if (e.getEntityLiving().getRNG().nextInt(10) == 0 && e.getEntityLiving() instanceof EntityFishCreeper) {
EntityBigFishCreeper bigFishCreeper = new EntityBigFishCreeper(e.getWorld());
bigFishCreeper.copyLocationAndAnglesFrom(e.getEntityLiving());
if (bigFishCreeper.getCanSpawnHere()) {
e.getWorld().spawnEntity(bigFishCreeper);
e.setResult(Result.DENY);
}
} else if (e.getEntityLiving().getRNG().nextInt(10) == 0 && e.getEntityLiving() instanceof EntitySquid) {
EntitySquidCreeper squidCreeper = new EntitySquidCreeper(e.getWorld());
squidCreeper.copyLocationAndAnglesFrom(e.getEntityLiving());
if (squidCreeper.getCanSpawnHere()) {
e.getWorld().spawnEntity(squidCreeper);
e.setResult(Result.DENY);
}
} else if ((e.getEntityLiving().getClass() == EntityZombieCreeper.class || e.getEntityLiving().getClass() == EntityZombieVillagerCreeper.class) && (e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.DESERT || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.DESERT_HILLS || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.MUTATED_DESERT)) {
EntityHuskCreeper huskCreeper = new EntityHuskCreeper(e.getWorld());
huskCreeper.copyLocationAndAnglesFrom(e.getEntityLiving());
if (huskCreeper.getCanSpawnHere()) {
e.getWorld().spawnEntity(huskCreeper);
e.setResult(Result.DENY);
}
} else if (e.getEntityLiving().getClass() == EntitySkeletonCreeper.class && (e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.ICE_MOUNTAINS || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.ICE_PLAINS || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.COLD_BEACH || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.COLD_TAIGA || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.COLD_TAIGA_HILLS || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.FROZEN_OCEAN || e.getWorld().getBiome(e.getEntityLiving().getPosition()) == Biomes.FROZEN_RIVER)) {
EntityStrayCreeper strayCreeper = new EntityStrayCreeper(e.getWorld());
strayCreeper.copyLocationAndAnglesFrom(e.getEntityLiving());
if (strayCreeper.getCanSpawnHere()) {
e.getWorld().spawnEntity(strayCreeper);
e.setResult(Result.DENY);
}
} else if (e.getEntityLiving().getRNG().nextInt(5) == 0 && e.getEntityLiving() instanceof EntityBat) {
EntityBatCreeper batCreeper = new EntityBatCreeper(e.getWorld());
batCreeper.copyLocationAndAnglesFrom(e.getEntityLiving());
if (batCreeper.getCanSpawnHere()) {
e.getWorld().spawnEntity(batCreeper);
e.setResult(Result.DENY);
}
}
}
}
Aggregations