Search in sources :

Example 1 with TileEntityCrashedProbe

use of micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe in project Galacticraft by micdoodle8.

the class VenusModule method getGuiElement.

@Override
public Object getGuiElement(Side side, int ID, EntityPlayer player, World world, int x, int y, int z) {
    BlockPos pos = new BlockPos(x, y, z);
    TileEntity tile = world.getTileEntity(pos);
    if (ID == GuiIdsPlanets.MACHINE_VENUS) {
        if (tile instanceof TileEntityGeothermalGenerator) {
            return new ContainerGeothermal(player.inventory, (TileEntityGeothermalGenerator) tile);
        } else if (tile instanceof TileEntityCrashedProbe) {
            return new ContainerCrashedProbe(player.inventory, (TileEntityCrashedProbe) tile);
        } else if (tile instanceof TileEntitySolarArrayController) {
            return new ContainerSolarArrayController(player.inventory, (TileEntitySolarArrayController) tile);
        } else if (tile instanceof TileEntityLaserTurret) {
            return new ContainerLaserTurret(player.inventory, (TileEntityLaserTurret) tile);
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ContainerGeothermal(micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerGeothermal) ContainerCrashedProbe(micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerCrashedProbe) BlockPos(net.minecraft.util.math.BlockPos) ContainerLaserTurret(micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerLaserTurret) ContainerSolarArrayController(micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerSolarArrayController)

Example 2 with TileEntityCrashedProbe

use of micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe in project Galacticraft by micdoodle8.

the class BlockCrashedProbe method breakBlock.

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    final TileEntity tile = worldIn.getTileEntity(pos);
    if (tile instanceof TileEntityCrashedProbe && ((TileEntityCrashedProbe) tile).getDropCore()) {
        spawnItem(worldIn, pos);
    }
    super.breakBlock(worldIn, pos, state);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCrashedProbe(micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe)

Example 3 with TileEntityCrashedProbe

use of micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe in project Galacticraft by micdoodle8.

the class WorldGenCrashedProbe method generate.

@Override
public boolean generate(World worldIn, Random rand, BlockPos position) {
    for (position = position.add(-8, 0, -8); position.getY() > 5 && worldIn.isAirBlock(position); position = position.down()) {
        ;
    }
    if (position.getY() <= 4) {
        return false;
    }
    int radius = 5 + rand.nextInt(4);
    int radiusSq = radius * radius;
    // Check this crater doesn't cut into a mountain
    for (int poolX = -radius; poolX <= radius; poolX++) {
        for (int poolY = -radius; poolY <= Math.min(256 - position.getY(), 50); poolY++) {
            for (int poolZ = -radius; poolZ <= radius; poolZ++) {
                BlockPos pos = new BlockPos(poolX + position.getX(), poolY + position.getY(), poolZ + position.getZ());
                if (poolY > 15 && !worldIn.getBlockState(pos).getBlock().isAir(worldIn.getBlockState(pos), worldIn, pos)) {
                    return false;
                }
            }
        }
    }
    for (int poolX = -radius - 1; poolX <= radius + 1; poolX++) {
        for (int poolY = -radius - 1; poolY <= 256 - position.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 pos = new BlockPos(poolX + position.getX(), poolY + position.getY(), poolZ + position.getZ());
                if (distance <= radiusSq) {
                    worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
                } else if (worldIn.getBlockState(pos).getBlock() == VenusBlocks.venusBlock && poolY < 0 && rand.nextInt(5) == 0) {
                    worldIn.setBlockState(pos, VenusBlocks.scorchedRock.getDefaultState(), 2);
                }
            }
        }
    }
    BlockPos blockpos = position.add(0, -radius + 1, 0);
    worldIn.setBlockState(blockpos, VenusBlocks.crashedProbe.getDefaultState(), 3);
    TileEntityCrashedProbe probe = (TileEntityCrashedProbe) worldIn.getTileEntity(blockpos);
    if (probe != null) {
        for (int i = 0; i < probe.getSizeInventory(); ++i) {
            // Clear contents
            probe.setInventorySlotContents(i, ItemStack.EMPTY);
        }
        probe.setLootTable(LootHandlerGC.TABLE_CRASHED_PROBE, rand.nextLong());
        probe.setDropCore();
    }
    return true;
}
Also used : TileEntityCrashedProbe(micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

TileEntityCrashedProbe (micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe)2 TileEntity (net.minecraft.tileentity.TileEntity)2 BlockPos (net.minecraft.util.math.BlockPos)2 ContainerCrashedProbe (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerCrashedProbe)1 ContainerGeothermal (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerGeothermal)1 ContainerLaserTurret (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerLaserTurret)1 ContainerSolarArrayController (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerSolarArrayController)1