use of slimeknights.tconstruct.library.recipe.partbuilder.Pattern in project TinkersConstruct by SlimeKnights.
the class LayoutIconTest method pattern_getValue_hasSamePattern.
/* Pattern */
@Test
void pattern_getValue_hasSamePattern() {
Pattern pattern = new Pattern("test:the_pattern");
LayoutIcon itemIcon = LayoutIcon.ofPattern(pattern);
Pattern contained = itemIcon.getValue(Pattern.class);
assertThat(contained).isNotNull();
assertThat(contained).isEqualTo(pattern);
assertThat(itemIcon.getValue(ItemStack.class)).isNull();
}
use of slimeknights.tconstruct.library.recipe.partbuilder.Pattern in project TinkersConstruct by SlimeKnights.
the class LayoutIconTest method pattern_jsonDeserialize.
@Test
void pattern_jsonDeserialize() {
JsonObject json = new JsonObject();
json.addProperty("pattern", "test:json_pattern");
LayoutIcon parsed = LayoutIcon.SERIALIZER.deserialize(json, LayoutIcon.class, mock(JsonDeserializationContext.class));
Pattern contained = parsed.getValue(Pattern.class);
assertThat(contained).isNotNull();
assertThat(contained).isEqualTo(new Pattern("test:json_pattern"));
}
use of slimeknights.tconstruct.library.recipe.partbuilder.Pattern in project Materialis by RCXcrafter.
the class MaterialisToolSlotLayouts method addLayouts.
@Override
protected void addLayouts() {
// wrench
defineModifiable(MaterialisResources.WRENCH).sortIndex(SORT_HARVEST).addInputItem(MaterialisResources.WRENCH_HEAD, 39, 35).addInputItem(TinkerToolParts.toolHandle, 21, 53).build();
defineModifiable(TinkerTools.sledgeHammer).sortIndex(SORT_HARVEST + SORT_LARGE).addInputItem(TinkerToolParts.hammerHead, 44, 29).addInputItem(TinkerToolParts.toughHandle, 21, 52).addInputSlot(new Pattern(Objects.requireNonNull(TinkerToolParts.largePlate.asItem().getRegistryName())), TinkerToolParts.largePlate.asItem().getDescriptionId(), 50, 48, Ingredient.of(TinkerToolParts.largePlate, MaterialisResources.WRENCH_HEAD)).addInputSlot(new Pattern(Objects.requireNonNull(TinkerToolParts.largePlate.asItem().getRegistryName())), TinkerToolParts.largePlate.asItem().getDescriptionId(), 25, 20, Ingredient.of(TinkerToolParts.largePlate, MaterialisResources.WRENCH_HEAD)).build();
}
use of slimeknights.tconstruct.library.recipe.partbuilder.Pattern in project TinkersConstruct by SlimeKnights.
the class PartBuilderCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayout layout, IDisplayPartBuilderRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup items = layout.getItemStacks();
items.init(0, true, 24, 15);
items.init(1, true, 3, 15);
items.init(2, false, 95, 14);
items.set(ingredients);
IGuiIngredientGroup<Pattern> patterns = layout.getIngredientsGroup(JEIPlugin.PATTERN_TYPE);
patterns.init(0, true, 46, 16);
patterns.set(ingredients);
}
use of slimeknights.tconstruct.library.recipe.partbuilder.Pattern in project TinkersConstruct by SlimeKnights.
the class PartBuilderScreen method drawRecipesItems.
/**
* Draw slot icons for all patterns
*/
private void drawRecipesItems(PoseStack matrices, int left, int top) {
// use block texture list
assert this.minecraft != null;
RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS);
Function<ResourceLocation, TextureAtlasSprite> spriteGetter = this.minecraft.getTextureAtlas(InventoryMenu.BLOCK_ATLAS);
// iterate all recipes
List<Pattern> list = this.tile.getSortedButtons();
int max = Math.min(this.recipeIndexOffset + 12, this.getPartRecipeCount());
for (int i = this.recipeIndexOffset; i < max; ++i) {
int relative = i - this.recipeIndexOffset;
int x = left + relative % 4 * 18 + 1;
int y = top + (relative / 4) * 18 + 1;
// get the sprite for the pattern and draw
Pattern pattern = list.get(i);
TextureAtlasSprite sprite = spriteGetter.apply(pattern.getTexture());
blit(matrices, x, y, 100, 16, 16, sprite);
}
}
Aggregations