Search in sources :

Example 1 with Vector3

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

the class RenderTier6Rocket method doRender.

@Override
public void doRender(EntityTier6Rocket entity, double x, double y, double z, float entityYaw, float partialTicks) {
    float rotationPitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks + 180;
    float rollAmplitude = entity.rollAmplitude / 3 - partialTicks;
    GlStateManager.disableRescaleNormal();
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x, (float) y + entity.getRenderOffsetY(), (float) z);
    GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-rotationPitch, 0.0F, 0.0F, 1.0F);
    if (rollAmplitude > 0.0F) {
        float i = entity.getLaunched() ? (5 - MathHelper.floor(entity.timeUntilLaunch / 85)) / 10F : 0.3F;
        GlStateManager.rotate(MathHelper.sin(rollAmplitude) * rollAmplitude * i * partialTicks, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(MathHelper.sin(rollAmplitude) * rollAmplitude * i * partialTicks, 1.0F, 0.0F, 1.0F);
    }
    this.updateModel();
    RenderHelper.disableStandardItemLighting();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(7425);
    } else {
        GlStateManager.shadeModel(7424);
    }
    GlStateManager.scale(-1.0F, -1.0F, 1.0F);
    GlStateManager.scale(0.8F, 0.8F, 0.8F);
    ClientUtil.drawBakedModel(this.rocketModel);
    Vector3 teamColor = ClientUtil.updateTeamColor(Minecraft.getMinecraft().player.getName(), true);
    if (teamColor != null) {
        GlStateManager.color(teamColor.floatX(), teamColor.floatY(), teamColor.floatZ());
    }
    if (Minecraft.getMinecraft().player.ticksExisted / 10 % 2 < 1) {
        GlStateManager.color(1, 0, 0);
    } else {
        GlStateManager.color(0, 1, 0);
    }
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.color(1, 1, 1);
    GlStateManager.popMatrix();
    RenderHelper.enableStandardItemLighting();
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 2 with Vector3

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

the class EntityTieredRocketMP method spawnParticles.

