Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add built-in IDrawable for drawing basic ingredients
- Loading branch information
Showing
9 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ curse_project_id=238222 | |
|
||
version_major=4 | ||
version_minor=9 | ||
version_patch=0 | ||
version_patch=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/mezz/jei/gui/elements/DrawableIngredient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package mezz.jei.gui.elements; | ||
|
||
import mezz.jei.api.gui.IDrawable; | ||
import mezz.jei.api.ingredients.IIngredientRenderer; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.GlStateManager; | ||
|
||
public class DrawableIngredient<V> implements IDrawable { | ||
private final V ingredient; | ||
private final IIngredientRenderer<V> ingredientRenderer; | ||
|
||
public DrawableIngredient(V ingredient, IIngredientRenderer<V> ingredientRenderer) { | ||
this.ingredient = ingredient; | ||
this.ingredientRenderer = ingredientRenderer; | ||
} | ||
|
||
@Override | ||
public int getWidth() { | ||
return 16; | ||
} | ||
|
||
@Override | ||
public int getHeight() { | ||
return 16; | ||
} | ||
|
||
@Override | ||
public void draw(Minecraft minecraft, int xOffset, int yOffset) { | ||
GlStateManager.enableDepth(); | ||
this.ingredientRenderer.render(minecraft, xOffset, yOffset, ingredient); | ||
GlStateManager.enableAlpha(); | ||
GlStateManager.disableDepth(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters