Search in sources :

Example 1 with FacadePhasedState

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)));
            }
        }
    }
}
Also used : FacadeBlockStateInfo(buildcraft.transport.plug.FacadeBlockStateInfo) FacadeInstance(buildcraft.transport.plug.FacadeInstance) FacadePhasedState(buildcraft.transport.plug.FacadePhasedState)

Example 2 with FacadePhasedState

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));
    }
}
Also used : FacadeBlockStateInfo(buildcraft.transport.plug.FacadeBlockStateInfo) FacadeInstance(buildcraft.transport.plug.FacadeInstance) FacadePhasedState(buildcraft.transport.plug.FacadePhasedState) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

FacadeBlockStateInfo (buildcraft.transport.plug.FacadeBlockStateInfo)2 FacadeInstance (buildcraft.transport.plug.FacadeInstance)2 FacadePhasedState (buildcraft.transport.plug.FacadePhasedState)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1