Search in sources :

Example 1 with TileEntityCrafting

use of micdoodle8.mods.galacticraft.core.tile.TileEntityCrafting in project Galacticraft by micdoodle8.

the class GuiHandler method getClientGuiElement.

@SideOnly(Side.CLIENT)
private Object getClientGuiElement(int ID, EntityPlayer player, World world, BlockPos position) {
    EntityPlayerSP playerClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);
    if (ID == GuiIdsCore.GALAXY_MAP) {
        return new GuiCelestialSelection(true, null);
    } else if (ID == GuiIdsCore.ROCKET_INVENTORY && player.ridingEntity instanceof EntityTieredRocket) {
        return new GuiRocketInventory(player.inventory, (EntityTieredRocket) player.ridingEntity, ((EntityTieredRocket) player.ridingEntity).getType());
    } else if (ID == GuiIdsCore.EXTENDED_INVENTORY) {
        return new GuiExtendedInventory(player, ClientProxyCore.dummyInventory);
    } else if (ID == GuiIdsCore.SPACE_RACE_START) {
        return new GuiNewSpaceRace(player);
    } else if (ID == GuiIdsCore.SPACE_RACE_JOIN) {
        return new GuiJoinSpaceRace(playerClient);
    } else if (ID == GuiIdsCore.PRE_LAUNCH_CHECKLIST) {
        return new GuiPreLaunchChecklist(WorldUtil.getAllChecklistKeys(), player.getHeldItem().hasTagCompound() ? (NBTTagCompound) player.getHeldItem().getTagCompound().getTag("checklistData") : null);
    }
    TileEntity tile = world.getTileEntity(position);
    if (tile != null) {
        if (tile instanceof TileEntityCrafting) {
            return new GuiCrafting(player.inventory, (TileEntityCrafting) tile);
        } else if (tile instanceof TileEntityRefinery) {
            return new GuiRefinery(player.inventory, (TileEntityRefinery) world.getTileEntity(position));
        } else if (tile instanceof TileEntityOxygenCollector) {
            return new GuiOxygenCollector(player.inventory, (TileEntityOxygenCollector) tile);
        } else if (tile instanceof TileEntityOxygenDistributor) {
            return new GuiOxygenDistributor(player.inventory, (TileEntityOxygenDistributor) tile);
        } else if (tile instanceof TileEntityFuelLoader) {
            return new GuiFuelLoader(player.inventory, (TileEntityFuelLoader) tile);
        } else if (tile instanceof TileEntityOxygenSealer) {
            return new GuiOxygenSealer(player.inventory, (TileEntityOxygenSealer) tile);
        } else if (tile instanceof TileEntityCargoLoader) {
            return new GuiCargoLoader(player.inventory, (TileEntityCargoLoader) tile);
        } else if (tile instanceof TileEntityCargoUnloader) {
            return new GuiCargoUnloader(player.inventory, (TileEntityCargoUnloader) tile);
        } else if (tile instanceof TileEntityParaChest) {
            return new GuiParaChest(player.inventory, (TileEntityParaChest) tile);
        } else if (tile instanceof TileEntitySolar) {
            return new GuiSolar(player.inventory, (TileEntitySolar) tile);
        } else if (tile instanceof TileEntityAirLockController) {
            return new GuiAirLockController((TileEntityAirLockController) tile);
        } else if (tile instanceof TileEntityEnergyStorageModule) {
            return new GuiEnergyStorageModule(player.inventory, (TileEntityEnergyStorageModule) tile);
        } else if (tile instanceof TileEntityCoalGenerator) {
            return new GuiCoalGenerator(player.inventory, (TileEntityCoalGenerator) tile);
        } else if (tile instanceof TileEntityElectricFurnace) {
            return new GuiElectricFurnace(player.inventory, (TileEntityElectricFurnace) tile);
        } else if (tile instanceof TileEntityIngotCompressor) {
            return new GuiIngotCompressor(player.inventory, (TileEntityIngotCompressor) tile);
        } else if (tile instanceof TileEntityElectricIngotCompressor) {
            return new GuiElectricIngotCompressor(player.inventory, (TileEntityElectricIngotCompressor) tile);
        } else if (tile instanceof TileEntityCircuitFabricator) {
            return new GuiCircuitFabricator(player.inventory, (TileEntityCircuitFabricator) tile);
        } else if (tile instanceof TileEntityOxygenStorageModule) {
            return new GuiOxygenStorageModule(player.inventory, (TileEntityOxygenStorageModule) tile);
        } else if (tile instanceof TileEntityOxygenCompressor) {
            return new GuiOxygenCompressor(player.inventory, (TileEntityOxygenCompressor) tile);
        } else if (tile instanceof TileEntityOxygenDecompressor) {
            return new GuiOxygenDecompressor(player.inventory, (TileEntityOxygenDecompressor) tile);
        } else if (tile instanceof TileEntityDeconstructor) {
            return new GuiDeconstructor(player.inventory, (TileEntityDeconstructor) tile);
        } else if (tile instanceof TileEntityPainter) {
            return new GuiPainter(player.inventory, (TileEntityPainter) tile);
        }
    }
    if (playerClient != null) {
        GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerClient);
        for (ISchematicPage page : stats.getUnlockedSchematics()) {
            if (ID == page.getGuiID()) {
                GuiScreen screen = page.getResultScreen(playerClient, position);
                if (screen instanceof ISchematicResultPage) {
                    ((ISchematicResultPage) screen).setPageIndex(page.getPageID());
                }
                return screen;
            }
        }
    }
    return null;
}
Also used : EntityTieredRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket) GuiJoinSpaceRace(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiJoinSpaceRace) GuiCelestialSelection(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection) GCPlayerStatsClient(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient) ISchematicResultPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicResultPage) TileEntity(net.minecraft.tileentity.TileEntity) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage) GuiScreen(net.minecraft.client.gui.GuiScreen) GuiNewSpaceRace(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) GuiPreLaunchChecklist(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiPreLaunchChecklist) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with TileEntityCrafting

