use of icbm.classic.content.entity.EntityMissile in project ICBM-Classic by BuiltBrokenModding.
the class RenderMissile method doRender.
@Override
public void doRender(Entity entity, double x, double y, double z, float f, float f1) {
EntityMissile entityMissile = (EntityMissile) entity;
Explosive e = entityMissile.getExplosiveType();
Explosion missile = e == null ? (Explosion) Explosives.CONDENSED.handler : (Explosion) e;
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glRotatef(entityMissile.prevRotationYaw + (entityMissile.rotationYaw - entityMissile.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F);
float pitch = entityMissile.prevRotationPitch + (entityMissile.rotationPitch - entityMissile.prevRotationPitch) * f1 - 90;
GL11.glRotatef(pitch, 0.0F, 0.0F, 1.0F);
if (missile.missileModelPath.contains("missiles")) {
GL11.glScalef(0.00625f, 0.00625f, 0.00625f);
} else {
GL11.glScalef(0.07f, 0.07f, 0.07f);
}
renderMissile(missile);
GL11.glPopMatrix();
}
use of icbm.classic.content.entity.EntityMissile in project ICBM-Classic by BuiltBrokenModding.
the class TileLauncherBase method launchMissile.
/**
* Launches the missile
*
* @param target - The target in which the missile will land in
*/
public boolean launchMissile(Pos target, int gaoDu) {
final ItemStack stack = getMissileStack();
if (stack != null && stack.getItem() == ICBMClassic.itemMissile) {
Explosive ex = Explosives.get(stack.getItemDamage()).handler;
if (ex.hasMissileForm()) {
// Apply inaccuracy
int inaccuracy = 30;
//Get value from support frame
if (this.supportFrame != null) {
inaccuracy = this.supportFrame.getInaccuracy();
}
//Randomize distance
inaccuracy = world().rand.nextInt(inaccuracy);
//Randomize radius drop
angle.setYaw(world().rand.nextFloat() * 360);
//Update target
target = target.add(angle.x() * inaccuracy, 0, angle.z() * inaccuracy);
if (isServer()) {
EntityMissile missile = new EntityMissile(world());
missile.explosiveID = Explosives.get(stack.getItemDamage());
missile.launcherPos = new Pos((TileEntity) this);
missile.setPosition(xi(), yi() + 3, zi());
missile.launch(target, gaoDu);
world().spawnEntityInWorld(missile);
this.decrStackSize(0, 1);
}
return true;
}
}
return false;
}
use of icbm.classic.content.entity.EntityMissile in project ICBM-Classic by BuiltBrokenModding.
the class GuiRadarStation method drawGuiContainerBackgroundLayer.
/** Draw the background layer for the GuiContainer (everything behind the items) */
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.containerPosX = (this.width - this.xSize) / 2;
this.containerPosY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerPosX, containerPosY, 0, 0, this.xSize, this.ySize);
this.radarCenter = new Point(this.containerPosX + this.xSize / 3 - 10, this.containerPosY + this.ySize / 2 + 4);
this.radarMapRadius = TileRadarStation.MAX_DETECTION_RANGE / 71f;
this.info = "";
this.info2 = "";
if (this.tileEntity.hasPower()) {
int range = 4;
for (Entity entity : this.tileEntity.detectedEntities) {
Point position = new Point(radarCenter.x() + (entity.posX - this.tileEntity.xCoord) / this.radarMapRadius, radarCenter.y() - (entity.posZ - this.tileEntity.zCoord) / this.radarMapRadius);
if (entity instanceof EntityMissile) {
if (this.tileEntity.isMissileGoingToHit((EntityMissile) entity)) {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_RED_DOT);
} else {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_YELLOW_DOT);
}
} else {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_YELLOW_DOT);
}
this.drawTexturedModalRect(position.xi(), position.yi(), 0, 0, 2, 2);
// Hover Detection
Point minPosition = position.clone();
minPosition.add(-range);
Point maxPosition = position.clone();
maxPosition.add(range);
if (new Rectangle(minPosition, maxPosition).isWithin(this.mousePosition)) {
this.info = entity.getCommandSenderName();
if (entity instanceof EntityPlayer) {
this.info = "ยง1" + this.info;
}
if (entity instanceof EntityMissile) {
if (((EntityMissile) entity).targetVector != null) {
this.info2 = "(" + ((EntityMissile) entity).targetVector.xi() + ", " + ((EntityMissile) entity).targetVector.zi() + ")";
}
}
}
}
}
}
Aggregations