use of net.dries007.tfc.common.recipes.AnvilRecipe in project firmalife by eerussianguy.
the class TFCRegistry method onRegisterAnvilRecipes.
@SubscribeEvent
public static void onRegisterAnvilRecipes(RegistryEvent.Register<AnvilRecipe> event) {
IForgeRegistry<AnvilRecipe> r = event.getRegistry();
for (Metal metal : TFCRegistries.METALS.getValuesCollection()) {
if (metal.isToolMetal())
r.register(new AnvilRecipe(new ResourceLocation(MOD_ID, metal.toString() + "_mallet_head"), IIngredient.of(new ItemStack(ItemMetal.get(metal, Metal.ItemType.INGOT))), new ItemStack(ItemsFL.getMetalMalletHead(metal)), metal.getTier(), TOOLS, PUNCH_LAST, PUNCH_SECOND_LAST, SHRINK_THIRD_LAST));
}
r.registerAll(new AnvilRecipe(new ResourceLocation(MOD_ID, "greenhouse_wall"), IIngredient.of(ItemMetal.get(Metal.WROUGHT_IRON, Metal.ItemType.SHEET)), new ItemStack(BlocksFL.GREENHOUSE_WALL, 2), Metal.WROUGHT_IRON.getTier(), GENERAL, HIT_NOT_LAST, PUNCH_NOT_LAST, SHRINK_LAST));
r.registerAll(new AnvilRecipe(new ResourceLocation(MOD_ID, "greenhouse_roof"), IIngredient.of(ItemMetal.get(Metal.WROUGHT_IRON, Metal.ItemType.SHEET)), new ItemStack(BlocksFL.GREENHOUSE_ROOF, 2), Metal.WROUGHT_IRON.getTier(), GENERAL, HIT_THIRD_LAST, PUNCH_SECOND_LAST, PUNCH_LAST));
r.registerAll(new AnvilRecipe(new ResourceLocation(MOD_ID, "greenhouse_door"), IIngredient.of(ItemMetal.get(Metal.WROUGHT_IRON, Metal.ItemType.SHEET)), new ItemStack(ItemsFL.ITEM_GREENHOUSE_DOOR), Metal.WROUGHT_IRON.getTier(), GENERAL, HIT_NOT_LAST, HIT_NOT_LAST, PUNCH_LAST));
r.registerAll(new AnvilRecipe(new ResourceLocation(MOD_ID, "spout"), IIngredient.of("ingotBlackSteel"), new ItemStack(BlocksFL.SPOUT), Metal.WROUGHT_IRON.getTier(), GENERAL, PUNCH_THIRD_LAST, SHRINK_SECOND_LAST, HIT_LAST));
}
use of net.dries007.tfc.common.recipes.AnvilRecipe in project TerraFirmaCraft by TerraFirmaCraft.
the class AnvilPlanScreen method init.
@Override
protected void init() {
super.init();
final int recipesPerPage = 18;
final int guiLeft = getGuiLeft(), guiTop = getGuiTop();
final ItemStack inputStack = blockEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).map(t -> t.getStackInSlot(AnvilBlockEntity.SLOT_INPUT_MAIN)).orElse(ItemStack.EMPTY);
final List<AnvilRecipe> recipes = AnvilRecipe.getAll(playerInventory.player.level, inputStack, blockEntity.getTier());
recipeButtons = new ArrayList<>();
for (int i = 0; i < recipes.size(); i++) {
final int page = i / recipesPerPage;
final int index = i % recipesPerPage;
final int posX = 7 + (index % 9) * 18;
final int posY = 25 + ((index % 18) / 9) * 18;
final AnvilRecipe recipe = recipes.get(i);
final AnvilPlanSelectButton button = new AnvilPlanSelectButton(guiLeft + posX, guiTop + posY, page, recipe, RenderHelpers.makeButtonTooltip(this, recipe.getResultItem().getDisplayName()));
button.setCurrentPage(0);
recipeButtons.add(button);
addRenderableWidget(button);
}
maxPageInclusive = (recipes.size() - 1) % recipesPerPage;
addRenderableWidget(leftButton = NextPageButton.left(guiLeft + 7, guiTop + 65, button -> {
if (currentPage < maxPageInclusive) {
currentPage++;
updateCurrentPage();
}
}));
addRenderableWidget(rightButton = NextPageButton.right(guiLeft + 7, guiTop + 154, button -> {
if (currentPage > 0) {
currentPage--;
updateCurrentPage();
}
}));
updateCurrentPage();
}
use of net.dries007.tfc.common.recipes.AnvilRecipe in project TerraFirmaCraft by TerraFirmaCraft.
the class AnvilPlanButton method getRecipe.
@Nullable
private AnvilRecipe getRecipe() {
final Level level = anvil.getLevel();
final Forging forging = anvil.getMainInputForging();
if (level != null && forging != null) {
return forging.getRecipe(level);
}
return null;
}
use of net.dries007.tfc.common.recipes.AnvilRecipe in project TerraFirmaCraft by TerraFirmaCraft.
the class AnvilPlanButton method renderButton.
@Override
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, AnvilScreen.BACKGROUND);
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
blit(poseStack, x, y, 218, 0, width, height, 256, 256);
final AnvilRecipe recipe = getRecipe();
if (recipe != null) {
Minecraft.getInstance().getItemRenderer().renderAndDecorateItem(recipe.getResultItem(), x + 1, y + 1);
} else {
blit(poseStack, x + 1, y + 1, 236, 0, 16, 16, 256, 256);
}
if (isHoveredOrFocused()) {
renderToolTip(poseStack, mouseX, mouseY);
}
}
Aggregations