mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-17 10:55:10 +00:00
Add ritual (name and cost) and reagent (message saying there are none that apply) to the binding ritual handler. It shows them for every recipe. It should only show once per page, but I'm stumped on how to actually do that.
This commit is contained in:
1 parent
b02fa2f32d
commit
f74f42d0f9
5 files changed
+60
-3
No files matched your search
@@ -9,6 +9,7 @@ public class IMCForNEI {
|
||||
public static void IMCSender() {
|
||||
sendHandler("alchemicalwizardry.meteor", "AWWayofTime:masterStone", 130);
|
||||
sendCatalyst("alchemicalwizardry.meteor", "AWWayofTime:masterStone");
|
||||
sendCatalyst("alchemicalwizardry.bindingritual", "AWWayofTime:masterStone");
|
||||
}
|
||||
|
||||
private static void sendHandler(String handlerName, String stack, int height) {
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.ReagentInfo;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.RitualInfo;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
|
||||
@@ -10,12 +19,18 @@ import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
|
||||
/**
|
||||
* Binding Ritual Handler by Arcaratus
|
||||
*/
|
||||
public class NEIBindingRitualHandler extends TemplateRecipeHandler {
|
||||
|
||||
private static final RitualInfo ritualInfo = new RitualInfo("AW006Binding", 1f);
|
||||
private static final ReagentInfo reagentInfo = new ReagentInfo(1f);
|
||||
|
||||
public class CachedBindingRecipe extends CachedRecipe {
|
||||
|
||||
PositionedStack input, output;
|
||||
@@ -53,7 +68,7 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler {
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (BindingRecipe recipe : BindingRegistry.bindingRecipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.outputItem, result)) {
|
||||
if (recipe != null && recipe.outputItem != null) {
|
||||
if (recipe.outputItem != null) {
|
||||
arecipes.add(new CachedBindingRecipe(recipe));
|
||||
}
|
||||
}
|
||||
@@ -64,13 +79,45 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler {
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (BindingRecipe recipe : BindingRegistry.bindingRecipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(recipe.requiredItem, ingredient)) {
|
||||
if (recipe != null && recipe.outputItem != null) {
|
||||
if (recipe.outputItem != null) {
|
||||
arecipes.add(new CachedBindingRecipe(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws for every recipe, but it should really just do it once per page.
|
||||
* @param recipe The recipeIndex being drawn
|
||||
*/
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
super.drawExtras(recipe);
|
||||
ritualInfo.onDraw(0, 0);
|
||||
reagentInfo.onDraw(150, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> list, int recipeIndex) {
|
||||
if (GuiContainerManager.shouldShowTooltip(gui) && list.isEmpty()) {
|
||||
CachedRecipe cRecipe = arecipes.get(recipeIndex);
|
||||
Point mousePos = GuiDraw.getMousePosition();
|
||||
|
||||
if (cRecipe instanceof NEIBindingRitualHandler.CachedBindingRecipe) {
|
||||
Rectangle rect = ritualInfo.getRect(gui);
|
||||
if (rect.contains(mousePos)) {
|
||||
ritualInfo.onHover(list);
|
||||
}
|
||||
|
||||
rect = reagentInfo.getRect(gui);
|
||||
if (rect.contains(mousePos)) {
|
||||
list.add(StatCollector.translateToLocal("nei.recipe.reagent.none"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.handleTooltip(gui, list, recipeIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "alchemicalwizardry.bindingritual";
|
||||
|
||||
@@ -323,7 +323,6 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
rect = reagentInfo.getRect(gui);
|
||||
if (rect.contains(mousePos)) {
|
||||
list.add(StatCollector.translateToLocal("nei.recipe.reagent.text"));
|
||||
addMeteorReagentInfo(list, cachedRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package WayofTime.alchemicalWizardry.client.nei.widgets;
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
@@ -37,4 +39,11 @@ public class ReagentInfo {
|
||||
public Rectangle getRect(GuiRecipe<?> gui) {
|
||||
return new Rectangle(gui.guiLeft + prevX + 4, gui.guiTop + prevY + 14, (int) (18 * scale), (int) (18 * scale));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the text Reagent effects: to the tooltip list.
|
||||
*/
|
||||
public void onHover(List<String> list) {
|
||||
list.add(StatCollector.translateToLocal("nei.recipe.reagent.text"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user