use of micdoodle8.mods.galacticraft.core.tile.TileEntityCrafting in project Galacticraft by micdoodle8.

the class GuiHandler method getServerGuiElement.

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
    if (playerBase == null) {
        player.addChatMessage(new ChatComponentText("Galacticraft player instance null server-side. This is a bug."));
        return null;
    }
    GCPlayerStats stats = GCPlayerStats.get(playerBase);
    if (ID == GuiIdsCore.ROCKET_INVENTORY && player.ridingEntity instanceof EntityTieredRocket) {
        return new ContainerRocketInventory(player.inventory, (EntityTieredRocket) player.ridingEntity, ((EntityTieredRocket) player.ridingEntity).getType(), player);
    } else if (ID == GuiIdsCore.EXTENDED_INVENTORY) {
        return new ContainerExtendedInventory(player, stats.getExtendedInventory());
    }
    BlockPos pos = new BlockPos(x, y, z);
    TileEntity tile = world.getTileEntity(pos);
    if (tile != null) {
        if (tile instanceof TileEntityCrafting) {
            return new ContainerCrafting(player.inventory, (TileEntityCrafting) tile);
        } else if (tile instanceof TileEntityRefinery) {
            return new ContainerRefinery(player.inventory, (TileEntityRefinery) tile, player);
        } else if (tile instanceof TileEntityOxygenCollector) {
            return new ContainerOxygenCollector(player.inventory, (TileEntityOxygenCollector) tile);
        } else if (tile instanceof TileEntityOxygenDistributor) {
            return new ContainerOxygenDistributor(player.inventory, (TileEntityOxygenDistributor) tile);
        } else if (tile instanceof TileEntityFuelLoader) {
            return new ContainerFuelLoader(player.inventory, (TileEntityFuelLoader) tile);
        } else if (tile instanceof TileEntityOxygenSealer) {
            return new ContainerOxygenSealer(player.inventory, (TileEntityOxygenSealer) tile);
        } else if (tile instanceof TileEntityCargoLoader) {
            return new ContainerCargoLoader(player.inventory, (TileEntityCargoLoader) tile);
        } else if (tile instanceof TileEntityCargoUnloader) {
            return new ContainerCargoLoader(player.inventory, (TileEntityCargoUnloader) tile);
        } else if (tile instanceof TileEntityParaChest) {
            return new ContainerParaChest(player.inventory, (TileEntityParaChest) tile, player);
        } else if (tile instanceof TileEntitySolar) {
            return new ContainerSolar(player.inventory, (TileEntitySolar) tile);
        } else if (tile instanceof TileEntityEnergyStorageModule) {
            return new ContainerEnergyStorageModule(player.inventory, (TileEntityEnergyStorageModule) tile);
        } else if (tile instanceof TileEntityCoalGenerator) {
            return new ContainerCoalGenerator(player.inventory, (TileEntityCoalGenerator) tile);
        } else if (tile instanceof TileEntityElectricFurnace) {
            return new ContainerElectricFurnace(player.inventory, (TileEntityElectricFurnace) tile);
        } else if (tile instanceof TileEntityIngotCompressor) {
            return new ContainerIngotCompressor(player.inventory, (TileEntityIngotCompressor) tile);
        } else if (tile instanceof TileEntityElectricIngotCompressor) {
            return new ContainerElectricIngotCompressor(player.inventory, (TileEntityElectricIngotCompressor) tile);
        } else if (tile instanceof TileEntityCircuitFabricator) {
            return new ContainerCircuitFabricator(player.inventory, (TileEntityCircuitFabricator) tile);
        } else if (tile instanceof TileEntityOxygenStorageModule) {
            return new ContainerOxygenStorageModule(player.inventory, (TileEntityOxygenStorageModule) tile);
        } else if (tile instanceof TileEntityOxygenCompressor) {
            return new ContainerOxygenCompressor(player.inventory, (TileEntityOxygenCompressor) tile, player);
        } else if (tile instanceof TileEntityOxygenDecompressor) {
            return new ContainerOxygenDecompressor(player.inventory, (TileEntityOxygenDecompressor) tile, player);
        } else if (tile instanceof TileEntityDeconstructor) {
            return new ContainerDeconstructor(player.inventory, (TileEntityDeconstructor) tile);
        } else if (tile instanceof TileEntityPainter) {
            return new ContainerPainter(player.inventory, (TileEntityPainter) tile);
        }
    }
    for (ISchematicPage page : stats.getUnlockedSchematics()) {
        if (ID == page.getGuiID()) {
            return page.getResultContainer(playerBase, new BlockPos(x, y, z));
        }
    }
    return null;
}
Also used : EntityTieredRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) BlockPos(net.minecraft.util.BlockPos) ChatComponentText(net.minecraft.util.ChatComponentText) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) TileEntity(net.minecraft.tileentity.TileEntity) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage)

