Search in sources :

Example 6 with Vector3

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

the class MarsModuleClient method spawnParticle.

@Override
public void spawnParticle(String particleID, Vector3 position, Vector3 motion, Object... extraData) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    if (mc != null && mc.getRenderViewEntity() != null && mc.effectRenderer != null) {
        final double dPosX = mc.getRenderViewEntity().posX - position.x;
        final double dPosY = mc.getRenderViewEntity().posY - position.y;
        final double dPosZ = mc.getRenderViewEntity().posZ - position.z;
        EntityFX particle = null;
        final double maxDistSqrd = 64.0D;
        if (dPosX * dPosX + dPosY * dPosY + dPosZ * dPosZ < maxDistSqrd * maxDistSqrd) {
            if (particleID.equals("sludgeDrip")) {
            // particle = new EntityDropParticleFX(mc.theWorld, position.x, position.y, position.z, Material.water); TODO
            } else if (particleID.equals("bacterialDrip")) {
                particle = new EntityBacterialDripFX(mc.theWorld, position.x, position.y, position.z);
            }
        }
        if (particle != null) {
            particle.prevPosX = particle.posX;
            particle.prevPosY = particle.posY;
            particle.prevPosZ = particle.posZ;
            mc.effectRenderer.addEffect(particle);
        }
    }
}
Also used : EntityBacterialDripFX(micdoodle8.mods.galacticraft.planets.mars.client.fx.EntityBacterialDripFX) EntityFX(net.minecraft.client.particle.EntityFX) Minecraft(net.minecraft.client.Minecraft)

Example 7 with Vector3

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