protected void spawnParticles(boolean launched) {
    if (!this.isDead) {
        double sinPitch = Math.sin(this.rotationPitch / Constants.RADIANS_TO_DEGREES_D);
        double x1 = 3.2 * Math.cos(this.rotationYaw / Constants.RADIANS_TO_DEGREES_D) * sinPitch;
        double z1 = 3.2 * Math.sin(this.rotationYaw / Constants.RADIANS_TO_DEGREES_D) * sinPitch;
        double y1 = 3.2 * Math.cos((this.rotationPitch - 180) / Constants.RADIANS_TO_DEGREES_D);
        if (this.launchPhase == EnumLaunchPhase.LANDING.ordinal() && this.targetVec != null) {
            double modifier = this.posY - this.targetVec.getY();
            modifier = Math.max(modifier, 180.0);
            x1 *= modifier / 200.0D;
            y1 *= Math.min(modifier / 200.0D, 2.5D);
            z1 *= modifier / 200.0D;
        }
        double y2 = this.prevPosY + (this.posY - this.prevPosY) + y1 - 0.75 * this.motionY - 0.3;
        double x2 = this.posX + x1 + this.motionX;
        double z2 = this.posZ + z1 + this.motionZ;
        Vector3 motionVec = new Vector3(x1 + this.motionX, y1 + this.motionY, z1 + this.motionZ);
        Vector3 d1 = new Vector3(y1 * 0.1D, -x1 * 0.1D, z1 * 0.1D).rotate(315 - this.rotationYaw, motionVec);
        Vector3 d2 = new Vector3(x1 * 0.1D, -z1 * 0.1D, y1 * 0.1D).rotate(315 - this.rotationYaw, motionVec);
        Vector3 d3 = new Vector3(-y1 * 0.1D, x1 * 0.1D, z1 * 0.1D).rotate(315 - this.rotationYaw, motionVec);
        Vector3 d4 = new Vector3(x1 * 0.1D, z1 * 0.1D, -y1 * 0.1D).rotate(315 - this.rotationYaw, motionVec);
        Vector3 mv1 = motionVec.clone().translate(d1);
        Vector3 mv2 = motionVec.clone().translate(d2);
        Vector3 mv3 = motionVec.clone().translate(d3);
        Vector3 mv4 = motionVec.clone().translate(d4);
        this.makeFlame(x2 + d1.x, y2 + d1.y, z2 + d1.z, mv1, this.getLaunched());
        this.makeFlame(x2 + d2.x, y2 + d2.y, z2 + d2.z, mv2, this.getLaunched());
        this.makeFlame(x2 + d3.x, y2 + d3.y, z2 + d3.z, mv3, this.getLaunched());
        this.makeFlame(x2 + d4.x, y2 + d4.y, z2 + d4.z, mv4, this.getLaunched());
    }
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 3 with Vector3

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

the class RenderTier5Rocket method doRender.

@Override
public void doRender(EntityTier5Rocket entity, double x, double y, double z, float entityYaw, float partialTicks) {
    float rotationPitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks + 180;
    float rollAmplitude = entity.rollAmplitude / 3 - partialTicks;
    GlStateManager.disableRescaleNormal();
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x, (float) y + entity.getRenderOffsetY(), (float) z);
    GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-rotationPitch, 0.0F, 0.0F, 1.0F);
    if (rollAmplitude > 0.0F) {
        float i = entity.getLaunched() ? (5 - MathHelper.floor(entity.timeUntilLaunch / 85)) / 10F : 0.3F;
        GlStateManager.rotate(MathHelper.sin(rollAmplitude) * rollAmplitude * i * partialTicks, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(MathHelper.sin(rollAmplitude) * rollAmplitude * i * partialTicks, 1.0F, 0.0F, 1.0F);
    }
    this.updateModel();
    RenderHelper.disableStandardItemLighting();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(7425);
    } else {
        GlStateManager.shadeModel(7424);
    }
    GlStateManager.scale(-1.0F, -1.0F, 1.0F);
    GlStateManager.scale(0.8F, 0.8F, 0.8F);
    ClientUtil.drawBakedModel(this.rocketModel);
    Vector3 teamColor = ClientUtil.updateTeamColor(Minecraft.getMinecraft().player.getName(), true);
    if (teamColor != null) {
        GlStateManager.color(teamColor.floatX(), teamColor.floatY(), teamColor.floatZ());
    }
    if (Minecraft.getMinecraft().player.ticksExisted / 10 % 2 < 1) {
        GlStateManager.color(1, 0, 0);
    } else {
        GlStateManager.color(0, 1, 0);
    }
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.color(1, 1, 1);
    GlStateManager.popMatrix();
    RenderHelper.enableStandardItemLighting();
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 4 with Vector3

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

the class RoomBossChalos 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.SPACE_DUNGEON_SPAWNER.getDefaultState().withProperty(BlockSpaceDungeonSpawner.PLANET, BlockSpaceDungeonSpawner.DungeonType.CHALOS), spawnerX, spawnerY, spawnerZ, boundingBox);
    BlockPos blockpos = new BlockPos(this.getXWithOffset(spawnerX, spawnerZ), this.getYWithOffset(spawnerY), this.getZWithOffset(spawnerX, spawnerZ));
    TileEntityChalosDungeonSpawner spawner = (TileEntityChalosDungeonSpawner) world.getTileEntity(blockpos);
    if (spawner == null) {
        spawner = new TileEntityChalosDungeonSpawner();
        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) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) TileEntityChalosDungeonSpawner(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosDungeonSpawner)

Example 5 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.SPACE_DUNGEON_SPAWNER.getDefaultState().withProperty(BlockSpaceDungeonSpawner.PLANET, BlockSpaceDungeonSpawner.DungeonType.NIBIRU), 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.module.planets.nibiru.tileentity.TileEntityNibiruDungeonSpawner) 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