本文整理汇总了Java中mezz.jei.api.recipe.IFocus.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java IFocus.getValue方法的具体用法?Java IFocus.getValue怎么用?Java IFocus.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mezz.jei.api.recipe.IFocus
的用法示例。
在下文中一共展示了IFocus.getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRecipe
import mezz.jei.api.recipe.IFocus; //导入方法依赖的package包/类
@Override
public void setRecipe(IRecipeLayout recipeLayout, IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
List<ItemStack> outputs = ingredients.getOutputs(ItemStack.class).get(0);
IFocus<?> iFocus = recipeLayout.getFocus();
Object focusObject = iFocus.getValue();
if (focusObject instanceof ItemStack) {
ItemStack focus = ((ItemStack) focusObject);
Mode mode = iFocus.getMode();
if (mode == Mode.INPUT) {
EnumColour woolColour = EnumColour.fromWoolStack(focus);
if (woolColour != null) {
Frequency freq = new Frequency(woolColour, woolColour, woolColour);
ItemStack newStack = freq.writeToStack(recipe.getRecipeOutput().copy());
outputs = Collections.singletonList(newStack);
}
} else {
Frequency frequency = Frequency.readFromStack(focus);
EnumColour colour = frequency.getLeft();
inputs.set(woolIndex, woolOres.get(colour));
}
}
EnderStorageJEIPlugin.gridHelper.setInputs(guiItemStacks, inputs, 3, 3);
guiItemStacks.set(0, outputs);
}
示例2: setRecipe
import mezz.jei.api.recipe.IFocus; //导入方法依赖的package包/类
@Override
public void setRecipe(IRecipeLayout recipeLayout, HammerRecipe recipeWrapper)
{
// Block
recipeLayout.getItemStacks().init(0, true, 74, 9);
recipeLayout.getItemStacks().set(0, (ItemStack) recipeWrapper.getInputs().get(0));
IFocus<?> focus = recipeLayout.getFocus();
hasHighlight = focus.getMode() == IFocus.Mode.OUTPUT;
int slotIndex = 1;
for (int i = 0; i < recipeWrapper.getOutputs().size(); i++)
{
final int slotX = 2 + (i % 9 * 18);
final int slotY = 36 + (i / 9 * 18);
ItemStack outputStack = (ItemStack) recipeWrapper.getOutputs().get(i);
recipeLayout.getItemStacks().init(slotIndex + i, false, slotX, slotY);
recipeLayout.getItemStacks().set(slotIndex + i, outputStack);
ItemStack focusStack = (ItemStack) focus.getValue();
if (focus.getMode() == IFocus.Mode.OUTPUT && focusStack != null && focusStack.getItem() == outputStack.getItem() && focusStack.getItemDamage() == outputStack.getItemDamage())
{
highlightX = slotX;
highlightY = slotY;
}
}
recipeLayout.getItemStacks().addTooltipCallback(new HammerTooltipCallback(recipeWrapper));
}
示例3: setRecipe
import mezz.jei.api.recipe.IFocus; //导入方法依赖的package包/类
@Override
public void setRecipe(IRecipeLayout recipeLayout, FluidTransformRecipe recipeWrapper)
{
recipeLayout.getItemStacks().init(0, true, 74, 9);
recipeLayout.getItemStacks().init(1, true, 47, 9);
recipeLayout.getItemStacks().init(2, true, 74, 36);
recipeLayout.getItemStacks().init(3, false, 101, 9);
boolean noCycle = false;
List<ItemStack> focusStack = null;
IFocus<?> focus = recipeLayout.getFocus();
if(focus.getMode() == IFocus.Mode.INPUT && focus.getValue() instanceof ItemStack)
{
ItemStack stack = (ItemStack) focus.getValue();
for(ItemStack inputStack : recipeWrapper.getInputs().subList(1, recipeWrapper.getInputs().size()))
{
if(stack.isItemEqual(inputStack))
{
noCycle = true;
focusStack = ImmutableList.of(inputStack);
}
}
}
recipeLayout.getItemStacks().set(0, new ItemStack(ENBlocks.barrelStone, 1, 0));
recipeLayout.getItemStacks().set(1, recipeWrapper.getInputs().get(0));
recipeLayout.getItemStacks().set(2, noCycle ? focusStack : ImmutableList.copyOf(recipeWrapper.getInputs().subList(1, recipeWrapper.getInputs().size())));
recipeLayout.getItemStacks().set(3, recipeWrapper.getOutputs().get(0));
}
示例4: setRecipe
import mezz.jei.api.recipe.IFocus; //导入方法依赖的package包/类
@Override
public void setRecipe(IRecipeLayout layout, CompostRecipe recipe)
{
// Block
layout.getItemStacks().init(0, false, 74, 9);
layout.getItemStacks().set(0, (ItemStack) recipe.getOutputs().get(0));
IFocus<?> focus = layout.getFocus();
boolean mightHaveHighlight = focus.getMode() == IFocus.Mode.INPUT;
hasHighlight = false;
ItemStack focusStack = (ItemStack) focus.getValue();
int slotIndex = 1;
for (int i = 0; i < recipe.getInputs().size(); i++)
{
final int slotX = 2 + (i % 9 * 18);
final int slotY = 36 + (i / 9 * 18);
ItemStack inputStack = (ItemStack) recipe.getInputs().get(i);
layout.getItemStacks().init(slotIndex + i, true, slotX, slotY);
layout.getItemStacks().set(slotIndex + i, inputStack);
if (mightHaveHighlight && ItemStack.areItemsEqual(focusStack, inputStack))
{
highlightX = slotX;
highlightY = slotY;
hasHighlight = true;
mightHaveHighlight = false;
}
}
layout.getItemStacks().addTooltipCallback(new CompostTooltipCallback());
}
示例5: setRecipe
import mezz.jei.api.recipe.IFocus; //导入方法依赖的package包/类
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull PainterRecipeCategory.PainterRecipeWrapper currentRecipe,
@Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
guiItemStacks.init(0, true, 67 - xOff - 1, 34 - yOff - 1);
guiItemStacks.init(1, true, 38 - xOff - 1, 34 - yOff - 1);
guiItemStacks.init(2, false, 121 - xOff - 1, 34 - yOff - 1);
group.init(3, true, EnergyIngredientRenderer.INSTANCE, 108 - xOff, 60 - yOff, 50, 10, 0, 0);
IFocus<?> focus = recipeLayout.getFocus();
if (focus != null) {
Object focusValue = focus.getValue();
if (focusValue instanceof ItemStack) {
ItemStack focused = (ItemStack) focusValue;
List<ItemStack> paints = new ArrayList<ItemStack>();
List<ItemStack> results = new ArrayList<ItemStack>();
if (focus.getMode() == IFocus.Mode.OUTPUT) {
// JEI is focusing on the output item. Limit the recipe to the fixed input item, the focused output item and the matching paint.
IBlockState paint = PaintUtil.getSourceBlock(focused);
ItemStack paintAsStack = PaintUtil.getPaintAsStack(paint);
paints.add(paintAsStack);
results.add(focused);
} else if (stackHelper.isEquivalent(focused, currentRecipe.target)) {
// JEI is focusing on a paintable item. If that item also can be used as a paint source, it will display "item+item=anything", which is somewhere
// between weird and wrong. So remove the recipe "item+item" from the list to get "anything+item=anything".
for (int i = 0; i < currentRecipe.paints.size(); i++) {
ItemStack resultStack = currentRecipe.results.get(i);
ItemStack paintStack = currentRecipe.paints.get(i);
if (!stackHelper.isEquivalent(focused, paintStack)) {
paints.add(paintStack);
results.add(resultStack);
}
}
} else {
// JEI is focusing on the paint. Limit the output items to things that are painted with this paint.
for (ResultStack result : currentRecipe.recipe.getCompletedResult(focused, currentRecipe.target)) {
paints.add(focused);
results.add(result.item);
}
}
if (!paints.isEmpty()) {
guiItemStacks.set(1, paints);
guiItemStacks.set(2, results);
return;
}
}
}
guiItemStacks.set(0, currentRecipe.target);
guiItemStacks.set(1, currentRecipe.paints);
guiItemStacks.set(2, currentRecipe.results);
group.set(ingredients);
}
示例6: setRecipe
import mezz.jei.api.recipe.IFocus; //导入方法依赖的package包/类
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull SoulBinderRecipeCategory.SoulBinderRecipeWrapper recipeWrapper,
@Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiIngredientGroup<EnergyIngredient> group = recipeLayout.getIngredientsGroup(EnergyIngredient.class);
guiItemStacks.init(0, true, 37 - xOff, 33 - yOff);
guiItemStacks.init(1, true, 58 - xOff, 33 - yOff);
guiItemStacks.init(2, false, 111 - xOff, 33 - yOff);
guiItemStacks.init(3, false, 133 - xOff, 33 - yOff);
group.init(xOff, true, EnergyIngredientRenderer.INSTANCE, 5, 35, 60, 10, 0, 0);
guiItemStacks.set(ingredients);
IFocus<?> focus = recipeLayout.getFocus();
if (focus != null && focus.getMode() == Mode.INPUT && focus.getValue() instanceof ItemStack
&& ((ItemStack) focus.getValue()).getItem() == itemSoulVial.getItemNN() && CapturedMob.containsSoul(((ItemStack) focus.getValue()))
&& ingredients.getOutputs(ItemStack.class).get(1).size() > 1) {
// we are focused on a filled soul vial on the input side and the output has a list
final CapturedMob vialMob = CapturedMob.create(((ItemStack) focus.getValue()));
if (vialMob != null) {
List<ItemStack> newOutputs = new ArrayList<>();
for (ItemStack output : ingredients.getOutputs(ItemStack.class).get(1)) {
if (output != null && vialMob.isSameType(CapturedMob.create(output))) {
newOutputs.add(output);
}
}
guiItemStacks.set(3, newOutputs);
}
}
if (focus != null && focus.getMode() == Mode.OUTPUT && focus.getValue() instanceof ItemStack && CapturedMob.containsSoul(((ItemStack) focus.getValue()))
&& ingredients.getInputs(ItemStack.class).get(0).size() > 1 && ingredients.getOutputs(ItemStack.class).get(1).size() > 1) {
// we are focused on a output item and the both sides have a list
final CapturedMob resultMob = CapturedMob.create(((ItemStack) focus.getValue()));
if (resultMob != null) {
List<ItemStack> newInputs = new ArrayList<>();
for (ItemStack input : ingredients.getInputs(ItemStack.class).get(0)) {
if (input != null && resultMob.isSameType(CapturedMob.create(input))) {
newInputs.add(input);
}
}
guiItemStacks.set(0, newInputs);
guiItemStacks.set(3, ((ItemStack) focus.getValue()));
}
}
group.set(ingredients);
}