mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 07:13:14 +00:00
Add a new Ritual Info widget that shows the required activation crystal, ritual name, and activation cost when hovered. Suitable for use in any other NEI ritual handlers. Move the cost and radius to the top of the page so they don't get hidden with certain UI scales. Cost now shows the blood orb required (works with any IBloodOrb, but does not account for Runes of the Orb). The orb is darkened and the hover text includes "Insufficient LP" if the player does not have enough LP to summon that meteor. Radius shows the diameter (and its formula because it's actually 2r + 1) when hovered. Add a new Reagent Effects widget (also suitable for use in other handlers), and have it show effects for the currently selected meteor (meteors with no filler will not show things that impact filler, new filler chance will be calculated, new radius will be calculated). Center focus item and arrow on the texture because they were not centered before.
52 lines
1.5 KiB
Java
52 lines
1.5 KiB
Java
package WayofTime.alchemicalWizardry.client.nei.widgets;
|
|
|
|
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
|
|
|
import java.awt.Rectangle;
|
|
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
import net.minecraft.client.renderer.entity.RenderItem;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.StatCollector;
|
|
|
|
import WayofTime.alchemicalWizardry.ModItems;
|
|
import codechicken.nei.recipe.GuiRecipe;
|
|
|
|
public class RadiusInfo {
|
|
|
|
private final int radius;
|
|
private int prevX, prevY;
|
|
private static final RenderItem renderItem = new RenderItem();
|
|
// It's a circle with a dot in the center. Couldn't ask for a better item!
|
|
private static final ItemStack item = new ItemStack(ModItems.demonPlacer);
|
|
|
|
public RadiusInfo(int radius) {
|
|
this.radius = radius;
|
|
}
|
|
|
|
public int getRadius() {
|
|
return radius;
|
|
}
|
|
|
|
public void onDraw(int x, int y) {
|
|
prevX = x;
|
|
prevY = y;
|
|
|
|
renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, x, y);
|
|
|
|
String costText = StatCollector.translateToLocalFormatted("nei.recipe.meteor.radius", radius);
|
|
FontRenderer fontRenderer = mc.fontRenderer;
|
|
|
|
int textWidth = fontRenderer.getStringWidth(costText);
|
|
int textX = x + 9 - (textWidth / 2);
|
|
int textY = y + 18;
|
|
|
|
fontRenderer.drawString(costText, textX, textY, 0x000000);
|
|
}
|
|
|
|
public Rectangle getRect(GuiRecipe<?> gui) {
|
|
return new Rectangle(gui.guiLeft + prevX + 5, gui.guiTop + prevY + 15, 16, 16);
|
|
}
|
|
|
|
}
|