Search in sources :

Example 81 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project MorePlanets by SteveKunG.

the class RoomBossNibiru method addComponentParts.

@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox boundingBox) {
    for (int i = 0; i <= this.sizeX; i++) {
        for (int j = 0; j <= this.sizeY; j++) {
            for (int k = 0; k <= this.sizeZ; k++) {
                if (i == 0 || i == this.sizeX || j == 0 || k == 0 || k == this.sizeZ) {
                    boolean placeBlock = true;
                    if (this.getDirection().getAxis() == EnumFacing.Axis.Z) {
                        int start = (this.boundingBox.maxX - this.boundingBox.minX) / 2 - 1;
                        int end = (this.boundingBox.maxX - this.boundingBox.minX) / 2 + 1;
                        if (i > start && i <= end && j < 3 && j > 0) {
                            if (this.getDirection() == EnumFacing.SOUTH && k == 0) {
                                placeBlock = false;
                            } else if (this.getDirection() == EnumFacing.NORTH && k == this.sizeZ) {
                                placeBlock = false;
                            }
                        }
                    } else {
                        int start = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 - 1;
                        int end = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 + 1;
                        if (k > start && k <= end && j < 3 && j > 0) {
                            if (this.getDirection() == EnumFacing.EAST && i == 0) {
                                placeBlock = false;
                            } else if (this.getDirection() == EnumFacing.WEST && i == this.sizeX) {
                                placeBlock = false;
                            }
                        }
                    }
                    if (placeBlock) {
                        this.setBlockState(world, this.configuration.getBrickBlock(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                } else if (j == this.sizeY) {
                    if ((i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2) && rand.nextInt(4) == 0) {
                        this.setBlockState(world, this.configuration.getGlowstoneBlock(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, this.configuration.getBrickBlock(), i, j, k, boundingBox);
                    }
                } else if (j == 1 && (i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2)) {
                    if (rand.nextInt(4) == 0) {
                        this.setBlockState(world, this.configuration.getGlowstoneBlock(), i, j - 1, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                    this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                } else {
                    this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                }
            }
        }
    }
    int spawnerX = this.sizeX / 2;
    int spawnerY = 1;
    int spawnerZ = this.sizeZ / 2;
    this.setBlockState(world, MPBlocks.NIBIRU_DUNGEON_SPAWNER.getDefaultState(), spawnerX, spawnerY, spawnerZ, boundingBox);
    BlockPos blockpos = new BlockPos(this.getXWithOffset(spawnerX, spawnerZ), this.getYWithOffset(spawnerY), this.getZWithOffset(spawnerX, spawnerZ));
    TileEntityNibiruDungeonSpawner spawner = (TileEntityNibiruDungeonSpawner) world.getTileEntity(blockpos);
    if (spawner == null) {
        spawner = new TileEntityNibiruDungeonSpawner();
        world.setTileEntity(blockpos, spawner);
    }
    spawner.setRoom(new Vector3(this.boundingBox.minX + 1, this.boundingBox.minY + 1, this.boundingBox.minZ + 1), new Vector3(this.sizeX - 1, this.sizeY - 1, this.sizeZ - 1));
    spawner.setChestPos(this.chestPos);
    return true;
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) TileEntityNibiruDungeonSpawner(stevekung.mods.moreplanets.planets.nibiru.tileentity.TileEntityNibiruDungeonSpawner) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 82 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project MorePlanets by SteveKunG.

the class EntityKoentusMeteor method spawnParticles.

private void spawnParticles() {
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX, this.posY + 1D + Math.random(), this.posZ), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX + Math.random() / 2, this.posY + 1D + Math.random() / 2, this.posZ), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX, this.posY + 1D + Math.random(), this.posZ + Math.random()), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX - Math.random() / 2, this.posY + 1D + Math.random() / 2, this.posZ), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX, this.posY + 1D + Math.random(), this.posZ - Math.random()), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 83 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project MorePlanets by SteveKunG.

the class TeleportUtils method teleportPlayerToPlanet.

public static EntityPlayer teleportPlayerToPlanet(EntityPlayerMP player, MinecraftServer server, int sourceDim, int targetDim) {
    WorldServer sourceWorld = server.getWorld(sourceDim);
    WorldServer targetWorld = server.getWorld(targetDim);
    BlockPos spawnPos = targetWorld.getTopSolidOrLiquidBlock(targetWorld.getSpawnPoint());
    PlayerList playerList = server.getPlayerList();
    GCPlayerStats stats = GCPlayerStats.get(player);
    InventoryExtended inv = stats.getExtendedInventory();
    player.dimension = targetDim;
    player.connection.sendPacket(new SPacketRespawn(player.dimension, targetWorld.getDifficulty(), targetWorld.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
    playerList.updatePermissionLevel(player);
    sourceWorld.removeEntityDangerously(player);
    player.isDead = false;
    // world transfer
    player.setLocationAndAngles(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ(), player.rotationYaw, player.rotationPitch);
    player.connection.setPlayerLocation(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ(), player.rotationYaw, player.rotationPitch);
    targetWorld.spawnEntity(player);
    targetWorld.updateEntityWithOptionalForce(player, false);
    player.setWorld(targetWorld);
    // prevent kicked from LAN or server world
    MorePlanetsMod.PROXY.resetFloatingTick(player);
    playerList.preparePlayer(player, sourceWorld);
    player.connection.setPlayerLocation(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ(), player.rotationYaw, player.rotationPitch);
    player.interactionManager.setWorld(targetWorld);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
    playerList.updateTimeAndWeatherForPlayer(player, targetWorld);
    playerList.syncPlayerInventory(player);
    if (targetWorld.provider instanceof IStartedDimension) {
        IStartedDimension dimension = (IStartedDimension) targetWorld.provider;
        LoggerMP.info("Setting up survival player gear");
        dimension.setup(player);
    } else if (targetWorld.provider instanceof WorldProviderMoon) {
        LoggerMP.info("Setting up default survival player gear for Moon");
        inv.setInventorySlotContents(0, new ItemStack(GCItems.oxMask));
        inv.setInventorySlotContents(1, new ItemStack(GCItems.oxygenGear));
        inv.setInventorySlotContents(2, new ItemStack(GCItems.oxTankMedium));
        inv.setInventorySlotContents(3, new ItemStack(GCItems.oxTankMedium));
        inv.setInventorySlotContents(4, new ItemStack(GCItems.parachute));
        inv.setInventorySlotContents(5, new ItemStack(GCItems.basicItem, 1, 19));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.LOG, 32 + player.world.rand.nextInt(32)));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.COBBLESTONE, 32 + player.world.rand.nextInt(32)));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.DIRT, 16));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.SAPLING, 8 + player.world.rand.nextInt(8)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.IRON_INGOT, 32 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WHEAT_SEEDS, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.POTATO, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.CARROT, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET));
        player.inventory.addItemStackToInventory(new ItemStack(GCBlocks.landingPad, 9));
        ItemStack rocket = new ItemStack(GCItems.rocketTier1);
        rocket.setTagCompound(new NBTTagCompound());
        rocket.getTagCompound().setInteger("RocketFuel", 1000);
        player.inventory.addItemStackToInventory(rocket);
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
    } else if (targetWorld.provider instanceof WorldProviderMars) {
        LoggerMP.info("Setting up default survival player gear for Mars");
        // Knows how to build T2 rocket
        SchematicRegistry.unlockNewPage(player, new ItemStack(GCItems.schematic, 1, 1));
        inv.setInventorySlotContents(0, new ItemStack(GCItems.oxMask));
        inv.setInventorySlotContents(1, new ItemStack(GCItems.oxygenGear));
        inv.setInventorySlotContents(2, new ItemStack(GCItems.oxTankMedium));
        inv.setInventorySlotContents(3, new ItemStack(GCItems.oxTankMedium));
        inv.setInventorySlotContents(4, new ItemStack(GCItems.parachute));
        inv.setInventorySlotContents(5, new ItemStack(GCItems.basicItem, 1, 19));
        inv.setInventorySlotContents(6, new ItemStack(AsteroidsItems.thermalPadding));
        inv.setInventorySlotContents(7, new ItemStack(AsteroidsItems.thermalPadding, 1, 1));
        inv.setInventorySlotContents(8, new ItemStack(AsteroidsItems.thermalPadding, 1, 2));
        inv.setInventorySlotContents(9, new ItemStack(AsteroidsItems.thermalPadding, 1, 3));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.LOG, 32 + player.world.rand.nextInt(32)));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.COBBLESTONE, 32 + player.world.rand.nextInt(32)));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.DIRT, 16));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.SAPLING, 8 + player.world.rand.nextInt(8)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.IRON_INGOT, 32 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WHEAT_SEEDS, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.POTATO, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.CARROT, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET));
        player.inventory.addItemStackToInventory(new ItemStack(GCBlocks.landingPad, 9));
        ItemStack rocket = new ItemStack(MarsItems.rocketMars);
        rocket.setTagCompound(new NBTTagCompound());
        rocket.getTagCompound().setInteger("RocketFuel", 1000);
        player.inventory.addItemStackToInventory(rocket);
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
    } else if (targetWorld.provider instanceof WorldProviderVenus) {
        LoggerMP.info("Setting up default survival player gear for Venus");
        // Knows how to build T2 rocket
        SchematicRegistry.unlockNewPage(player, new ItemStack(GCItems.schematic, 1, 1));
        // Knows how to build T3 rocket
        SchematicRegistry.unlockNewPage(player, new ItemStack(MarsItems.schematic, 1, 0));
        inv.setInventorySlotContents(0, new ItemStack(GCItems.oxMask));
        inv.setInventorySlotContents(1, new ItemStack(GCItems.oxygenGear));
        inv.setInventorySlotContents(2, new ItemStack(GCItems.oxTankHeavy));
        inv.setInventorySlotContents(3, new ItemStack(GCItems.oxTankHeavy));
        inv.setInventorySlotContents(4, new ItemStack(GCItems.parachute));
        inv.setInventorySlotContents(5, new ItemStack(GCItems.basicItem, 1, 19));
        inv.setInventorySlotContents(6, new ItemStack(VenusItems.thermalPaddingTier2));
        inv.setInventorySlotContents(7, new ItemStack(VenusItems.thermalPaddingTier2, 1, 1));
        inv.setInventorySlotContents(8, new ItemStack(VenusItems.thermalPaddingTier2, 1, 2));
        inv.setInventorySlotContents(9, new ItemStack(VenusItems.thermalPaddingTier2, 1, 3));
        inv.setInventorySlotContents(10, new ItemStack(VenusItems.basicItem));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.LOG, 32 + player.world.rand.nextInt(32)));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.COBBLESTONE, 32 + player.world.rand.nextInt(32)));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.DIRT, 16));
        player.inventory.addItemStackToInventory(new ItemStack(Blocks.SAPLING, 8 + player.world.rand.nextInt(8)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.IRON_INGOT, 32 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WHEAT_SEEDS, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.POTATO, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.CARROT, 16 + player.world.rand.nextInt(16)));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET));
        player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET));
        player.inventory.addItemStackToInventory(new ItemStack(GCBlocks.landingPad, 9));
        ItemStack rocket = new ItemStack(AsteroidsItems.tier3Rocket);
        rocket.setTagCompound(new NBTTagCompound());
        rocket.getTagCompound().setInteger("RocketFuel", 1000);
        player.inventory.addItemStackToInventory(rocket);
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
    } else if (targetWorld.provider instanceof WorldProviderAsteroids) {
        LoggerMP.info("Setting up default survival player gear for Asteroids");
        ITeleportType type = GalacticraftRegistry.getTeleportTypeForDimension(targetWorld.provider.getClass());
        Vector3 spawnPosVec = type.getPlayerSpawnLocation(targetWorld, player);
        ChunkPos pair = targetWorld.getChunk(spawnPosVec.intX() >> 4, spawnPosVec.intZ() >> 4).getPos();
        player.setLocationAndAngles(spawnPosVec.x, spawnPosVec.y, spawnPosVec.z, player.rotationYaw, player.rotationPitch);
        player.setSpawnChunk(new BlockPos(spawnPosVec.intX(), spawnPosVec.intY(), spawnPosVec.intZ()), true, GCCoreUtil.getDimensionID(targetWorld));
        targetWorld.getChunkProvider().loadChunk(pair.x, pair.z);
        type.setupAdventureSpawn(player);
        type.onSpaceDimensionChanged(targetWorld, player, false);
    } else {
        LoggerMP.info("Setting up default survival player gear for Non-IStartedDimension world");
        // Knows how to build T2 rocket
        SchematicRegistry.unlockNewPage(player, new ItemStack(GCItems.schematic, 1, 1));
        // Knows how to build T3 rocket
        SchematicRegistry.unlockNewPage(player, new ItemStack(MarsItems.schematic, 1, 0));
        inv.setInventorySlotContents(0, new ItemStack(GCItems.oxMask));
        inv.setInventorySlotContents(1, new ItemStack(GCItems.oxygenGear));
        inv.setInventorySlotContents(2, new ItemStack(GCItems.oxTankHeavy));
        inv.setInventorySlotContents(3, new ItemStack(GCItems.oxTankHeavy));
        inv.setInventorySlotContents(5, new ItemStack(GCItems.basicItem, 1, 19));
        inv.setInventorySlotContents(6, new ItemStack(AsteroidsItems.thermalPadding));
        inv.setInventorySlotContents(7, new ItemStack(AsteroidsItems.thermalPadding, 1, 1));
        inv.setInventorySlotContents(8, new ItemStack(AsteroidsItems.thermalPadding, 1, 2));
        inv.setInventorySlotContents(9, new ItemStack(AsteroidsItems.thermalPadding, 1, 3));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
    }
    player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 15 * 20, 5));
    player.getActivePotionEffects().forEach(potion -> player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potion)));
    player.connection.sendPacket(new SPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
    player.connection.sendPacket(new SPacketSpawnPosition(spawnPos));
    AttributeMap attributemap = (AttributeMap) player.getAttributeMap();
    Collection<IAttributeInstance> watchedAttribs = attributemap.getWatchedAttributes();
    if (!watchedAttribs.isEmpty()) {
        player.connection.sendPacket(new SPacketEntityProperties(player.getEntityId(), watchedAttribs));
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, sourceDim, targetDim);
    if (!(targetWorld.provider instanceof WorldProviderAsteroids)) {
        player.setLocationAndAngles(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ(), player.rotationYaw, player.rotationPitch);
        player.setSpawnChunk(spawnPos, true, GCCoreUtil.getDimensionID(player.world));
    }
    if (!(targetWorld.provider instanceof WorldProviderAsteroids) && player.onGround && player.getBedLocation(GCCoreUtil.getDimensionID(player.world)) == null) {
        int i = 30000000;
        int x = Math.min(i, Math.max(-i, MathHelper.floor(player.posX + 0.5D)));
        int y = Math.min(256, Math.max(0, MathHelper.floor(player.posY + 1.5D)));
        int z = Math.min(i, Math.max(-i, MathHelper.floor(player.posZ + 0.5D)));
        BlockPos spawnChunkPos = targetWorld.getTopSolidOrLiquidBlock(new BlockPos(x, y, z));
        player.setSpawnChunk(spawnChunkPos, true, GCCoreUtil.getDimensionID(player.world));
    }
    GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMP(EnumSimplePacketMP.C_RELOAD_RENDERER, player.dimension), player);
    GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMP(EnumSimplePacketMP.C_MESSAGE_SURVIVAL_PLANET, player.dimension, new Object[] { WorldUtil.getProviderForDimensionServer(targetDim).getDimensionType().getName() }), player);
    return player;
}
Also used : InventoryExtended(micdoodle8.mods.galacticraft.core.inventory.InventoryExtended) WorldProviderMars(micdoodle8.mods.galacticraft.planets.mars.dimension.WorldProviderMars) PlayerList(net.minecraft.server.management.PlayerList) PotionEffect(net.minecraft.potion.PotionEffect) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IAttributeInstance(net.minecraft.entity.ai.attributes.IAttributeInstance) WorldServer(net.minecraft.world.WorldServer) WorldProviderAsteroids(micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids) WorldProviderMoon(micdoodle8.mods.galacticraft.core.dimension.WorldProviderMoon) BlockPos(net.minecraft.util.math.BlockPos) ChunkPos(net.minecraft.util.math.ChunkPos) PacketSimpleMP(stevekung.mods.moreplanets.network.PacketSimpleMP) ITeleportType(micdoodle8.mods.galacticraft.api.world.ITeleportType) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) IStartedDimension(stevekung.mods.moreplanets.world.IStartedDimension) AttributeMap(net.minecraft.entity.ai.attributes.AttributeMap) ItemStack(net.minecraft.item.ItemStack) WorldProviderVenus(micdoodle8.mods.galacticraft.planets.venus.dimension.WorldProviderVenus)

