Search in sources :

Example 1 with EntityAlienMiner

use of stevekung.mods.moreplanets.module.planets.diona.entity.EntityAlienMiner in project MorePlanets by SteveKunG.

the class TileEntityCrashedAlienProbeRenderer method render.

@Override
public void render(TileEntityCrashedAlienProbe tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    Random rand = new Random(tile.getPos().getX() + tile.getPos().getY() * tile.getPos().getZ());
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    GlStateManager.scale(-1.0F, -1.0F, 1.0F);
    if (tile.renderTicks > 0) {
        GlStateManager.rotate(180.0F + rand.nextInt(10), 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(-90.0F + rand.nextInt(10), 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(rand.nextInt(45), 0.0F, 0.0F, 1.0F);
        EntityAlienMiner miner = new EntityAlienMiner(Minecraft.getMinecraft().world);
        Minecraft.getMinecraft().getRenderManager().renderEntity(miner, 0.0F, -0.75F, 0.6F, 0.0F, partialTicks, false);
    }
    GlStateManager.popMatrix();
}
Also used : Random(java.util.Random) EntityAlienMiner(stevekung.mods.moreplanets.module.planets.diona.entity.EntityAlienMiner)

Example 2 with EntityAlienMiner

use of stevekung.mods.moreplanets.module.planets.diona.entity.EntityAlienMiner in project MorePlanets by SteveKunG.

the class WorldGenCrashedAlienProbe method generate.

@Override
public boolean generate(World world, Random rand, BlockPos pos) {
    for (pos = pos.add(-8, 0, -8); pos.getY() > 3 && world.isAirBlock(pos); pos = pos.down()) {
    }
    if (pos.getY() <= 2) {
        return false;
    }
    int radius = 1 + rand.nextInt(4);
    int radiusSq = radius * radius;
    for (int poolX = -radius - 1; poolX <= radius + 1; poolX++) {
        for (int poolY = -radius - 1; poolY <= 256 - pos.getY(); poolY++) {
            for (int poolZ = -radius - 1; poolZ <= radius + 1; poolZ++) {
                int distance = poolX * poolX + Math.min(0, poolY) * Math.min(0, poolY) + poolZ * poolZ;
                BlockPos posnew = new BlockPos(poolX + pos.getX(), poolY + pos.getY(), poolZ + pos.getZ());
                if (distance <= radiusSq) {
                    world.setBlockState(posnew, Blocks.AIR.getDefaultState(), 2);
                } else if (world.getBlockState(posnew).getBlock() == DionaBlocks.DIONA_BLOCK && poolY < 0 && rand.nextInt(4) == 0) {
                    world.setBlockState(posnew, DionaBlocks.GLOWING_IRON_BLOCK.getDefaultState(), 2);
                }
            }
        }
    }
    BlockPos blockpos = pos.add(0, -radius + 1, 0);
    if (rand.nextInt(5) == 0) {
        EntityAlienMiner miner = new EntityAlienMiner(world);
        miner.setLocationAndAngles(blockpos.getX() + 0.5D + rand.nextDouble(), blockpos.getY() + 0.5D, blockpos.getZ() + 0.5D, rand.nextFloat() * 360.0F, 0.0F);
        miner.setHealth(5.0F + rand.nextInt(5));
        miner.enablePersistence();
        world.spawnEntity(miner);
    }
    if (rand.nextInt(5) == 0) {
        EntityAlienMiner miner = new EntityAlienMiner(world);
        miner.setLocationAndAngles(blockpos.getX() + 0.5D, blockpos.getY() + 0.5D, blockpos.getZ() + 0.5D + rand.nextDouble(), rand.nextFloat() * 360.0F, 0.0F);
        miner.setHealth(5.0F + rand.nextInt(5));
        miner.enablePersistence();
        world.spawnEntity(miner);
    }
    boolean alien = rand.nextInt(5) == 0;
    BlockPos tilepos = blockpos.down();
    world.setBlockState(tilepos, DionaBlocks.CRASHED_ALIEN_PROBE.getDefaultState().withProperty(BlockCrashedAlienProbe.HAS_ALIEN, alien), 3);
    TileEntityCrashedAlienProbe probe = (TileEntityCrashedAlienProbe) world.getTileEntity(tilepos);
    if (probe != null) {
        probe.setLootTable(MPLootTables.CRASHED_ALIEN_PROBE, rand.nextLong());
    }
    return true;
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) TileEntityCrashedAlienProbe(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityCrashedAlienProbe) EntityAlienMiner(stevekung.mods.moreplanets.module.planets.diona.entity.EntityAlienMiner)

Example 3 with EntityAlienMiner

use of stevekung.mods.moreplanets.module.planets.diona.entity.EntityAlienMiner in project MorePlanets by SteveKunG.

the class BlockCrashedAlienProbe method onBlockDestroyedByPlayer.

@Override
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) {
    if (!world.isRemote) {
        if (state.getValue(HAS_ALIEN).booleanValue()) {
            EntityAlienMiner miner = new EntityAlienMiner(world);
            miner.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, world.rand.nextFloat() * 360.0F, 0.0F);
            miner.setHealth(5.0F + world.rand.nextInt(5));
            world.spawnEntity(miner);
        }
    }
}
Also used : EntityAlienMiner(stevekung.mods.moreplanets.module.planets.diona.entity.EntityAlienMiner)

Aggregations

EntityAlienMiner (stevekung.mods.moreplanets.module.planets.diona.entity.EntityAlienMiner)3 Random (java.util.Random)1 BlockPos (net.minecraft.util.math.BlockPos)1 TileEntityCrashedAlienProbe (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityCrashedAlienProbe)1