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)));
}
}
}
}
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);
}
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;
}
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));
}
}
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));
}
}
Aggregations