Search in sources :

Example 1 with BlockLandingPadFull

use of micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull in project Galacticraft by micdoodle8.

the class GCBlocks method initBlocks.

public static void initBlocks() {
    GCBlocks.breatheableAir = new BlockBreathableAir("breatheable_air");
    GCBlocks.brightAir = new BlockBrightAir("bright_air");
    GCBlocks.brightBreatheableAir = new BlockBrightBreathableAir("bright_breathable_air");
    GCBlocks.brightLamp = new BlockBrightLamp("arclamp");
    GCBlocks.treasureChestTier1 = new BlockTier1TreasureChest("treasure_chest");
    GCBlocks.landingPad = new BlockLandingPad("landing_pad");
    GCBlocks.landingPadFull = new BlockLandingPadFull("landing_pad_full");
    GCBlocks.unlitTorch = new BlockUnlitTorch(false, "unlit_torch");
    GCBlocks.unlitTorchLit = new BlockUnlitTorch(true, "unlit_torch_lit");
    GCBlocks.oxygenDistributor = new BlockOxygenDistributor("distributor");
    GCBlocks.oxygenPipe = new BlockFluidPipe("fluid_pipe", BlockFluidPipe.EnumPipeMode.NORMAL);
    GCBlocks.oxygenPipePull = new BlockFluidPipe("fluid_pipe_pull", BlockFluidPipe.EnumPipeMode.PULL);
    GCBlocks.oxygenCollector = new BlockOxygenCollector("collector");
    GCBlocks.nasaWorkbench = new BlockNasaWorkbench("rocket_workbench");
    GCBlocks.fallenMeteor = new BlockFallenMeteor("fallen_meteor");
    GCBlocks.basicBlock = new BlockBasic("basic_block_core");
    GCBlocks.airLockFrame = new BlockAirLockFrame("air_lock_frame");
    GCBlocks.airLockSeal = new BlockAirLockWall("air_lock_seal");
    // These glass types have to be registered as 6 separate blocks, (a) to allow different coloring of each one and (b) because the Forge MultiLayer custom model does not allow for different textures to be set for different variants
    GCBlocks.spaceGlassVanilla = (BlockSpaceGlass) new BlockSpaceGlass("space_glass_vanilla", GlassType.VANILLA, GlassFrame.PLAIN, null).setHardness(0.3F).setResistance(3F);
    GCBlocks.spaceGlassClear = (BlockSpaceGlass) new BlockSpaceGlass("space_glass_clear", GlassType.CLEAR, GlassFrame.PLAIN, null).setHardness(0.3F).setResistance(3F);
    GCBlocks.spaceGlassStrong = (BlockSpaceGlass) new BlockSpaceGlass("space_glass_strong", GlassType.STRONG, GlassFrame.PLAIN, null).setHardness(4F).setResistance(35F);
    GCBlocks.spaceGlassTinVanilla = (BlockSpaceGlass) new BlockSpaceGlass("space_glass_vanilla_tin", GlassType.VANILLA, GlassFrame.TIN_DECO, GCBlocks.spaceGlassVanilla).setHardness(0.3F).setResistance(4F);
    GCBlocks.spaceGlassTinClear = (BlockSpaceGlass) new BlockSpaceGlass("space_glass_clear_tin", GlassType.CLEAR, GlassFrame.TIN_DECO, GCBlocks.spaceGlassClear).setHardness(0.3F).setResistance(4F);
    GCBlocks.spaceGlassTinStrong = (BlockSpaceGlass) new BlockSpaceGlass("space_glass_strong_tin", GlassType.STRONG, GlassFrame.TIN_DECO, GCBlocks.spaceGlassStrong).setHardness(4F).setResistance(35F);
    GCBlocks.crafting = new BlockCrafting("magnetic_table");
    GCBlocks.refinery = new BlockRefinery("refinery");
    GCBlocks.oxygenCompressor = new BlockOxygenCompressor(false, "oxygen_compressor");
    GCBlocks.fuelLoader = new BlockFuelLoader("fuel_loader");
    GCBlocks.spaceStationBase = new BlockSpaceStationBase("space_station_base");
    GCBlocks.fakeBlock = new BlockMulti("block_multi");
    GCBlocks.oxygenSealer = new BlockOxygenSealer("sealer");
    GCBlocks.sealableBlock = new BlockEnclosed("enclosed");
    GCBlocks.oxygenDetector = new BlockOxygenDetector("oxygen_detector");
    GCBlocks.cargoLoader = new BlockCargoLoader("cargo");
    GCBlocks.parachest = new BlockParaChest("parachest");
    GCBlocks.solarPanel = new BlockSolar("solar");
    GCBlocks.radioTelescope = new BlockDish("dishbase");
    GCBlocks.machineBase = new BlockMachine("machine");
    GCBlocks.machineBase2 = new BlockMachine2("machine2");
    GCBlocks.machineBase3 = new BlockMachine3("machine3");
    GCBlocks.machineTiered = new BlockMachineTiered("machine_tiered");
    GCBlocks.aluminumWire = new BlockAluminumWire("aluminum_wire");
    GCBlocks.panelLighting = new BlockPanelLighting("panel_lighting");
    GCBlocks.glowstoneTorch = new BlockGlowstoneTorch("glowstone_torch");
    GCBlocks.blockMoon = new BlockBasicMoon("basic_block_moon");
    GCBlocks.cheeseBlock = new BlockCheese("cheese");
    GCBlocks.spinThruster = new BlockSpinThruster("spin_thruster");
    GCBlocks.screen = new BlockScreen("view_screen");
    GCBlocks.telemetry = new BlockTelemetry("telemetry");
    GCBlocks.fluidTank = new BlockFluidTank("fluid_tank");
    GCBlocks.bossSpawner = new BlockBossSpawner("boss_spawner");
    GCBlocks.slabGCHalf = new BlockSlabGC("slab_gc_half", Material.rock);
    GCBlocks.slabGCDouble = new BlockDoubleSlabGC("slab_gc_double", Material.rock);
    GCBlocks.tinStairs1 = new BlockStairsGC("tin_stairs_1", basicBlock.getDefaultState().withProperty(BlockBasic.BASIC_TYPE, BlockBasic.EnumBlockBasic.ALUMINUM_DECORATION_BLOCK_0)).setHardness(2.0F);
    GCBlocks.tinStairs2 = new BlockStairsGC("tin_stairs_2", basicBlock.getDefaultState().withProperty(BlockBasic.BASIC_TYPE, BlockBasic.EnumBlockBasic.ALUMINUM_DECORATION_BLOCK_1)).setHardness(2.0F);
    GCBlocks.moonStoneStairs = new BlockStairsGC("moon_stairs_stone", blockMoon.getDefaultState().withProperty(BlockBasicMoon.BASIC_TYPE_MOON, BlockBasicMoon.EnumBlockBasicMoon.MOON_STONE)).setHardness(1.5F);
    GCBlocks.moonBricksStairs = new BlockStairsGC("moon_stairs_brick", blockMoon.getDefaultState().withProperty(BlockBasicMoon.BASIC_TYPE_MOON, BlockBasicMoon.EnumBlockBasicMoon.MOON_DUNGEON_BRICK)).setHardness(4.0F);
    GCBlocks.wallGC = new BlockWallGC("wall_gc");
    GCBlocks.concealedRedstone = new BlockConcealedRedstone("concealed_redstone");
    GCBlocks.concealedRepeater_Powered = new BlockConcealedRepeater("concealed_repeater_pow", true);
    GCBlocks.concealedRepeater_Unpowered = new BlockConcealedRepeater("concealed_repeater", false);
    GCBlocks.concealedDetector = new BlockConcealedDetector("concealed_detector");
    GCBlocks.platform = new BlockPlatform("platform");
    GCBlocks.emergencyBox = new BlockEmergencyBox("emergency_box");
    GCBlocks.grating = new BlockGrating("grating");
    // Hide certain items from NEI
    GCBlocks.hiddenBlocks.add(GCBlocks.airLockSeal);
    GCBlocks.hiddenBlocks.add(GCBlocks.oxygenPipePull);
    GCBlocks.hiddenBlocks.add(GCBlocks.unlitTorch);
    GCBlocks.hiddenBlocks.add(GCBlocks.unlitTorchLit);
    GCBlocks.hiddenBlocks.add(GCBlocks.landingPadFull);
    GCBlocks.hiddenBlocks.add(GCBlocks.spaceStationBase);
    GCBlocks.hiddenBlocks.add(GCBlocks.bossSpawner);
    GCBlocks.hiddenBlocks.add(GCBlocks.slabGCDouble);
    GCBlocks.hiddenBlocks.add(GCBlocks.concealedRepeater_Powered);
    // Register blocks before register ores, so that the ItemStack picks up the correct item
    GCBlocks.registerBlocks();
    GCBlocks.setHarvestLevels();
    // Complete registration of various types of torches
    BlockUnlitTorch.register((BlockUnlitTorch) GCBlocks.unlitTorch, (BlockUnlitTorch) GCBlocks.unlitTorchLit, Blocks.torch);
    OreDictionary.registerOre("oreCopper", new ItemStack(GCBlocks.basicBlock, 1, 5));
    OreDictionary.registerOre("oreCopper", new ItemStack(GCBlocks.blockMoon, 1, 0));
    OreDictionary.registerOre("oreTin", new ItemStack(GCBlocks.basicBlock, 1, 6));
    OreDictionary.registerOre("oreTin", new ItemStack(GCBlocks.blockMoon, 1, 1));
    OreDictionary.registerOre("oreAluminum", new ItemStack(GCBlocks.basicBlock, 1, 7));
    OreDictionary.registerOre("oreAluminium", new ItemStack(GCBlocks.basicBlock, 1, 7));
    OreDictionary.registerOre("oreNaturalAluminum", new ItemStack(GCBlocks.basicBlock, 1, 7));
    OreDictionary.registerOre("oreSilicon", new ItemStack(GCBlocks.basicBlock, 1, 8));
    OreDictionary.registerOre("oreCheese", new ItemStack(GCBlocks.blockMoon, 1, 2));
    OreDictionary.registerOre("blockCopper", new ItemStack(GCBlocks.basicBlock, 1, 9));
    OreDictionary.registerOre("blockTin", new ItemStack(GCBlocks.basicBlock, 1, 10));
    OreDictionary.registerOre("blockAluminum", new ItemStack(GCBlocks.basicBlock, 1, 11));
    OreDictionary.registerOre("blockAluminium", new ItemStack(GCBlocks.basicBlock, 1, 11));
    OreDictionary.registerOre("blockSilicon", new ItemStack(GCBlocks.basicBlock, 1, 13));
    OreDictionary.registerOre("turfMoon", new ItemStack(GCBlocks.blockMoon, 1, EnumBlockBasicMoon.MOON_TURF.getMeta()));
}
Also used : EnumBlockBasicMoon(micdoodle8.mods.galacticraft.core.blocks.BlockBasicMoon.EnumBlockBasicMoon) ItemStack(net.minecraft.item.ItemStack)

Example 2 with BlockLandingPadFull

use of micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull in project Galacticraft by micdoodle8.

the class EntityAutoRocket method onLaunch.

@Override
public void onLaunch() {
    if (!(this.worldObj.provider.getDimensionId() == GalacticraftCore.planetOverworld.getDimensionID() || this.worldObj.provider instanceof IGalacticraftWorldProvider)) {
        if (ConfigManagerCore.disableRocketLaunchAllNonGC) {
            this.cancelLaunch();
            return;
        }
        // No rocket flight in the Nether, the End etc
        for (int i = ConfigManagerCore.disableRocketLaunchDimensions.length - 1; i >= 0; i--) {
            if (ConfigManagerCore.disableRocketLaunchDimensions[i] == this.worldObj.provider.getDimensionId()) {
                this.cancelLaunch();
                return;
            }
        }
    }
    super.onLaunch();
    if (!this.worldObj.isRemote) {
        GCPlayerStats stats = null;
        if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayerMP) {
            stats = GCPlayerStats.get(this.riddenByEntity);
            if (!(this.worldObj.provider instanceof IOrbitDimension)) {
                stats.setCoordsTeleportedFromX(this.riddenByEntity.posX);
                stats.setCoordsTeleportedFromZ(this.riddenByEntity.posZ);
            }
        }
        int amountRemoved = 0;
        PADSEARCH: for (int x = MathHelper.floor_double(this.posX) - 1; x <= MathHelper.floor_double(this.posX) + 1; x++) {
            for (int y = MathHelper.floor_double(this.posY) - 3; y <= MathHelper.floor_double(this.posY) + 1; y++) {
                for (int z = MathHelper.floor_double(this.posZ) - 1; z <= MathHelper.floor_double(this.posZ) + 1; z++) {
                    BlockPos pos = new BlockPos(x, y, z);
                    final Block block = this.worldObj.getBlockState(pos).getBlock();
                    if (block != null && block instanceof BlockLandingPadFull) {
                        if (amountRemoved < 9) {
                            EventLandingPadRemoval event = new EventLandingPadRemoval(this.worldObj, pos);
                            MinecraftForge.EVENT_BUS.post(event);
                            if (event.allow) {
                                this.worldObj.setBlockToAir(pos);
                                amountRemoved = 9;
                            }
                            break PADSEARCH;
                        }
                    }
                }
            }
        }
        // Set the player's launchpad item for return on landing - or null if launchpads not removed
        if (stats != null) {
            stats.setLaunchpadStack(amountRemoved == 9 ? new ItemStack(GCBlocks.landingPad, 9, 0) : null);
        }
        this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
    }
}
Also used : IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) EventLandingPadRemoval(micdoodle8.mods.galacticraft.core.event.EventLandingPadRemoval) Block(net.minecraft.block.Block) BlockLandingPadFull(micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) IOrbitDimension(micdoodle8.mods.galacticraft.api.world.IOrbitDimension) ItemStack(net.minecraft.item.ItemStack)

Example 3 with BlockLandingPadFull

use of micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull in project Galacticraft by micdoodle8.

the class EntityAutoRocket method setTarget.

protected boolean setTarget(boolean doSet, int destFreq) {
    WorldServer[] servers = GCCoreUtil.getWorldServerList(this.worldObj);
    if (!GalacticraftCore.isPlanetsLoaded || controllerClass == null) {
        return false;
    }
    for (int i = 0; i < servers.length; i++) {
        WorldServer world = servers[i];
        try {
            for (TileEntity tile : new ArrayList<TileEntity>(world.loadedTileEntityList)) {
                if (!controllerClass.isInstance(tile))
                    continue;
                tile = world.getTileEntity(tile.getPos());
                if (!controllerClass.isInstance(tile))
                    continue;
                int controllerFrequency = controllerClass.getField("frequency").getInt(tile);
                if (destFreq == controllerFrequency) {
                    boolean targetSet = false;
                    blockLoop: for (int x = -2; x <= 2; x++) {
                        for (int z = -2; z <= 2; z++) {
                            BlockPos pos = new BlockPos(tile.getPos().add(x, 0, z));
                            Block block = world.getBlockState(pos).getBlock();
                            if (block instanceof BlockLandingPadFull) {
                                if (doSet) {
                                    this.targetVec = pos;
                                }
                                targetSet = true;
                                break blockLoop;
                            }
                        }
                    }
                    if (doSet) {
                        this.targetDimension = tile.getWorld().provider.getDimensionId();
                    }
                    if (!targetSet) {
                        if (doSet) {
                            this.targetVec = null;
                        }
                        return false;
                    } else {
                        return true;
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ArrayList(java.util.ArrayList) Block(net.minecraft.block.Block) BlockLandingPadFull(micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull) WorldServer(net.minecraft.world.WorldServer)

Example 4 with BlockLandingPadFull

use of micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull in project Galacticraft by micdoodle8.

the class TileEntityLaunchController method onTicketLoaded.

@Override
public void onTicketLoaded(Ticket ticket, boolean placed) {
    if (!this.worldObj.isRemote && ConfigManagerMars.launchControllerChunkLoad) {
        if (ticket == null) {
            return;
        }
        if (this.chunkLoadTicket == null) {
            this.chunkLoadTicket = ticket;
        }
        NBTTagCompound nbt = this.chunkLoadTicket.getModData();
        nbt.setInteger("ChunkLoaderTileX", this.getPos().getX());
        nbt.setInteger("ChunkLoaderTileY", this.getPos().getY());
        nbt.setInteger("ChunkLoaderTileZ", this.getPos().getZ());
        for (int x = -2; x <= 2; x++) {
            for (int z = -2; z <= 2; z++) {
                Block blockID = this.worldObj.getBlockState(this.getPos().add(x, 0, z)).getBlock();
                if (blockID instanceof BlockLandingPadFull) {
                    if (this.getPos().getX() + x >> 4 != this.getPos().getX() >> 4 || this.getPos().getZ() + z >> 4 != this.getPos().getZ() >> 4) {
                        this.connectedPads.add(new BlockPos(this.getPos().getX() + x, this.getPos().getY(), this.getPos().getZ() + z));
                        if (placed) {
                            ChunkLoadingCallback.forceChunk(this.chunkLoadTicket, this.worldObj, this.getPos().getX() + x, this.getPos().getY(), this.getPos().getZ() + z, this.getOwnerName());
                        } else {
                            ChunkLoadingCallback.addToList(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getOwnerName());
                        }
                    }
                }
            }
        }
        ChunkLoadingCallback.forceChunk(this.chunkLoadTicket, this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getOwnerName());
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Block(net.minecraft.block.Block) BlockLandingPadFull(micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull) BlockPos(net.minecraft.util.BlockPos)

Aggregations

BlockLandingPadFull (micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull)3 Block (net.minecraft.block.Block)3 ItemStack (net.minecraft.item.ItemStack)2 ArrayList (java.util.ArrayList)1 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)1 IOrbitDimension (micdoodle8.mods.galacticraft.api.world.IOrbitDimension)1 EnumBlockBasicMoon (micdoodle8.mods.galacticraft.core.blocks.BlockBasicMoon.EnumBlockBasicMoon)1 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 EventLandingPadRemoval (micdoodle8.mods.galacticraft.core.event.EventLandingPadRemoval)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.BlockPos)1 WorldServer (net.minecraft.world.WorldServer)1