use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class TileEntityGeothermalGenerator method update.
@Override
public void update() {
if (!this.worldObj.isRemote) {
this.receiveEnergyGC(null, this.generateWatts, false);
}
super.update();
if (this.ticks % 20 == 0) {
BlockPos below = this.getPos().down();
IBlockState stateBelow = this.worldObj.getBlockState(below);
boolean lastValidSpout = this.validSpout;
this.validSpout = false;
if (stateBelow.getBlock() == VenusBlocks.spout) {
BlockPos pos1 = below.down();
for (; this.getPos().getY() - pos1.getY() < 20; pos1 = pos1.down()) {
IBlockState state = this.worldObj.getBlockState(pos1);
if (state.getBlock() == VenusModule.sulphuricAcid.getBlock()) {
this.validSpout = true;
break;
} else if (!state.getBlock().isAir(this.worldObj, pos1)) {
// Not valid
break;
}
}
}
if (this.worldObj.isRemote && this.validSpout != lastValidSpout) {
// Update active texture
this.worldObj.markBlockForUpdate(this.getPos());
}
}
if (!this.worldObj.isRemote) {
this.recharge(this.containingItems[0]);
if (this.disableCooldown > 0) {
this.disableCooldown--;
}
this.generateWatts = Math.min(Math.max(this.getGenerate(), 0), TileEntityGeothermalGenerator.MAX_GENERATE_GJ_PER_TICK);
} else {
if (this.generateWatts > 0 && this.ticks % ((int) ((float) MAX_GENERATE_GJ_PER_TICK / (this.generateWatts + 1)) * 5 + 1) == 0) {
double posX = pos.getX() + 0.5;
double posY = pos.getY() + 1.0;
double posZ = pos.getZ() + 0.5;
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX - 0.25, posY, posZ - 0.25), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX - 0.25, posY, posZ), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX - 0.25, posY, posZ + 0.25), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX, posY, posZ - 0.25), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX, posY, posZ), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX, posY, posZ + 0.25), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX + 0.25, posY, posZ - 0.25), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX + 0.25, posY, posZ), new Vector3(0.0, 0.025, 0.0));
GalacticraftPlanets.spawnParticle("acidExhaust", new Vector3(posX + 0.25, posY, posZ + 0.25), new Vector3(0.0, 0.025, 0.0));
}
}
this.produce();
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class PacketSimpleAsteroids method handleClientSide.
@SideOnly(Side.CLIENT)
@Override
public void handleClientSide(EntityPlayer player) {
EntityPlayerSP playerBaseClient = null;
if (player instanceof EntityPlayerSP) {
playerBaseClient = (EntityPlayerSP) player;
}
TileEntity tile;
switch(this.type) {
case C_TELEPAD_SEND:
Entity entity = playerBaseClient.worldObj.getEntityByID((Integer) this.data.get(1));
if (entity != null && entity instanceof EntityLivingBase) {
BlockVec3 pos = (BlockVec3) this.data.get(0);
entity.setPosition(pos.x + 0.5, pos.y + 2.2, pos.z + 0.5);
}
break;
case C_UPDATE_GRAPPLE_POS:
entity = playerBaseClient.worldObj.getEntityByID((Integer) this.data.get(0));
if (entity != null && entity instanceof EntityGrapple) {
Vector3 vec = (Vector3) this.data.get(1);
entity.setPosition(vec.x, vec.y, vec.z);
}
break;
default:
break;
}
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class TileEntityBeamReflector method getInputPoint.
// @Override
// public void update()
// {
// super.update();
// }
@Override
public Vector3 getInputPoint() {
float distance = 0.15F;
Vector3 deviation = new Vector3(Math.sin(Math.toRadians(this.yaw - 180)) * distance, 0, Math.cos(Math.toRadians(this.yaw - 180)) * distance);
Vector3 headVec = new Vector3(this.getPos().getX() + 0.5, this.getPos().getY() + 1.13228 / 2.0, this.getPos().getZ() + 0.5);
headVec.translate(deviation.clone().invert());
return headVec;
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class TileEntityBeamOutput method updateOrientation.
public void updateOrientation() {
if (this.getTarget() != null) {
Vector3 direction = Vector3.subtract(this.getOutputPoint(false), this.getTarget().getInputPoint()).normalize();
this.pitch = (float) -Vector3.getAngle(new Vector3(-direction.x, -direction.y, -direction.z), new Vector3(0, 1, 0)) * Constants.RADIANS_TO_DEGREES + 90;
this.yaw = (float) -(Math.atan2(direction.z, direction.x) * Constants.RADIANS_TO_DEGREES) + 90;
}
}
use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.
the class TileEntityBeamReceiver method getInputPoint.
@Override
public Vector3 getInputPoint() {
Vector3 headVec = new Vector3(this.getPos().getX() + 0.5, this.getPos().getY() + 0.5, this.getPos().getZ() + 0.5);
if (this.facing != null) {
headVec.x += this.facing.getFrontOffsetX() * 0.1F;
headVec.y += this.facing.getFrontOffsetY() * 0.1F;
headVec.z += this.facing.getFrontOffsetZ() * 0.1F;
}
return headVec;
}
Aggregations