use of mezz.jei.api.gui.drawable.IDrawableStatic in project Electrodynamics by aurilisdev.
the class ElectrodynamicsRecipeCategory method setOutputSlots.
public void setOutputSlots(IGuiHelper guiHelper, GenericItemSlotWrapper... outputSlots) {
outSlots = outputSlots;
OUTPUT_SLOTS = CacheBuilder.newBuilder().maximumSize(outputSlots.length).build(new CacheLoader<Integer, List<IDrawableStatic>>() {
@Override
public List<IDrawableStatic> load(Integer time) {
List<IDrawableStatic> slots = new ArrayList<>();
for (ScreenObjectWrapper slot : outputSlots) {
slots.add(guiHelper.drawableBuilder(new ResourceLocation(MOD_ID, slot.getTexture()), slot.getTextX(), slot.getTextY(), slot.getLength(), slot.getWidth()).build());
}
return slots;
}
});
}
use of mezz.jei.api.gui.drawable.IDrawableStatic in project Electrodynamics by aurilisdev.
the class ModFurnaceRecipeCategory method setInputSlots.
public void setInputSlots(IGuiHelper guiHelper, GenericItemSlotWrapper... inputSlots) {
inSlots = inputSlots;
INPUT_SLOTS = CacheBuilder.newBuilder().maximumSize(inputSlots.length).build(new CacheLoader<Integer, List<IDrawableStatic>>() {
@Override
public List<IDrawableStatic> load(Integer time) {
List<IDrawableStatic> slots = new ArrayList<>();
for (ScreenObjectWrapper slot : inputSlots) {
slots.add(guiHelper.drawableBuilder(new ResourceLocation(MOD_ID, slot.getTexture()), slot.getTextX(), slot.getTextY(), slot.getLength(), slot.getWidth()).build());
}
return slots;
}
});
}
use of mezz.jei.api.gui.drawable.IDrawableStatic in project RoughlyEnoughItems by shedaniel.
the class JEIDrawableBuilder method build.
@Override
@NotNull
public IDrawableStatic build() {
int actualWidth = width + paddingLeft + paddingRight;
int actualHeight = height + paddingTop + paddingBottom;
return new IDrawableStatic() {
/**
* The following method is licensed with The MIT License (MIT)
* Copyright (c) 2014-2015 mezz
*
* Full license text can be found in the https://github.com/mezz/JustEnoughItems/blob/1.17/LICENSE.txt
*/
@Override
public void draw(@NotNull PoseStack matrixStack, int xOffset, int yOffset, int maskTop, int maskBottom, int maskLeft, int maskRight) {
RenderSystem.setShaderTexture(0, texture);
Matrix4f matrix = matrixStack.last().pose();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
BufferBuilder bufferBuilder = Tesselator.getInstance().getBuilder();
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
int xStart = xOffset + JEIDrawableBuilder.this.paddingLeft + maskLeft;
int yStart = yOffset + JEIDrawableBuilder.this.paddingTop + maskTop;
int u = JEIDrawableBuilder.this.u + maskLeft;
int v = JEIDrawableBuilder.this.v + maskTop;
int width = JEIDrawableBuilder.this.width - maskRight - maskLeft;
int height = JEIDrawableBuilder.this.height - maskBottom - maskTop;
float f = 1.0F / JEIDrawableBuilder.this.textureWidth;
float f1 = 1.0F / JEIDrawableBuilder.this.textureHeight;
float z = 0.0F;
float xEnd = xStart + width;
float yEnd = yStart + height;
float uStart = u * f;
float uEnd = (u + width) * f;
float vStart = v * f1;
float vEnd = (v + height) * f1;
bufferBuilder.vertex(matrix, xStart, yEnd, z).uv(uStart, vEnd).endVertex();
bufferBuilder.vertex(matrix, xEnd, yEnd, z).uv(uEnd, vEnd).endVertex();
bufferBuilder.vertex(matrix, xEnd, yStart, z).uv(uEnd, vStart).endVertex();
bufferBuilder.vertex(matrix, xStart, yStart, z).uv(uStart, vStart).endVertex();
bufferBuilder.end();
BufferUploader.end(bufferBuilder);
}
@Override
public void draw(@NotNull PoseStack matrixStack, int xOffset, int yOffset) {
draw(matrixStack, xOffset, yOffset, 0, 0, 0, 0);
}
@Override
public int getWidth() {
return actualWidth;
}
@Override
public int getHeight() {
return actualHeight;
}
};
}
Aggregations