Example 3 with TileEntityCrafting

use of micdoodle8.mods.galacticraft.core.tile.TileEntityCrafting in project Galacticraft by micdoodle8.

the class BaseRoom method buildRoomContents.

/**
 * Room contents boundaries are:
 *    x from 1 to maxX
 *    y from 1 to this.sizeY - 1
 *    z from 1 to maxZ
 */
private void buildRoomContents(World worldIn, int x, int y, int z, int maxX, int maxZ, BlockPos blockpos, int randomInt) {
    IBlockState state = Blocks.air.getDefaultState();
    int semirand = ((blockpos.getY() * 379 + blockpos.getX()) * 373 + blockpos.getZ()) * 7 & 15;
    int facing = 0;
    int facing1 = 0;
    int facing2 = 0;
    int facingLamp = 2;
    int facingScreen = 2;
    switch(this.direction) {
        case WEST:
            facing1 = 3;
            facing2 = 2;
            facingLamp = 3;
            facingScreen = 5;
            break;
        case EAST:
            facing = 2;
            facing1 = 1;
            facing2 = 0;
            facingLamp = 2;
            facingScreen = 4;
            break;
        case NORTH:
            facing = 3;
            facing1 = 2;
            facing2 = 1;
            facingLamp = 5;
            facingScreen = 2;
            break;
        case SOUTH:
            facing = 1;
            facing1 = 0;
            facing2 = 3;
            facingLamp = 4;
            facingScreen = 3;
    }
    // Offset from centre - used for some rooms
    int ox = maxX / 2 - 3;
    int xx = x - ox;
    switch(this.type) {
        case EMPTY:
            // Pillars in corners
            if ((z == 1 || z == maxZ - 1) && (x == 2 || x == maxX - 1)) {
                state = GCBlocks.wallGC.getStateFromMeta(2);
            } else if (y == 1) {
                // Some random Netherwart
                if (semirand < 2) {
                    state = AsteroidBlocks.spaceWart.getStateFromMeta(semirand);
                }
            }
            break;
        case STORE:
            if (maxX >= 6 && y == 1 && maxZ >= 5) {
                // An actual landing pad (indoors!)
                if (xx >= 3 && xx <= 5 && z >= 2 && z <= 4) {
                    state = GCBlocks.landingPad.getDefaultState();
                } else if (xx == 2) {
                    // Cargo loaders and unloaders, these will contain treasure items but only accessible when powered
                    switch(z) {
                        case 2:
                            state = GCBlocks.cargoLoader.getStateFromMeta(facing);
                            break;
                        case 3:
                            state = GCBlocks.aluminumWire.getStateFromMeta(1);
                            break;
                        case 4:
                            state = GCBlocks.cargoLoader.getStateFromMeta(4 + (facing ^ 2));
                            break;
                        default:
                    }
                }
            }
            break;
        case POWER:
            facing = (facing + 1) % 4;
            switch(y) {
                case 1:
                    // Layer 1: wall blocks with sealable alu wire in the centre
                    if (z == 3 && xx >= 4 && x <= maxX - 2)
                        state = GCBlocks.sealableBlock.getStateFromMeta(14);
                    else if (xx >= 3 && z > 1 && (z < maxZ - 1 || z == 4))
                        state = this.configuration.getWallBlock();
                    break;
                case 2:
                    // Layer 2: tier 1 storage and alu wire and a switch
                    if (z == 2) {
                        if (xx == 3)
                            state = GCBlocks.machineTiered.getStateFromMeta(0 + facing);
                        else if (xx > 3 && x < maxX - 2)
                            state = GCBlocks.aluminumWire.getStateFromMeta(0);
                        else if (x == maxX - 2)
                            state = GCBlocks.aluminumWire.getStateFromMeta(2);
                        else if ((xx == 3 || x == maxX - 1))
                            state = AsteroidBlocks.blockMinerBase.getDefaultState();
                    } else if (z == 3 && x == maxX - 2)
                        state = GCBlocks.aluminumWire.getStateFromMeta(0);
                    else // An industrial looking frame for the whole structure
                    if (z == 4 && (xx == 3 || x == maxX - 1))
                        state = AsteroidBlocks.blockMinerBase.getDefaultState();
                    break;
                case 3:
                    // Layer 3: tier 2 storage and alu wire
                    if (z == 2 && xx == 4)
                        state = GCBlocks.aluminumWire.getStateFromMeta(0);
                    else if (z == 3 && x == maxX - 2)
                        state = GCBlocks.machineTiered.getStateFromMeta(8 + (facing ^ 2));
                    else if (z == 3 && x == maxX - 1)
                        state = GCBlocks.aluminumWire.getStateFromMeta(1);
                    else if (z == 3 && xx >= 4 && x < maxX - 2)
                        state = GCBlocks.aluminumWire.getStateFromMeta(0);
                    else // An industrial looking frame for the whole structure
                    if ((z == 2 || z == 4) && (xx == 3 || x == maxX - 1))
                        state = AsteroidBlocks.blockMinerBase.getDefaultState();
                    break;
                case 4:
                    // Layer 4: tier 2 storage and alu wire
                    if (z == 3) {
                        if (x == maxX - 3)
                            state = GCBlocks.machineTiered.getStateFromMeta(8 + facing);
                        else if (x == maxX - 1 || x == maxX - 2)
                            state = GCBlocks.aluminumWire.getStateFromMeta(1);
                    } else // An industrial looking frame for the whole structure
                    if ((z == 2 || z == 4) && xx >= 3 && x < maxX)
                        state = AsteroidBlocks.blockMinerBase.getDefaultState();
                    break;
            }
            break;
        case ENGINEERING:
            if (y == 1) {
                int closerz = (maxZ <= 5) ? 2 : 3;
                if ((z == maxZ - 2 && x == maxX / 2 + 1 || (z == closerz && (x == 2 || x == maxX - 1) && maxX > 5)) && maxZ > 3) {
                    state = GCBlocks.nasaWorkbench.getDefaultState();
                } else {
                    state = AsteroidBlocks.blockBasic.getStateFromMeta(6);
                }
            }
            break;
        case MEDICAL:
            int zTable = maxZ - 3;
            int zTank = maxZ - 1;
            int zLight = zTable;
            if (zTable <= 1) {
                if (zTable < 0) {
                    // Too small to build the room
                    break;
                }
                // Small medical room: bring everything closer together
                zTable++;
                zLight++;
                zTank = maxZ;
            }
            if (y == 1) {
                // Operating table at y == 1
                if (z == zTable && x <= maxX - 1 && x >= maxX - 3) {
                    state = GCBlocks.crafting.getStateFromMeta(1);
                } else
                    // Tiled floor
                    state = Blocks.iron_trapdoor.getDefaultState();
            } else if (y == 2 || y == 3) {
                // Operating table at y == 2
                if (y == 2 && z == zTable && x <= maxX - 1 && x >= maxX - 3) {
                    state = GCBlocks.landingPad.getDefaultState();
                } else if (z == zTank) {
                    // Fluid tanks, 2 tanks high - these will be filled with Bacterial Sludge below
                    if ((maxX - x) % 2 == 1) {
                        state = GCBlocks.fluidTank.getDefaultState();
                    }
                }
            } else if ((y == 4 || y == 5) && (z == zLight || z == zLight - 1)) {
                // Lighting
                if (x == maxX)
                    state = GCBlocks.concealedDetector.getStateFromMeta(8 + facing + (this.configuration.getDeckType() == EnumBaseType.HUMANOID ? 0 : 4));
                else if (x == maxX - 1)
                    state = GCBlocks.brightLamp.getStateFromMeta(facingLamp);
            }
            break;
        case CREW:
            if (y == 1) {
                if (x == 2 || x == maxX - 1) {
                    if ((z % 2) == 1) {
                        state = GCBlocks.wallGC.getStateFromMeta((z == 1) ? 3 : 2);
                    }
                } else {
                    state = Blocks.carpet.getStateFromMeta(7);
                }
            } else if (y == 2) {
                if (x == 2 || x == maxX - 1) {
                    if (z == 1) {
                        state = Blocks.brewing_stand.getDefaultState();
                    } else if (z > 2 && z < maxZ) {
                        state = GCBlocks.landingPad.getStateFromMeta(1);
                    }
                }
            }
            break;
        case CONTROL:
            if (y == 1) {
                if (x == maxX / 2 + 1 && z == maxZ - 2) {
                    state = AsteroidBlocks.blockBasic.getStateFromMeta(6);
                } else {
                    state = GCBlocks.slabGCHalf.getStateFromMeta(6);
                }
            } else if (y <= 3) {
                if ((x == 1 || x == maxX) && !(z == 0 || z == maxZ)) {
                    state = GCBlocks.telemetry.getDefaultState();
                } else if ((x == 2 || x == maxX - 1) && !(z == 0 || z == maxZ)) {
                    state = GCBlocks.screen.getStateFromMeta((x == 2 ? facingLamp : facingLamp ^ 1));
                } else if (z == maxZ && x > 2 && x < maxX - 1) {
                    state = GCBlocks.screen.getStateFromMeta(facingScreen);
                } else if (x == maxX / 2 + 1 && z == maxZ - 2 && y == 2) {
                    state = GCBlocks.landingPad.getStateFromMeta(1);
                }
            }
            break;
        case CRYO:
            boolean xEntrance = maxX > 5 ? (x > 2 && x < maxX - 1) : (x > 1 && x < maxX);
            boolean highEntrance = this.configuration.isHangarDeck() && this.configuration.getDeckType() == EnumBaseType.AVIAN;
            if (y == 1) {
                // Build a dark plinth for it all at y == 1
                if (z == 1 && x > 1 && x < maxX) {
                    state = GCBlocks.slabGCHalf.getStateFromMeta(6);
                } else if (z != 0 || !xEntrance || highEntrance) {
                    state = AsteroidBlocks.blockBasic.getStateFromMeta(6);
                }
            } else if (z == 0 && (y > (highEntrance ? 5 : 3) || !xEntrance)) {
                // Dark ceiling and entrance wall
                state = AsteroidBlocks.blockBasic.getStateFromMeta(6);
            } else if (y <= 4 && (z == maxZ || x == 1 || x == maxX)) {
                // Around the walls: Cryo Chambers alternated with dark blocks
                if (z == maxZ && x % 2 == 0 && x < maxX) {
                    if (y == 2) {
                        state = MarsBlocks.machine.getStateFromMeta(BlockMachineMars.CRYOGENIC_CHAMBER_METADATA + facing1);
                    }
                } else if (z < maxZ && z > 1 && (maxZ - z) % 2 == 0) {
                    if (y == 2) {
                        state = MarsBlocks.machine.getStateFromMeta(BlockMachineMars.CRYOGENIC_CHAMBER_METADATA + (x == 1 ? facing : facing2));
                    }
                } else {
                    state = AsteroidBlocks.blockBasic.getStateFromMeta(6);
                }
            } else if (y > 5 || y == this.configuration.getRoomHeight() || (z == maxZ || x == 1 || x == maxX)) {
                // Dark top section of walls and ceiling
                state = AsteroidBlocks.blockBasic.getStateFromMeta(6);
            }
            break;
        default:
    }
    worldIn.setBlockState(blockpos, state, 2);
    if (state.getBlock() instanceof ITileEntityProvider) {
        TileEntity tile = worldIn.getTileEntity(blockpos);
        if (tile instanceof IMultiBlock) {
            List<BlockPos> positions = new LinkedList<>();
            ((IMultiBlock) tile).getPositions(blockpos, positions);
            for (BlockPos pos : positions) {
                worldIn.setBlockState(pos, GCBlocks.fakeBlock.getDefaultState().withProperty(BlockMulti.MULTI_TYPE, ((IMultiBlock) tile).getMultiType()), 2);
            }
        }
        if (tile instanceof TileEntityFluidTank) {
            ((TileEntityFluidTank) tile).fill(null, new FluidStack(MarsModule.sludge, 16000), true);
        } else if (tile instanceof TileEntityCargoLoader) {
            TileEntityCargoLoader loader = (TileEntityCargoLoader) tile;
            loader.locked = true;
            // Looks like the food supplies have gone off!
            loader.addCargo(new ItemStack(Items.poisonous_potato, 64, 0), true);
            loader.addCargo(new ItemStack(Items.poisonous_potato, 64, 0), true);
            loader.addCargo(new ItemStack(Items.poisonous_potato, 64, 0), true);
            loader.addCargo(new ItemStack(Items.poisonous_potato, 64, 0), true);
            loader.addCargo(new ItemStack(Items.rotten_flesh, 64, 0), true);
            loader.addCargo(new ItemStack(GCItems.flagPole, semirand % 31 + 2, 0), true);
            // Slimeling Inventory Bag
            loader.addCargo(new ItemStack(MarsItems.marsItemBasic, semirand % 2 + 1, 4), true);
            // Thermal cloth
            loader.addCargo(new ItemStack(AsteroidsItems.basicItem, semirand % 23 + 41, 7), true);
            loader.addCargo(new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY), true);
            loader.addCargo(new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY), true);
            loader.addCargo(new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY), true);
            loader.addCargo(new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY), true);
            loader.addCargo(new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY), true);
            loader.addCargo(this.configuration.getDeckType().treasure.copy(), true);
        } else if (tile instanceof TileEntityCrafting) {
            switch(semirand % 4) {
                case 0:
                    break;
                case 1:
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(1, new ItemStack(Items.iron_ingot));
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(3, new ItemStack(Items.iron_ingot));
                    break;
                case 2:
                    // Creeper or Zombie head
                    int slot = semirand % 9;
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(slot, new ItemStack(Items.skull, 1, (semirand % 13 < 6) ? 4 : 2));
                    break;
                case 3:
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(0, new ItemStack(Items.iron_ingot));
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(1, new ItemStack(Items.iron_ingot));
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(3, new ItemStack(Items.iron_ingot));
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(4, new ItemStack(Items.stick));
                    ((TileEntityCrafting) tile).craftMatrix.setInventorySlotContents(7, new ItemStack(Items.stick));
                    break;
            }
        } else if (tile instanceof TileEntityBrewingStand) {
            TileEntityBrewingStand stand = (TileEntityBrewingStand) tile;
            // Poison
            stand.setInventorySlotContents(0, new ItemStack(Items.potionitem, 1, 8196));
            // Weakness
            stand.setInventorySlotContents(1, new ItemStack(Items.potionitem, 1, 8200));
            // Harming
            stand.setInventorySlotContents(2, new ItemStack(Items.potionitem, 1, 8204));
        } else if (tile instanceof TileEntityEnergyStorageModule) {
            TileEntityEnergyStorageModule store = (TileEntityEnergyStorageModule) tile;
            if (semirand % 3 == 1) {
                store.setInventorySlotContents(1, new ItemStack(GCItems.battery, 1, 100));
            }
        }
    }
    if (this.type == EnumRoomType.ENGINEERING && y == (this.configuration.getRoomHeight() <= 4 ? 2 : 3) && z == maxZ && (x == 3 || x == 6)) {
        EnumFacing hangingDirection = this.direction;
        if (hangingDirection == EnumFacing.WEST || hangingDirection == EnumFacing.EAST) {
            // Apparently we have our North and our South reversed ?  So we don't want the opposite for North and South!
            hangingDirection = hangingDirection.getOpposite();
        }
        EntityHangingSchematic entityhanging = new EntityHangingSchematic(worldIn, blockpos, hangingDirection, x / 3 - 1);
        if (entityhanging != null) {
            worldIn.spawnEntityInWorld(entityhanging);
            entityhanging.setSendToClient();
        }
    }
}
Also used : TileEntityCrafting(micdoodle8.mods.galacticraft.core.tile.TileEntityCrafting) TileEntityCargoLoader(micdoodle8.mods.galacticraft.core.tile.TileEntityCargoLoader) IBlockState(net.minecraft.block.state.IBlockState) TileEntityEnergyStorageModule(micdoodle8.mods.galacticraft.core.tile.TileEntityEnergyStorageModule) FluidStack(net.minecraftforge.fluids.FluidStack) EnumFacing(net.minecraft.util.EnumFacing) LinkedList(java.util.LinkedList) TileEntity(net.minecraft.tileentity.TileEntity) EntityHangingSchematic(micdoodle8.mods.galacticraft.core.entities.EntityHangingSchematic) ITileEntityProvider(net.minecraft.block.ITileEntityProvider) IMultiBlock(micdoodle8.mods.galacticraft.core.tile.IMultiBlock) TileEntityBrewingStand(net.minecraft.tileentity.TileEntityBrewingStand) TileEntityFluidTank(micdoodle8.mods.galacticraft.core.tile.TileEntityFluidTank) BlockPos(net.minecraft.util.BlockPos) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TileEntity (net.minecraft.tileentity.TileEntity)3 EntityTieredRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket)2 ISchematicPage (micdoodle8.mods.galacticraft.api.recipe.ISchematicPage)2 BlockPos (net.minecraft.util.BlockPos)2 LinkedList (java.util.LinkedList)1 ISchematicResultPage (micdoodle8.mods.galacticraft.api.recipe.ISchematicResultPage)1 GuiCelestialSelection (micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection)1 GuiJoinSpaceRace (micdoodle8.mods.galacticraft.core.client.gui.screen.GuiJoinSpaceRace)1 GuiNewSpaceRace (micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace)1 GuiPreLaunchChecklist (micdoodle8.mods.galacticraft.core.client.gui.screen.GuiPreLaunchChecklist)1 EntityHangingSchematic (micdoodle8.mods.galacticraft.core.entities.EntityHangingSchematic)1 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)1 IMultiBlock (micdoodle8.mods.galacticraft.core.tile.IMultiBlock)1 TileEntityCargoLoader (micdoodle8.mods.galacticraft.core.tile.TileEntityCargoLoader)1 TileEntityCrafting (micdoodle8.mods.galacticraft.core.tile.TileEntityCrafting)1 TileEntityEnergyStorageModule (micdoodle8.mods.galacticraft.core.tile.TileEntityEnergyStorageModule)1 TileEntityFluidTank (micdoodle8.mods.galacticraft.core.tile.TileEntityFluidTank)1 ITileEntityProvider (net.minecraft.block.ITileEntityProvider)1 IBlockState (net.minecraft.block.state.IBlockState)1