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;
}
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);
}
}
}
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);
}
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);
}
}
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));
}
}
Aggregations