the class BlockMachineMarsT2 method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
    final TileEntity te = worldIn.getTileEntity(pos);
    if (te instanceof TileEntityGasLiquefier) {
        final TileEntityGasLiquefier tileEntity = (TileEntityGasLiquefier) te;
        if (tileEntity.processTicks > 0) {
            final float x = pos.getX() + 0.5F;
            final float y = pos.getY() + 0.8F + 0.05F * rand.nextInt(3);
            final float z = pos.getZ() + 0.5F;
            for (float i = -0.41F + 0.16F * rand.nextFloat(); i < 0.5F; i += 0.167F) {
                if (rand.nextInt(3) == 0) {
                    GalacticraftCore.proxy.spawnParticle("whiteSmokeTiny", new Vector3(x + i, y, z - 0.41F), new Vector3(0.0D, -0.015D, -0.0015D), new Object[] {});
                }
                if (rand.nextInt(3) == 0) {
                    GalacticraftCore.proxy.spawnParticle("whiteSmokeTiny", new Vector3(x + i, y, z + 0.537F), new Vector3(0.0D, -0.015D, 0.0015D), new Object[] {});
                }
                if (rand.nextInt(3) == 0) {
                    GalacticraftCore.proxy.spawnParticle("whiteSmokeTiny", new Vector3(x - 0.41F, y, z + i), new Vector3(-0.0015D, -0.015D, 0.0D), new Object[] {});
                }
                if (rand.nextInt(3) == 0) {
                    GalacticraftCore.proxy.spawnParticle("whiteSmokeTiny", new Vector3(x + 0.537F, y, z + i), new Vector3(0.0015D, -0.015D, 0.0D), new Object[] {});
                }
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityGasLiquefier(micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityGasLiquefier) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with Vector3

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

the class BlockMachineMars method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
    if (state.getValue(TYPE) == EnumMachineType.CRYOGENIC_CHAMBER) {
        GalacticraftPlanets.spawnParticle("cryoFreeze", new Vector3(pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY(), pos.getZ() + 0.3 + rand.nextDouble() * 0.4), new Vector3(0.0, 0.05 + rand.nextDouble() * 0.01, 0.0));
        GalacticraftPlanets.spawnParticle("cryoFreeze", new Vector3(pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY(), pos.getZ() + 0.3 + rand.nextDouble() * 0.4), new Vector3(0.0, 0.05 + rand.nextDouble() * 0.01, 0.0));
        GalacticraftPlanets.spawnParticle("cryoFreeze", new Vector3(pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY(), pos.getZ() + 0.3 + rand.nextDouble() * 0.4), new Vector3(0.0, 0.05 + rand.nextDouble() * 0.01, 0.0));
        GalacticraftPlanets.spawnParticle("cryoFreeze", new Vector3(pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY() + 2.9F, pos.getZ() + 0.3 + rand.nextDouble() * 0.4), new Vector3(0.0, -0.05 - rand.nextDouble() * 0.01, 0.0));
        GalacticraftPlanets.spawnParticle("cryoFreeze", new Vector3(pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY() + 2.9F, pos.getZ() + 0.3 + rand.nextDouble() * 0.4), new Vector3(0.0, -0.05 - rand.nextDouble() * 0.01, 0.0));
        GalacticraftPlanets.spawnParticle("cryoFreeze", new Vector3(pos.getX() + 0.3 + rand.nextDouble() * 0.4, pos.getY() + 2.9F, pos.getZ() + 0.3 + rand.nextDouble() * 0.4), new Vector3(0.0, -0.05 - rand.nextDouble() * 0.01, 0.0));
    }
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 9 with Vector3

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

the class VenusModuleClient method spawnParticle.

@Override
public void spawnParticle(String particleID, Vector3 position, Vector3 motion, Object... extraData) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    if (mc != null && mc.getRenderViewEntity() != null && mc.effectRenderer != null) {
        double dX = mc.getRenderViewEntity().posX - position.x;
        double dY = mc.getRenderViewEntity().posY - position.y;
        double dZ = mc.getRenderViewEntity().posZ - position.z;
        EntityFX particle = null;
        double viewDistance = 64.0D;
        if (particleID.equals("acidVapor")) {
            particle = new EntityAcidVaporFX(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 2.5F);
        }
        if (dX * dX + dY * dY + dZ * dZ < viewDistance * viewDistance) {
            if (particleID.equals("acidExhaust")) {
                particle = new EntityAcidExhaustFX(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 0.5F);
            }
        }
        if (particle != null) {
            particle.prevPosX = particle.posX;
            particle.prevPosY = particle.posY;
            particle.prevPosZ = particle.posZ;
            mc.effectRenderer.addEffect(particle);
        }
    }
}
Also used : EntityAcidVaporFX(micdoodle8.mods.galacticraft.planets.venus.client.fx.EntityAcidVaporFX) EntityFX(net.minecraft.client.particle.EntityFX) Minecraft(net.minecraft.client.Minecraft) EntityAcidExhaustFX(micdoodle8.mods.galacticraft.planets.venus.client.fx.EntityAcidExhaustFX)

Example 10 with Vector3

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

the class RoomBossMars method addComponentParts.

@Override
public boolean addComponentParts(World worldIn, Random random, StructureBoundingBox chunkBox) {
    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 (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 (getDirection() == EnumFacing.SOUTH && k == 0) {
                                placeBlock = false;
                            } else if (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 (getDirection() == EnumFacing.EAST && i == 0) {
                                placeBlock = false;
                            } else if (getDirection() == EnumFacing.WEST && i == this.sizeX) {
                                placeBlock = false;
                            }
                        }
                    }
                    if (placeBlock) {
                        this.setBlockState(worldIn, this.configuration.getBrickBlock(), i, j, k, chunkBox);
                    } else {
                        this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, chunkBox);
                    }
                } else if (j == this.sizeY) {
                    if ((i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2) && random.nextInt(4) == 0) {
                        this.setBlockState(worldIn, Blocks.glowstone.getDefaultState(), i, j, k, chunkBox);
                    } else {
                        this.setBlockState(worldIn, this.configuration.getBrickBlock(), i, j, k, chunkBox);
                    }
                } else if (j == 1 && (i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2) && random.nextInt(6) == 0) {
                    this.setBlockState(worldIn, MarsBlocks.creeperEgg.getDefaultState(), i, j, k, chunkBox);
                } else {
                    this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, chunkBox);
                }
            }
        }
    }
    int spawnerX = this.sizeX / 2;
    int spawnerY = 1;
    int spawnerZ = this.sizeZ / 2;
    BlockPos blockpos = new BlockPos(this.getXWithOffset(spawnerX, spawnerZ), this.getYWithOffset(spawnerY), this.getZWithOffset(spawnerX, spawnerZ));
    // Is this position inside the chunk currently being generated?
    if (chunkBox.isVecInside(blockpos)) {
        worldIn.setBlockState(blockpos, MarsBlocks.bossSpawner.getDefaultState(), 2);
        TileEntityDungeonSpawner spawner = (TileEntityDungeonSpawner) worldIn.getTileEntity(blockpos);
        if (spawner != null) {
            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));
        }
    }
    return true;
}
Also used : BlockPos(net.minecraft.util.BlockPos) TileEntityDungeonSpawner(micdoodle8.mods.galacticraft.core.tile.TileEntityDungeonSpawner) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Aggregations

Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)74 BlockPos (net.minecraft.util.BlockPos)13 Entity (net.minecraft.entity.Entity)12 TileEntity (net.minecraft.tileentity.TileEntity)11 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)8 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)8 EntityPlayer (net.minecraft.entity.player.EntityPlayer)8 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 ItemStack (net.minecraft.item.ItemStack)6 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)4 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)4 FlagData (micdoodle8.mods.galacticraft.core.wrappers.FlagData)4 WorldServer (net.minecraft.world.WorldServer)4 GameProfile (com.mojang.authlib.GameProfile)3