Search in sources :

Example 1 with FacadeInstance

use of buildcraft.transport.plug.FacadeInstance in project BuildCraft by BuildCraft.

the class ItemPluggableFacade method onPlace.

@Override
public PipePluggable onPlace(@Nonnull ItemStack stack, IPipeHolder holder, EnumFacing side, EntityPlayer player, EnumHand hand) {
    FacadeInstance fullState = getStates(stack);
    SoundUtil.playBlockPlace(holder.getPipeWorld(), holder.getPipePos(), fullState.phasedStates[0].stateInfo.state);
    return new PluggableFacade(BCTransportPlugs.facade, holder, side, fullState);
}
Also used : FacadeInstance(buildcraft.transport.plug.FacadeInstance) PluggableFacade(buildcraft.transport.plug.PluggableFacade)

Example 2 with FacadeInstance

use of buildcraft.transport.plug.FacadeInstance 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 3 with FacadeInstance

use of buildcraft.transport.plug.FacadeInstance in project BuildCraft by BuildCraft.

the class BCTransport method postInit.

@Mod.EventHandler
public static void postInit(FMLPostInitializationEvent evt) {
    BCTransportProxy.getProxy().fmlPostInit();
    if (BCTransportItems.plugFacade != null) {
        FacadeBlockStateInfo state = FacadeStateManager.previewState;
        FacadeInstance inst = FacadeInstance.createSingle(state, false);
        tabFacades.setItem(BCTransportItems.plugFacade.createItemStack(inst));
    }
}
Also used : FacadeBlockStateInfo(buildcraft.transport.plug.FacadeBlockStateInfo) FacadeInstance(buildcraft.transport.plug.FacadeInstance)

Example 4 with FacadeInstance

use of buildcraft.transport.plug.FacadeInstance 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

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