use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class BlockSurfaceRockDeprecated method getMagnifyResults.
@Override
public List<ITextComponent> getMagnifyResults(IBlockAccess world, BlockPos pos, IBlockState blockState, EntityPlayer player) {
ArrayList<ITextComponent> result = new ArrayList<>();
ITextComponent materialComponent = new TextComponentTranslation(getStoneMaterial(world, pos, blockState).getUnlocalizedName());
materialComponent.getStyle().setColor(TextFormatting.GREEN);
result.add(new TextComponentTranslation("gregtech.block.surface_rock.material", materialComponent));
return result;
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class MetaTileEntityLargeTurbine method addDisplayText.
@Override
protected void addDisplayText(List<ITextComponent> textList) {
if (isStructureFormed()) {
MetaTileEntityRotorHolder rotorHolder = getRotorHolder();
FluidStack fuelStack = ((LargeTurbineWorkableHandler) workableHandler).getFuelStack();
int fuelAmount = fuelStack == null ? 0 : fuelStack.amount;
ITextComponent fuelName = new TextComponentTranslation(fuelAmount == 0 ? "gregtech.fluid.empty" : fuelStack.getUnlocalizedName());
textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.fuel_amount", fuelAmount, fuelName));
if (rotorHolder.getRotorEfficiency() > 0.0) {
textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_speed", rotorHolder.getCurrentRotorSpeed(), rotorHolder.getMaxRotorSpeed()));
textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_efficiency", (int) (rotorHolder.getRotorEfficiency() * 100)));
int rotorDurability = (int) (rotorHolder.getRotorDurability() * 100);
if (rotorDurability > MIN_DURABILITY_TO_WARN) {
textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.rotor_durability", rotorDurability));
} else {
textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.low_rotor_durability", MIN_DURABILITY_TO_WARN, rotorDurability).setStyle(new Style().setColor(TextFormatting.RED)));
}
}
if (!isRotorFaceFree()) {
textList.add(new TextComponentTranslation("gregtech.multiblock.turbine.obstructed").setStyle(new Style().setColor(TextFormatting.RED)));
}
}
super.addDisplayText(textList);
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class MetaTileEntityDieselEngine method addDisplayText.
@Override
protected void addDisplayText(List<ITextComponent> textList) {
if (isStructureFormed()) {
FluidStack lubricantStack = importFluidHandler.drain(Materials.Lubricant.getFluid(Integer.MAX_VALUE), false);
FluidStack oxygenStack = importFluidHandler.drain(Materials.Oxygen.getFluid(Integer.MAX_VALUE), false);
FluidStack fuelStack = ((DieselEngineWorkableHandler) workableHandler).getFuelStack();
int lubricantAmount = lubricantStack == null ? 0 : lubricantStack.amount;
int oxygenAmount = oxygenStack == null ? 0 : oxygenStack.amount;
int fuelAmount = fuelStack == null ? 0 : fuelStack.amount;
ITextComponent fuelName = new TextComponentTranslation(fuelAmount == 0 ? "gregtech.fluid.empty" : fuelStack.getUnlocalizedName());
textList.add(new TextComponentTranslation("gregtech.multiblock.diesel_engine.lubricant_amount", lubricantAmount));
textList.add(new TextComponentTranslation("gregtech.multiblock.diesel_engine.fuel_amount", fuelAmount, fuelName));
textList.add(new TextComponentTranslation("gregtech.multiblock.diesel_engine.oxygen_amount", oxygenAmount));
textList.add(new TextComponentTranslation(oxygenAmount >= 2 ? "gregtech.multiblock.diesel_engine.oxygen_boosted" : "gregtech.multiblock.diesel_engine.supply_oxygen_to_boost"));
}
super.addDisplayText(textList);
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class ModeSwitchBehavior method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack itemStack = player.getHeldItem(hand);
if (player.isSneaking()) {
T currentMode = getModeFromItemStack(itemStack);
int currentModeIndex = ArrayUtils.indexOf(enumConstants, currentMode);
T nextMode = enumConstants[(currentModeIndex + 1) % enumConstants.length];
setModeForItemStack(itemStack, nextMode);
ITextComponent newModeComponent = new TextComponentTranslation(nextMode.getUnlocalizedName());
ITextComponent textComponent = new TextComponentTranslation("metaitem.behavior.mode_switch.mode_switched", newModeComponent);
player.sendStatusMessage(textComponent, true);
return ActionResult.newResult(EnumActionResult.SUCCESS, itemStack);
}
return ActionResult.newResult(EnumActionResult.PASS, itemStack);
}
use of net.minecraft.util.text.ITextComponent in project GregTech by GregTechCE.
the class ScannerBehavior method onItemUseFinish.
@Override
public ItemStack onItemUseFinish(ItemStack stack, EntityPlayer player) {
if (!player.world.isRemote) {
Pair<BlockPos, IBlockState> hitBlock = getHitBlock(player);
if (hitBlock != null && checkCanUseScanner(stack, player, false).getLeft() == null) {
ITextComponent component = new TextComponentTranslation("behavior.scanner.analyzing_complete");
component.getStyle().setColor(TextFormatting.GOLD);
player.sendStatusMessage(component, true);
IScannableBlock magnifiableBlock = ((IScannableBlock) hitBlock.getRight().getBlock());
List<ITextComponent> text = magnifiableBlock.getMagnifyResults(player.world, hitBlock.getLeft(), hitBlock.getRight(), player);
text.forEach(player::sendMessage);
}
}
return stack;
}
Aggregations