Skip to content

Commit 77f1f70

Browse files
committed
spotless
1 parent 1256109 commit 77f1f70

File tree

2 files changed

+61
-40
lines changed

2 files changed

+61
-40
lines changed
Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2020 Azercoco & Technici4n
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
124
package aztech.modern_industrialization.compat.viewer.impl.jei;
225

326
import aztech.modern_industrialization.compat.viewer.abstraction.ViewerCategory;
@@ -6,32 +29,32 @@
629
import net.minecraft.client.gui.GuiGraphics;
730

831
public class DrawableIcon implements IDrawable {
9-
private final ViewerCategory.Icon.Texture texture;
32+
private final ViewerCategory.Icon.Texture texture;
1033

11-
public static IDrawable create(IGuiHelper guiHelper, ViewerCategory.Icon icon) {
12-
return switch (icon) {
13-
case ViewerCategory.Icon.Stack stack -> guiHelper.createDrawableItemStack(stack.stack());
14-
case ViewerCategory.Icon.Texture texture -> new DrawableIcon(texture);
15-
case null -> throw new NullPointerException("Icon cannot be null");
16-
};
17-
}
34+
public static IDrawable create(IGuiHelper guiHelper, ViewerCategory.Icon icon) {
35+
return switch (icon) {
36+
case ViewerCategory.Icon.Stack stack -> guiHelper.createDrawableItemStack(stack.stack());
37+
case ViewerCategory.Icon.Texture texture -> new DrawableIcon(texture);
38+
case null -> throw new NullPointerException("Icon cannot be null");
39+
};
40+
}
1841

19-
public DrawableIcon(ViewerCategory.Icon.Texture texture) {
20-
this.texture = texture;
21-
}
42+
public DrawableIcon(ViewerCategory.Icon.Texture texture) {
43+
this.texture = texture;
44+
}
2245

23-
@Override
24-
public int getWidth() {
25-
return 18;
26-
}
46+
@Override
47+
public int getWidth() {
48+
return 18;
49+
}
2750

28-
@Override
29-
public int getHeight() {
30-
return 18;
31-
}
51+
@Override
52+
public int getHeight() {
53+
return 18;
54+
}
3255

33-
@Override
34-
public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset) {
35-
guiGraphics.blit(texture.loc(), xOffset - 1, yOffset - 1, 0, texture.u(), texture.v(), 18, 18, 256, 256);
36-
}
56+
@Override
57+
public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset) {
58+
guiGraphics.blit(texture.loc(), xOffset - 1, yOffset - 1, 0, texture.u(), texture.v(), 18, 18, 256, 256);
59+
}
3760
}

src/client/java/aztech/modern_industrialization/compat/viewer/impl/jei/ViewerCategoryJei.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
import aztech.modern_industrialization.thirdparty.fabrictransfer.api.fluid.FluidVariant;
3131
import aztech.modern_industrialization.thirdparty.fabrictransfer.api.item.ItemVariant;
3232
import aztech.modern_industrialization.thirdparty.fabrictransfer.api.storage.TransferVariant;
33+
import java.util.List;
34+
import java.util.function.Consumer;
35+
import java.util.stream.Stream;
3336
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
3437
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
3538
import mezz.jei.api.gui.builder.ITooltipBuilder;
@@ -51,10 +54,6 @@
5154
import net.neoforged.neoforge.fluids.FluidType;
5255
import org.jetbrains.annotations.Nullable;
5356

54-
import java.util.List;
55-
import java.util.function.Consumer;
56-
import java.util.stream.Stream;
57-
5857
class ViewerCategoryJei<D> extends AbstractRecipeCategory<D> {
5958
private final IJeiHelpers helpers;
6059
public final ViewerCategory<D> wrapped;
@@ -63,12 +62,11 @@ class ViewerCategoryJei<D> extends AbstractRecipeCategory<D> {
6362

6463
public ViewerCategoryJei(IJeiHelpers helpers, ViewerCategory<D> wrapped) {
6564
super(
66-
RecipeType.create(wrapped.id.getNamespace(), wrapped.id.getPath(), wrapped.dataClass),
67-
wrapped.title,
68-
DrawableIcon.create(helpers.getGuiHelper(), wrapped.icon),
69-
wrapped.width - 8,
70-
wrapped.height - 8
71-
);
65+
RecipeType.create(wrapped.id.getNamespace(), wrapped.id.getPath(), wrapped.dataClass),
66+
wrapped.title,
67+
DrawableIcon.create(helpers.getGuiHelper(), wrapped.icon),
68+
wrapped.width - 8,
69+
wrapped.height - 8);
7270

7371
this.helpers = helpers;
7472
this.wrapped = wrapped;
@@ -99,7 +97,7 @@ public void invisibleOutput(ItemStack stack) {
9997

10098
private ViewerCategory.SlotBuilder slot(RecipeIngredientRole role, int x, int y) {
10199
var slotBuilder = builder.addSlot(role, x - 4, y - 4)
102-
.setStandardSlotBackground();
100+
.setStandardSlotBackground();
103101

104102
return new ViewerCategory.SlotBuilder() {
105103
@Override
@@ -120,12 +118,12 @@ public ViewerCategory.SlotBuilder variant(TransferVariant<?> variant) {
120118

121119
private static void addProbability(IRecipeSlotBuilder slot, float probability) {
122120
slot.addRichTooltipCallback((recipeSlotView, tooltip) -> {
123-
var input = recipeSlotView.getRole() == RecipeIngredientRole.INPUT;
124-
var probabilityLine = ViewerUtil.getProbabilityTooltip(probability, input);
125-
if (probabilityLine != null) {
126-
tooltip.add(probabilityLine);
127-
}
128-
});
121+
var input = recipeSlotView.getRole() == RecipeIngredientRole.INPUT;
122+
var probabilityLine = ViewerUtil.getProbabilityTooltip(probability, input);
123+
if (probabilityLine != null) {
124+
tooltip.add(probabilityLine);
125+
}
126+
});
129127
}
130128

131129
@Override

0 commit comments

Comments
 (0)