Search in sources :

Example 1 with IDesign

use of binnie.design.api.IDesign in project Binnie by ForestryMC.

the class ControlTileSelect method refresh.

public void refresh(final String filterText) {
    this.deleteAllChildren();
    int cx = 2;
    int cy = 2;
    final Map<IDesignCategory, List<IDesign>> designs = new HashMap<>();
    for (final IDesignCategory category : DesignAPI.manager.getAllDesignCategories()) {
        designs.put(category, new ArrayList<>());
        for (final IDesign tile : category.getDesigns()) {
            if (Objects.equals(filterText, "") || tile.getName().toLowerCase().contains(filterText)) {
                designs.get(category).add(tile);
            }
        }
        if (designs.get(category).isEmpty()) {
            designs.remove(category);
        }
    }
    for (final IDesignCategory category : designs.keySet()) {
        cx = 2;
        new ControlText(this, new Point(cx, cy + 3), category.getName());
        cy += 16;
        for (final IDesign tile : designs.get(category)) {
            if (cx > 90) {
                cx = 2;
                cy += 20;
            }
            new ControlTile(this, cx, cy, tile);
            cx += 20;
        }
        cy += 20;
    }
    final int height = cy;
    this.setSize(new Point(this.getSize().xPos(), height));
}
Also used : IDesign(binnie.design.api.IDesign) HashMap(java.util.HashMap) ControlText(binnie.core.gui.controls.ControlText) ArrayList(java.util.ArrayList) List(java.util.List) Point(binnie.core.gui.geometry.Point) IDesignCategory(binnie.design.api.IDesignCategory) Point(binnie.core.gui.geometry.Point)

Example 2 with IDesign

use of binnie.design.api.IDesign in project Binnie by ForestryMC.

the class DesignHelper method getDesignBlock.

public static DesignBlock getDesignBlock(final IDesignSystem system, final int meta) {
    final int plankID1 = meta & 0xFF;
    final int plankID2 = meta >> 8 & 0xFF;
    final int tile = meta >> 16 & 0x3FF;
    final int rotation = meta >> 26 & 0x3;
    final int axis = meta >> 28 & 0x7;
    final IDesignMaterial type1 = system.getMaterial(plankID1);
    final IDesignMaterial type2 = system.getMaterial(plankID2);
    final IDesign type3 = Design.getDesignManager().getDesign(tile);
    return new DesignBlock(system, type1, type2, type3, rotation, EnumFacing.VALUES[axis]);
}
Also used : DesignBlock(binnie.design.blocks.DesignBlock) IDesign(binnie.design.api.IDesign) IDesignMaterial(binnie.design.api.IDesignMaterial)

Example 3 with IDesign

use of binnie.design.api.IDesign in project Binnie by ForestryMC.

the class ComponentDesignerRecipe method getProduct.

@Override
public ItemStack getProduct() {
    final ItemStack plank1 = this.getUtil().getStack(DesignerSlots.DESIGN_SLOT_1);
    final ItemStack plank2 = this.getUtil().getStack(DesignerSlots.DESIGN_SLOT_2);
    if (plank1.isEmpty() || plank2.isEmpty()) {
        return ItemStack.EMPTY;
    }
    final IDesignMaterial type1 = this.type.getSystem().getMaterial(plank1);
    final IDesignMaterial type2 = this.type.getSystem().getMaterial(plank2);
    final IDesign design = this.getDesign();
    return this.type.getBlock(type1, type2, design);
}
Also used : IDesign(binnie.design.api.IDesign) IDesignMaterial(binnie.design.api.IDesignMaterial) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IDesign (binnie.design.api.IDesign)3 IDesignMaterial (binnie.design.api.IDesignMaterial)2 ControlText (binnie.core.gui.controls.ControlText)1 Point (binnie.core.gui.geometry.Point)1 IDesignCategory (binnie.design.api.IDesignCategory)1 DesignBlock (binnie.design.blocks.DesignBlock)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ItemStack (net.minecraft.item.ItemStack)1