Search in sources :

Example 46 with Vector3

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

the class TeleportTypeVenus method getPlayerSpawnLocation.

@Override
public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) {
    if (player != null) {
        GCPlayerStats stats = GCPlayerStats.get(player);
        double x = stats.getCoordsTeleportedFromX();
        double z = stats.getCoordsTeleportedFromZ();
        int limit = ConfigManagerCore.otherPlanetWorldBorders - 2;
        if (limit > 20) {
            if (x > limit) {
                z *= limit / x;
                x = limit;
            } else if (x < -limit) {
                z *= -limit / x;
                x = -limit;
            }
            if (z > limit) {
                x *= limit / z;
                z = limit;
            } else if (z < -limit) {
                x *= -limit / z;
                z = -limit;
            }
        }
        return new Vector3(x, 900.0, z);
    }
    return null;
}
Also used : GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 47 with Vector3

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

the class EffectHandler method spawnParticle.

public static void spawnParticle(String particleID, Vector3 position, Vector3 motion, Object... otherInfo) {
    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("whiteSmokeIdle")) {
            particle = new EntityFXLaunchSmoke(mc.theWorld, position, motion, 1.0F, false);
        } else if (particleID.equals("whiteSmokeLaunched")) {
            particle = new EntityFXLaunchSmoke(mc.theWorld, position, motion, 1.0F, true);
        } else if (particleID.equals("whiteSmokeLargeIdle")) {
            particle = new EntityFXLaunchSmoke(mc.theWorld, position, motion, 2.5F, false);
        } else if (particleID.equals("whiteSmokeLargeLaunched")) {
            particle = new EntityFXLaunchSmoke(mc.theWorld, position, motion, 2.5F, true);
        } else if (particleID.equals("launchFlameIdle")) {
            particle = new EntityFXLaunchFlame(mc.theWorld, position, motion, false, (EntityLivingBase) otherInfo[0]);
        } else if (particleID.equals("launchFlameLaunched")) {
            particle = new EntityFXLaunchFlame(mc.theWorld, position, motion, true, (EntityLivingBase) otherInfo[0]);
        } else if (particleID.equals("whiteSmokeTiny")) {
            particle = new EntityFXSmokeSmall(mc.theWorld, position, motion);
        } else if (particleID.equals("oilDrip")) {
            particle = new EntityFXOilDrip(mc.theWorld, position.x, position.y, position.z);
        }
        if (dX * dX + dY * dY + dZ * dZ < viewDistance * viewDistance) {
            if (particleID.equals("oxygen")) {
                particle = new EntityFXEntityOxygen(mc.theWorld, position, motion, (Vector3) otherInfo[0]);
            }
        }
        if (particle != null) {
            particle.prevPosX = particle.posX;
            particle.prevPosY = particle.posY;
            particle.prevPosZ = particle.posZ;
            mc.effectRenderer.addEffect(particle);
        }
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) EntityFX(net.minecraft.client.particle.EntityFX) Minecraft(net.minecraft.client.Minecraft)

Example 48 with Vector3

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

the class BlockTransmitter method addCollisionBoxesToList.

@Override
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
    Vector3 minVector = this.getMinVector(state);
    Vector3 maxVector = this.getMaxVector(state);
    this.setBlockBounds((float) minVector.x, (float) minVector.y, (float) minVector.z, (float) maxVector.x, (float) maxVector.y, (float) maxVector.z);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    TileEntity tileEntity = worldIn.getTileEntity(pos);
    if (tileEntity instanceof ITransmitter) {
        TileEntity[] connectable;
        switch(this.getNetworkType(state)) {
            case FLUID:
                connectable = OxygenUtil.getAdjacentFluidConnections(tileEntity);
                break;
            case POWER:
                connectable = EnergyUtil.getAdjacentPowerConnections(tileEntity);
                break;
            default:
                connectable = new TileEntity[6];
        }
        if (connectable[4] != null) {
            this.setBlockBounds(0, (float) minVector.y, (float) minVector.z, (float) maxVector.x, (float) maxVector.y, (float) maxVector.z);
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
        }
        if (connectable[5] != null) {
            this.setBlockBounds((float) minVector.x, (float) minVector.y, (float) minVector.z, 1, (float) maxVector.y, (float) maxVector.z);
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
        }
        if (connectable[0] != null) {
            this.setBlockBounds((float) minVector.x, 0, (float) minVector.z, (float) maxVector.x, (float) maxVector.y, (float) maxVector.z);
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
        }
        if (connectable[1] != null) {
            this.setBlockBounds((float) minVector.x, (float) minVector.y, (float) minVector.z, (float) maxVector.x, 1, (float) maxVector.z);
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
        }
        if (connectable[2] != null) {
            this.setBlockBounds((float) minVector.x, (float) minVector.y, 0, (float) maxVector.x, (float) maxVector.y, (float) maxVector.z);
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
        }
        if (connectable[3] != null) {
            this.setBlockBounds((float) minVector.x, (float) minVector.y, (float) minVector.z, (float) maxVector.x, (float) maxVector.y, 1);
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
        }
    }
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ITransmitter(micdoodle8.mods.galacticraft.api.transmission.tile.ITransmitter) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 49 with Vector3

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

the class BlockTransmitter method setBlockBoundsBasedOnState.

/**
 * Returns the bounding box of the wired rectangular prism to render.
 */
@Override
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
    TileEntity tileEntity = worldIn.getTileEntity(pos);
    IBlockState bs = worldIn.getBlockState(pos);
    if (tileEntity instanceof ITransmitter && bs.getBlock() instanceof BlockTransmitter) {
        Vector3 minVector = this.getMinVector(bs);
        Vector3 maxVector = this.getMaxVector(bs);
        TileEntity[] connectable = new TileEntity[6];
        switch(this.getNetworkType(bs)) {
            case FLUID:
                connectable = OxygenUtil.getAdjacentFluidConnections(tileEntity);
                break;
            case POWER:
                connectable = EnergyUtil.getAdjacentPowerConnections(tileEntity);
                break;
            default:
                break;
        }
        float minX = (float) minVector.x;
        float minY = (float) minVector.y;
        float minZ = (float) minVector.z;
        float maxX = (float) maxVector.x;
        float maxY = (float) maxVector.y;
        float maxZ = (float) maxVector.z;
        if (connectable[0] != null) {
            minY = 0.0F;
        }
        if (connectable[1] != null) {
            maxY = 1.0F;
        }
        if (connectable[2] != null) {
            minZ = 0.0F;
        }
        if (connectable[3] != null) {
            maxZ = 1.0F;
        }
        if (connectable[4] != null) {
            minX = 0.0F;
        }
        if (connectable[5] != null) {
            maxX = 1.0F;
        }
        this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IBlockState(net.minecraft.block.state.IBlockState) ITransmitter(micdoodle8.mods.galacticraft.api.transmission.tile.ITransmitter) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 50 with Vector3

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

the class EntityAdvancedMotion method spawnParticles.

@SideOnly(Side.CLIENT)
public void spawnParticles(Map<Vector3, Vector3> points) {
    for (final Entry<Vector3, Vector3> vec : points.entrySet()) {
        final Vector3 posVec = vec.getKey();
        final Vector3 motionVec = vec.getValue();
        this.spawnParticle(this.getParticle(this.rand, posVec.x, posVec.y, posVec.z, motionVec.x, motionVec.y, motionVec.z));
    }
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

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