Search in sources :

Example 6 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class WailaTurretHandler method getWailaBody.

/**
     * This method adds data to the body of the waila tool tip. This is where you should place the
     * majority of your data. The accessor is an object wrapper which contains all relevant data while
     * the config parameter allows you to take advantage of the ingame config gui.
     */
@Override
@Optional.Method(modid = "Waila")
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    TileEntity te = accessor.getTileEntity();
    if (te != null && te instanceof TurretHead) {
        TurretHead turret = (TurretHead) te;
        boolean active = turret.getBase().isActive();
        int damageUpgrades = TurretHeadUtil.getAmpLevel(turret.getBase());
        currenttip.add("§6" + safeLocalize(OMLibNames.Localizations.GUI.ACTIVE) + ": " + getColoredBooleanLocalizationYesNo(active));
        String ownerName = turret.getBase().getOwnerName();
        currenttip.add("§6" + safeLocalize(OMLibNames.Localizations.GUI.OWNER) + ": §F" + ownerName);
        currenttip.add("§6" + safeLocalize(OMTNames.Localizations.GUI.AMMO) + ": " + getAmmoLevel(turret, turret.getBase()));
        currenttip.add("§6" + safeLocalize(OMTNames.Localizations.GUI.DAMAGE_AMP) + ": " + String.format("%.2f", turret.getTurretDamageAmpBonus() * 100 * getAmpLevel(turret.getBase())) + "%");
        currenttip.add("§6" + safeLocalize(OMTNames.Localizations.GUI.ACCURACY) + ": " + String.format("%.2f", Math.min(100F, (100 - turret.getTurretAccuracy() * 10) * (1.0 + getAccuraccyUpgrades(turret.getBase())))) + "%");
        currenttip.add("§6" + safeLocalize(OMTNames.Localizations.GUI.RATE_OF_FIRE) + ": " + String.format("%.2f", 20F / turret.getTurretFireRate()) + "s/sec");
    }
    return currenttip;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Example 7 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class TurretBase method forceShootAllTurrets.

public int forceShootAllTurrets() {
    List<TileEntity> tileEntities = getTouchingTileEntities(this.getWorld(), this.pos);
    int successes = 0;
    for (TileEntity te : tileEntities) {
        if (te != null && te instanceof TurretHead) {
            successes += ((TurretHead) te).forceShot() ? 1 : 0;
        }
    }
    return successes;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Example 8 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class TurretBase method setAllTurretsYawPitch.

public void setAllTurretsYawPitch(float yaw, float pitch) {
    List<TileEntity> tileEntities = getTouchingTileEntities(this.getWorld(), this.pos);
    for (TileEntity te : tileEntities) {
        if (te != null && te instanceof TurretHead) {
            ((TurretHead) te).setRotationXY(getRotationXYFromYawPitch(yaw, pitch));
            ((TurretHead) te).setRotationXZ(getRotationXZFromYawPitch(yaw, pitch));
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Example 9 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class TurretBase method setBaseUpperBoundRange.

private void setBaseUpperBoundRange() {
    int maxRange = upperBoundMaxRange;
    List<TileEntity> tileEntities = WorldUtil.getTouchingTileEntities(getWorld(), getPos());
    for (TileEntity te : tileEntities) {
        if (te != null && te instanceof TurretHead) {
            maxRange = Math.max(((TurretHead) te).getTurretRange() + TurretHeadUtil.getRangeUpgrades(this), maxRange);
        }
    }
    this.upperBoundMaxRange = maxRange;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Example 10 with TurretHead

use of omtteam.openmodularturrets.tileentity.turrets.TurretHead in project OpenModularTurrets by OpenModularTurretsTeam.

the class TurretBase method setTurretYawPitch.

public boolean setTurretYawPitch(EnumFacing facing, float yaw, float pitch) {
    TileEntity turretHead = this.getWorld().getTileEntity(this.pos.offset(facing));
    if (turretHead != null && turretHead instanceof TurretHead) {
        ((TurretHead) turretHead).setRotationXY(getRotationXYFromYawPitch(yaw, pitch));
        ((TurretHead) turretHead).setRotationXZ(getRotationXZFromYawPitch(yaw, pitch));
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TurretHead(omtteam.openmodularturrets.tileentity.turrets.TurretHead)

Aggregations

TurretHead (omtteam.openmodularturrets.tileentity.turrets.TurretHead)13 ResourceLocation (net.minecraft.util.ResourceLocation)7 TileEntity (net.minecraft.tileentity.TileEntity)6