Add RecipeCatalyst system

This commit is contained in:
miozune committed 2022-01-09 18:48:33 +09:00
1 parent 98c9f03e74
commit 98b6e552c4
16 files changed
+474 -18

No files matched your search

@@ -30,11 +30,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -76,6 +72,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
private final Rectangle area = new Rectangle();
private final GuiRecipeTabs recipeTabs;
private final GuiRecipeCatalyst guiRecipeCatalyst;
private IRecipeHandler handler;
private HandlerInfo handlerInfo;
@@ -84,6 +81,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
protected GuiRecipe(GuiScreen prevgui) {
super(new ContainerRecipe());
recipeTabs = new GuiRecipeTabs(this);
guiRecipeCatalyst = new GuiRecipeCatalyst(this);
slotcontainer = (ContainerRecipe) inventorySlots;
this.prevGui = prevgui;
@@ -267,7 +265,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
return handler.getIngredientStacks(idx);
}
}
return null;
}
@@ -454,6 +452,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
}
public void refreshPage() {
RecipeCatalysts.updatePosition(ySize - BG_TOP_HEIGHT - (GuiRecipeCatalyst.fullBorder * 2));
refreshSlots();
final int recipesPerPage = getRecipesPerPage();
final boolean multiplepages = handler.numRecipes() > recipesPerPage;
@@ -503,6 +502,13 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
PositionedStack result = handler.getResultStack(i);
if (result != null)
slotcontainer.addSlot(result, p.x, p.y);
List<PositionedStack> catalysts = RecipeCatalysts.getRecipeCatalysts(handler.getClass());
for (PositionedStack catalyst : catalysts) {
int xOffset = -GuiRecipeCatalyst.ingredientSize;
int yOffset = BG_TOP_Y + GuiRecipeCatalyst.fullBorder;
slotcontainer.addSlot(catalyst, xOffset, yOffset);
}
}
}
@@ -587,6 +593,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
RenderHelper.enableGUIStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
recipeTabs.draw(mouseX, mouseY);
guiRecipeCatalyst.draw();
RenderHelper.disableStandardItemLighting();
}