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