use of com.simibubi.create.foundation.config.CKinetics in project Create by Creators-of-Create.
the class IAirCurrentSource method getMaxDistance.
default float getMaxDistance() {
float speed = Math.abs(this.getSpeed());
CKinetics config = AllConfigs.SERVER.kinetics;
float distanceFactor = Math.min(speed / config.fanRotationArgmax.get(), 1);
float pushDistance = Mth.lerp(distanceFactor, 3, config.fanPushDistance.get());
float pullDistance = Mth.lerp(distanceFactor, 3f, config.fanPullDistance.get());
return this.getSpeed() > 0 ? pushDistance : pullDistance;
}
use of com.simibubi.create.foundation.config.CKinetics in project Create by Creators-of-Create.
the class ItemDescription method getKineticStats.
public static List<Component> getKineticStats(Block block) {
List<Component> list = new ArrayList<>();
CKinetics config = AllConfigs.SERVER.kinetics;
Component rpmUnit = Lang.translate("generic.unit.rpm");
boolean hasGoggles = AllItems.GOGGLES.isIn(Minecraft.getInstance().player.getItemBySlot(EquipmentSlot.HEAD));
SpeedLevel minimumRequiredSpeedLevel;
boolean showStressImpact;
if (!(block instanceof IRotate)) {
minimumRequiredSpeedLevel = SpeedLevel.NONE;
showStressImpact = true;
} else {
minimumRequiredSpeedLevel = ((IRotate) block).getMinimumRequiredSpeedLevel();
showStressImpact = !((IRotate) block).hideStressImpact();
}
boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE;
boolean hasStressImpact = StressImpact.isEnabled() && showStressImpact && BlockStressValues.getImpact(block) > 0;
boolean hasStressCapacity = StressImpact.isEnabled() && BlockStressValues.hasCapacity(block);
if (hasSpeedRequirement) {
List<Component> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high");
int index = minimumRequiredSpeedLevel.ordinal();
MutableComponent level = new TextComponent(makeProgressBar(3, index)).withStyle(minimumRequiredSpeedLevel.getTextColor());
if (hasGoggles)
level.append(String.valueOf(minimumRequiredSpeedLevel.getSpeedValue())).append(rpmUnit).append("+");
else
level.append(speedLevels.get(index));
list.add(Lang.translate("tooltip.speedRequirement").withStyle(GRAY));
list.add(level);
}
if (hasStressImpact) {
List<Component> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high");
double impact = BlockStressValues.getImpact(block);
StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH : (impact >= config.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW);
int index = impactId.ordinal();
MutableComponent level = new TextComponent(makeProgressBar(3, index)).withStyle(impactId.getAbsoluteColor());
if (hasGoggles)
level.append(impact + "x ").append(rpmUnit);
else
level.append(stressLevels.get(index));
list.add(Lang.translate("tooltip.stressImpact").withStyle(GRAY));
list.add(level);
}
if (hasStressCapacity) {
List<Component> stressCapacityLevels = Lang.translatedOptions("tooltip.capacityProvided", "low", "medium", "high");
double capacity = BlockStressValues.getCapacity(block);
StressImpact impactId = capacity >= config.highCapacity.get() ? StressImpact.LOW : (capacity >= config.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH);
int index = StressImpact.values().length - 2 - impactId.ordinal();
MutableComponent level = new TextComponent(makeProgressBar(3, index)).withStyle(impactId.getAbsoluteColor());
if (hasGoggles)
level.append(capacity + "x ").append(rpmUnit);
else
level.append(stressCapacityLevels.get(index));
// if (!isEngine && ((IRotate) block).showCapacityWithAnnotation())
// level +=
// " " + DARK_GRAY + TextFormatting.ITALIC + Lang.translate("tooltip.capacityProvided.asGenerator");
list.add(Lang.translate("tooltip.capacityProvided").withStyle(GRAY));
list.add(level);
MutableComponent genSpeed = generatorSpeed(block, rpmUnit);
if (!genSpeed.getString().isEmpty())
list.add(new TextComponent(" ").append(genSpeed).withStyle(DARK_GRAY));
}
// add(linesOnShift, "");
return list;
}
Aggregations