use of buildcraft.transport.plug.FacadePhasedState in project BuildCraft by BuildCraft.
the class ItemPluggableFacade method addSubItems.
@Override
public void addSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
// Add a single phased facade as a default
// check if the data is present as we only process in post-init
FacadeBlockStateInfo stone = FacadeStateManager.getInfoForBlock(Blocks.STONE);
if (stone != null) {
FacadePhasedState[] states = { //
FacadeStateManager.getInfoForBlock(Blocks.STONE).createPhased(null), //
FacadeStateManager.getInfoForBlock(Blocks.PLANKS).createPhased(EnumDyeColor.RED), //
FacadeStateManager.getInfoForBlock(Blocks.LOG).createPhased(EnumDyeColor.CYAN) };
FacadeInstance inst = new FacadeInstance(states, false);
subItems.add(createItemStack(inst));
for (FacadeBlockStateInfo info : FacadeStateManager.validFacadeStates.values()) {
if (!ForgeRegistries.BLOCKS.containsValue(info.state.getBlock())) {
// doesn't have the mods that created them.
continue;
}
if (info.isVisible) {
subItems.add(createItemStack(FacadeInstance.createSingle(info, false)));
subItems.add(createItemStack(FacadeInstance.createSingle(info, true)));
}
}
}
}
use of buildcraft.transport.plug.FacadePhasedState in project BuildCraft by BuildCraft.
the class ItemPluggableFacade method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
FacadeInstance states = getStates(stack);
if (states.type == FacadeType.Phased) {
String stateString = LocaleUtil.localize("item.FacadePhased.state");
FacadePhasedState defaultState = null;
for (FacadePhasedState state : states.phasedStates) {
if (state.activeColour == null) {
defaultState = state;
continue;
}
tooltip.add(String.format(stateString, LocaleUtil.localizeColour(state.activeColour), getFacadeStateDisplayName(state)));
}
if (defaultState != null) {
tooltip.add(1, String.format(LocaleUtil.localize("item.FacadePhased.state_default"), getFacadeStateDisplayName(defaultState)));
}
} else {
String propertiesStart = TextFormatting.GRAY + "" + TextFormatting.ITALIC;
FacadeBlockStateInfo info = states.phasedStates[0].stateInfo;
BlockUtil.getPropertiesStringMap(info.state, info.varyingProperties).forEach((name, value) -> tooltip.add(propertiesStart + name + " = " + value));
}
}
Aggregations