Search in sources :

Example 1 with FacadeBlockStateInfo

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

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

the class FacadeAssemblyRecipes method getOutputs.

@Override
public Set<ItemStack> getOutputs(NonNullList<ItemStack> inputs) {
    if (!StackUtil.contains(new ItemStack(BCTransportItems.pipeStructure, 3), inputs)) {
        return Collections.emptySet();
    }
    ArrayList<ItemStack> stacks = new ArrayList<>();
    for (ItemStack stack : inputs) {
        stack = stack.copy();
        stack.setCount(1);
        List<FacadeBlockStateInfo> infos = FacadeStateManager.stackFacades.get(new ItemStackKey(stack));
        if (infos == null || infos.isEmpty()) {
            continue;
        }
        for (FacadeBlockStateInfo info : infos) {
            stacks.add(createFacadeStack(info, false));
            stacks.add(createFacadeStack(info, true));
        }
    }
    return ImmutableSet.copyOf(stacks);
}
Also used : FacadeBlockStateInfo(buildcraft.transport.plug.FacadeBlockStateInfo) ArrayList(java.util.ArrayList) ChangingItemStack(buildcraft.lib.recipe.ChangingItemStack) ItemStack(net.minecraft.item.ItemStack) ItemStackKey(buildcraft.lib.misc.ItemStackKey)

Example 3 with FacadeBlockStateInfo

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

the class FacadeAssemblyRecipes method getRecipeOutputs.

@Override
public ChangingItemStack getRecipeOutputs() {
    NonNullList<ItemStack> list = NonNullList.create();
    for (FacadeBlockStateInfo info : FacadeStateManager.validFacadeStates.values()) {
        if (info.isVisible) {
            list.add(createFacadeStack(info, false));
            list.add(createFacadeStack(info, true));
        }
    }
    ChangingItemStack changing = new ChangingItemStack(list);
    changing.setTimeGap(TIME_GAP);
    return changing;
}
Also used : FacadeBlockStateInfo(buildcraft.transport.plug.FacadeBlockStateInfo) ChangingItemStack(buildcraft.lib.recipe.ChangingItemStack) ItemStack(net.minecraft.item.ItemStack) ChangingItemStack(buildcraft.lib.recipe.ChangingItemStack)

Example 4 with FacadeBlockStateInfo

use of buildcraft.transport.plug.FacadeBlockStateInfo 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 5 with FacadeBlockStateInfo

use of buildcraft.transport.plug.FacadeBlockStateInfo 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)6 ChangingItemStack (buildcraft.lib.recipe.ChangingItemStack)3 FacadeInstance (buildcraft.transport.plug.FacadeInstance)3 ItemStack (net.minecraft.item.ItemStack)3 FacadePhasedState (buildcraft.transport.plug.FacadePhasedState)2 ItemStackKey (buildcraft.lib.misc.ItemStackKey)1 ArrayList (java.util.ArrayList)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1