|
| 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 | + */ |
1 | 24 | package aztech.modern_industrialization.compat.viewer.impl.jei; |
2 | 25 |
|
3 | 26 | import aztech.modern_industrialization.compat.viewer.abstraction.ViewerCategory; |
|
6 | 29 | import net.minecraft.client.gui.GuiGraphics; |
7 | 30 |
|
8 | 31 | public class DrawableIcon implements IDrawable { |
9 | | - private final ViewerCategory.Icon.Texture texture; |
| 32 | + private final ViewerCategory.Icon.Texture texture; |
10 | 33 |
|
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 | + } |
18 | 41 |
|
19 | | - public DrawableIcon(ViewerCategory.Icon.Texture texture) { |
20 | | - this.texture = texture; |
21 | | - } |
| 42 | + public DrawableIcon(ViewerCategory.Icon.Texture texture) { |
| 43 | + this.texture = texture; |
| 44 | + } |
22 | 45 |
|
23 | | - @Override |
24 | | - public int getWidth() { |
25 | | - return 18; |
26 | | - } |
| 46 | + @Override |
| 47 | + public int getWidth() { |
| 48 | + return 18; |
| 49 | + } |
27 | 50 |
|
28 | | - @Override |
29 | | - public int getHeight() { |
30 | | - return 18; |
31 | | - } |
| 51 | + @Override |
| 52 | + public int getHeight() { |
| 53 | + return 18; |
| 54 | + } |
32 | 55 |
|
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 | + } |
37 | 60 | } |
0 commit comments