use of de.canitzp.tumat.api.components.TextComponent in project TUMAT by canitzp.
the class ActuallyAdditions method renderTileEntity.
@Override
public TooltipComponent renderTileEntity(WorldClient world, EntityPlayerSP player, TileEntity tileEntity, EnumFacing side, TooltipComponent component, boolean shouldCalculate) {
if (tileEntity instanceof TileEntityCompost) {
InfoUtil.syncTileEntity(tileEntity, shouldCalculate && InfoUtil.getItemStackInSlot(tileEntity, side, 0) != ItemStack.EMPTY, "ConversionTime");
int time = ((TileEntityCompost) tileEntity).conversionTime;
component.add(new TextComponent(TextFormatting.AQUA.toString() + time + "/3000 Ticks"), TooltipComponent.Priority.HIGH);
} else if (tileEntity instanceof TileEntityDisplayStand) {
ItemStack stack = InfoUtil.getItemStackInSlot(tileEntity, side, 0);
if (stack != ItemStack.EMPTY) {
component.add(new TextComponent(TextFormatting.AQUA.toString() + stack.getDisplayName()), TooltipComponent.Priority.HIGH);
}
} else if (tileEntity instanceof TileEntitySmileyCloud) {
if (!Objects.equals(((TileEntitySmileyCloud) tileEntity).name, ""))
component.add(new TextComponent(TextFormatting.AQUA.toString() + ((TileEntitySmileyCloud) tileEntity).name), TooltipComponent.Priority.HIGH);
}
return component;
}
use of de.canitzp.tumat.api.components.TextComponent in project TUMAT by canitzp.
the class ChiselsAndBits method renderBlock.
@Override
public TooltipComponent renderBlock(WorldClient world, EntityPlayerSP player, BlockPos pos, EnumFacing side, TooltipComponent component, boolean shouldCalculate) {
IBlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof IMultiStateBlock) {
component.setName(new TextComponent(InfoUtil.getBlockName(state)));
component.add(new TextComponent(L10n.getChiselAndBitsBaseBlock(InfoUtil.getBlockName(((IMultiStateBlock) state.getBlock()).getPrimaryState(world, pos)))), TooltipComponent.Priority.HIGH);
}
return component;
}
use of de.canitzp.tumat.api.components.TextComponent in project TUMAT by canitzp.
the class FluidHandler method renderTileEntity.
@Override
public TooltipComponent renderTileEntity(WorldClient world, EntityPlayerSP player, TileEntity tileEntity, EnumFacing side, TooltipComponent component, boolean shouldCalculate) {
if (tileEntity.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) {
IFluidHandler handler = tileEntity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
if (handler != null) {
IFluidTankProperties[] props = handler.getTankProperties();
if (props != null) {
for (IFluidTankProperties tank : props) {
if (tank != null && tank.getContents() != null) {
FluidStack fluidStack = tank.getContents();
component.add(new TextComponent(fluidStack.amount + "mB / " + tank.getCapacity() + "mB " + fluidStack.getLocalizedName()), TooltipComponent.Priority.HIGH);
}
}
}
}
}
return component;
}
use of de.canitzp.tumat.api.components.TextComponent in project TUMAT by canitzp.
the class ForgeUnits method renderTileEntity.
@Override
public TooltipComponent renderTileEntity(WorldClient world, EntityPlayerSP player, TileEntity tileEntity, EnumFacing side, TooltipComponent component, boolean shouldCalculate) {
if (tileEntity.hasCapability(CapabilityEnergy.ENERGY, side)) {
IEnergyStorage storage = tileEntity.getCapability(CapabilityEnergy.ENERGY, side);
if (storage != null) {
IBlockState state = world.getBlockState(tileEntity.getPos());
String modid = state.getBlock().getRegistryName().getResourceDomain();
String name = names.containsKey(modid) ? names.get(modid) : TextFormatting.RED + L10n.ENERGY;
for (String s : cableString) {
String toComp = state.getBlock().getUnlocalizedName();
if (toComp.contains("block_laser_relay")) {
component.add(new TextComponent(L10n.ENERGY_MAXTRANSFER + storage.getMaxEnergyStored() + "CF").setColor(InitItems.itemBattery.getRGBDurabilityForDisplay(new ItemStack(InitItems.itemBattery))), TooltipComponent.Priority.HIGH);
return component;
}
if (toComp.contains(s)) {
component.add(new TextComponent(L10n.ENERGY_MAXTRANSFER + name).setFormat(TextFormatting.RED), TooltipComponent.Priority.HIGH);
return component;
}
}
Pair<Integer, Integer> energy = SyncUtil.getForgeUnits(tileEntity.getPos(), side);
if (energy.getRight() > 0) {
this.render(component, modid, name, energy.getLeft(), energy.getRight());
}
}
}
return component;
}
use of de.canitzp.tumat.api.components.TextComponent in project TUMAT by canitzp.
the class IndustrialCraft2 method renderBlock.
@Override
public TooltipComponent renderBlock(WorldClient world, EntityPlayerSP player, BlockPos pos, EnumFacing side, TooltipComponent component, boolean shouldCalculate) {
IBlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof BlockTileEntity) {
if (InfoUtil.hasProperty(state, ((BlockTileEntity) state.getBlock()).typeProperty)) {
IProperty<MetaTeBlock> property = ((BlockTileEntity) state.getBlock()).typeProperty;
IBlockState actualState = state.getActualState(world, pos);
MetaTeBlock teBlock = actualState.getValue(property);
String name = property.getName(teBlock).replace("_active", "");
String unlocalized = "ic2.te." + name;
if (!name.contains("cable")) {
component.setName(new TextComponent(Localization.translate(unlocalized)));
}
}
}
return component;
}
Aggregations