public boolean matches(ItemStack input) { return this.input != null && this.input.matches(ListUtil.getListFrom(input)).isPresent(); }
public boolean matches(ItemStack stack) { return input.matches(ListUtil.getListFrom(stack)).isPresent(); }
@Override public boolean matches(ItemStack cast, Fluid fluid) { if((cast.isEmpty() && this.cast == null) || (this.cast != null && this.cast.matches(ListUtil.getListFrom(cast)).isPresent())) { return this.fluid.getFluid() == fluid; } return false; }
@Override protected int repairCustom(Material material, NonNullList<ItemStack> repairItems) { Optional<RecipeMatch.Match> matchOptional = RecipeMatch.of(TinkerTools.sharpeningKit).matches(repairItems); if(!matchOptional.isPresent()) { return 0; } RecipeMatch.Match match = matchOptional.get(); for(ItemStack stacks : match.stacks) { // invalid material? if(TinkerTools.sharpeningKit.getMaterial(stacks) != material) { return 0; } } RecipeMatch.removeMatch(repairItems, match); HeadMaterialStats stats = material.getStats(MaterialTypes.HEAD); float durability = stats.durability * match.amount * TinkerTools.sharpeningKit.getCost(); durability /= Material.VALUE_Ingot; return (int) (durability); }
if(recipe.getFluid().getFluid() == fluid && recipe.cast != null) { if(recipe.cast.matches(ListUtil.getListFrom(TinkerSmeltery.castNugget)).isPresent()) { list.add(new FluidGuiEntry(recipe.getFluid().amount, "gui.smeltery.liquid.nugget")); if(recipe.cast.matches(ListUtil.getListFrom(TinkerSmeltery.castIngot)).isPresent()) { list.add(new FluidGuiEntry(recipe.getFluid().amount, "gui.smeltery.liquid.ingot")); if(recipe.cast.matches(ListUtil.getListFrom(TinkerSmeltery.castGem)).isPresent()) { list.add(new FluidGuiEntry(recipe.getFluid().amount, "gui.smeltery.liquid.gem"));
public Optional<RecipeMatch.Match> matches(NonNullList<ItemStack> stacks) { for(RecipeMatch recipe : items) { Optional<RecipeMatch.Match> match = recipe.matches(stacks); if(match.isPresent()) { return match; } } return Optional.empty(); }
@SubscribeEvent public void onTinkerRegister(TinkerRegisterEvent.MeltingRegisterEvent event) { if(event.getRecipe() instanceof MeltingRecipeTweaker) { return; } for(Map.Entry<ILiquidStack, IItemStack> ent : REMOVED_RECIPES.entries()) { if(event.getRecipe().getResult().isFluidEqual(((FluidStack) ent.getKey().getInternal()))) { if(ent.getValue() != null) { if(event.getRecipe().input.matches(NonNullList.withSize(1, (ItemStack) ent.getValue().getInternal())).isPresent()) { event.setCanceled(true); } } else event.setCanceled(true); } } }
@SubscribeEvent public void onTinkerRegister(TinkerRegisterEvent.DryingRackRegisterEvent event) { if(event.getRecipe() instanceof DryingRecipeTweaker) { return; } for(Map.Entry<IItemStack, IItemStack> ent : DRYING_RECIPES.entrySet()) { if(ent.getKey().matches(InputHelper.toIItemStack(event.getRecipe().getResult()))) { if(ent.getValue() != null) { if(event.getRecipe().input.matches(NonNullList.withSize(1, (ItemStack) ent.getValue().getInternal())).isPresent()) { event.setCanceled(true); } } else event.setCanceled(true); } } } }
@SubscribeEvent public void onTinkerRegister(TCompRegisterEvent.MelterOverrideRegisterEvent event) { if(event.getRecipe() instanceof MeltingRecipeTweaker) { return; } for(Map.Entry<ILiquidStack, IItemStack> ent : REMOVED_RECIPES.entrySet()) { if(event.getRecipe().getResult().isFluidEqual(((FluidStack) ent.getKey().getInternal()))) { if(ent.getValue() != null) { if(event.getRecipe().input.matches(NonNullList.withSize(1, (ItemStack) ent.getValue().getInternal())).isPresent()) { event.setCanceled(true); } } else event.setCanceled(true); } } } }