Example 84 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project MorePlanets by SteveKunG.

the class RoomBossDiona method addComponentParts.

@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox boundingBox) {
    for (int i = 0; i <= this.sizeX; i++) {
        for (int j = 0; j <= this.sizeY; j++) {
            for (int k = 0; k <= this.sizeZ; k++) {
                if (i == 0 || i == this.sizeX || j == 0 || k == 0 || k == this.sizeZ) {
                    boolean placeBlock = true;
                    if (this.getDirection().getAxis() == EnumFacing.Axis.Z) {
                        int start = (this.boundingBox.maxX - this.boundingBox.minX) / 2 - 1;
                        int end = (this.boundingBox.maxX - this.boundingBox.minX) / 2 + 1;
                        if (i > start && i <= end && j < 3 && j > 0) {
                            if (this.getDirection() == EnumFacing.SOUTH && k == 0) {
                                placeBlock = false;
                            } else if (this.getDirection() == EnumFacing.NORTH && k == this.sizeZ) {
                                placeBlock = false;
                            }
                        }
                    } else {
                        int start = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 - 1;
                        int end = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 + 1;
                        if (k > start && k <= end && j < 3 && j > 0) {
                            if (this.getDirection() == EnumFacing.EAST && i == 0) {
                                placeBlock = false;
                            } else if (this.getDirection() == EnumFacing.WEST && i == this.sizeX) {
                                placeBlock = false;
                            }
                        }
                    }
                    if (placeBlock) {
                        this.setBlockState(world, this.configuration.getBrickBlock(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                } else if (j == this.sizeY) {
                    if ((i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2) && rand.nextInt(4) == 0) {
                        this.setBlockState(world, this.configuration.getGlowstoneBlock(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, this.configuration.getBrickBlock(), i, j, k, boundingBox);
                    }
                } else if (j == 1 && (i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2)) {
                    if (rand.nextInt(4) == 0) {
                        this.setBlockState(world, this.configuration.getGlowstoneBlock(), i, j - 1, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                    if (rand.nextInt(6) == 0) {
                        this.setBlockState(world, MPBlocks.ZELIUS_EGG.getDefaultState(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                } else {
                    this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                }
            }
        }
    }
    int spawnerX = this.sizeX / 2;
    int spawnerY = 1;
    int spawnerZ = this.sizeZ / 2;
    this.setBlockState(world, MPBlocks.DIONA_DUNGEON_SPAWNER.getDefaultState(), spawnerX, spawnerY, spawnerZ, boundingBox);
    BlockPos blockpos = new BlockPos(this.getXWithOffset(spawnerX, spawnerZ), this.getYWithOffset(spawnerY), this.getZWithOffset(spawnerX, spawnerZ));
    TileEntityDionaDungeonSpawner spawner = (TileEntityDionaDungeonSpawner) world.getTileEntity(blockpos);
    if (spawner == null) {
        spawner = new TileEntityDionaDungeonSpawner();
        world.setTileEntity(blockpos, spawner);
    }
    spawner.setRoom(new Vector3(this.boundingBox.minX + 1, this.boundingBox.minY + 1, this.boundingBox.minZ + 1), new Vector3(this.sizeX - 1, this.sizeY - 1, this.sizeZ - 1));
    spawner.setChestPos(this.chestPos);
    return true;
}
Also used : TileEntityDionaDungeonSpawner(stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDionaDungeonSpawner) BlockPos(net.minecraft.util.math.BlockPos) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Aggregations

Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)79 BlockPos (net.minecraft.util.BlockPos)13 Entity (net.minecraft.entity.Entity)12 TileEntity (net.minecraft.tileentity.TileEntity)11 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)9 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)8 EntityPlayer (net.minecraft.entity.player.EntityPlayer)8 ItemStack (net.minecraft.item.ItemStack)7 BlockPos (net.minecraft.util.math.BlockPos)7 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)6 IBlockState (net.minecraft.block.state.IBlockState)6 EntityLivingBase (net.minecraft.entity.EntityLivingBase)6 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)6 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)6 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)5 WorldServer (net.minecraft.world.WorldServer)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)4 FlagData (micdoodle8.mods.galacticraft.core.wrappers.FlagData)4 GameProfile (com.mojang.authlib.GameProfile)3