mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-21 12:32:19 +00:00
Merge remote-tracking branch 'koolkrafter5/meteor-nei' into dev
This commit is contained in:
11 files changed
+466
-23
No files matched your search
@@ -7,8 +7,9 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
public class IMCForNEI {
|
||||
|
||||
public static void IMCSender() {
|
||||
sendHandler("alchemicalwizardry.meteor", "AWWayofTime:masterStone", 130);
|
||||
sendHandler("alchemicalwizardry.meteor", "AWWayofTime:masterStone", 181);
|
||||
sendCatalyst("alchemicalwizardry.meteor", "AWWayofTime:masterStone");
|
||||
sendCatalyst("alchemicalwizardry.bindingritual", "AWWayofTime:masterStone");
|
||||
}
|
||||
|
||||
private static void sendHandler(String handlerName, String stack, int height) {
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRecipe;
|
||||
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.ReagentInfo;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.RitualInfo;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
/**
|
||||
@@ -16,6 +24,9 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
*/
|
||||
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 +64,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 +75,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
super.drawExtras(recipe);
|
||||
|
||||
// Only shows these for the first result
|
||||
if (recipe == 0) {
|
||||
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 (recipeIndex == 0 && 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";
|
||||
|
||||
@@ -13,6 +13,7 @@ import codechicken.nei.api.IConfigureNEI;
|
||||
public class NEIConfig implements IConfigureNEI {
|
||||
|
||||
private static ArrayList<Item> bloodOrbs = null;
|
||||
private static ArrayList<Item> byCapacity = null;
|
||||
|
||||
public static ArrayList<Item> getBloodOrbs() {
|
||||
if (bloodOrbs == null) {
|
||||
@@ -44,6 +45,19 @@ public class NEIConfig implements IConfigureNEI {
|
||||
return bloodOrbsTemp;
|
||||
}
|
||||
|
||||
public static ArrayList<Item> getOrbsByCapacity() {
|
||||
if (byCapacity == null) {
|
||||
byCapacity = new ArrayList<>(getBloodOrbs());
|
||||
byCapacity.sort((a, b) -> {
|
||||
if (a instanceof IBloodOrb && b instanceof IBloodOrb) {
|
||||
return Integer.compare(((IBloodOrb) a).getMaxEssence(), ((IBloodOrb) b).getMaxEssence());
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
return byCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.registerRecipeHandler(new NEIAlchemyRecipeHandler());
|
||||
|
||||
+130
-15
@@ -1,51 +1,70 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.CostInfo;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.RadiusInfo;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.ReagentInfo;
|
||||
import WayofTime.alchemicalWizardry.client.nei.widgets.RitualInfo;
|
||||
import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor;
|
||||
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent;
|
||||
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorReagent;
|
||||
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorReagentRegistry;
|
||||
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
private static final RitualInfo ritualInfo = new RitualInfo("AW019FallingTower", 0.75f);
|
||||
private static final ReagentInfo reagentInfo = new ReagentInfo(0.75f);
|
||||
|
||||
public class CachedMeteorRecipe extends CachedRecipe {
|
||||
|
||||
private final List<PositionedStack> input = new ArrayList<>();
|
||||
private final List<PositionedStack> outputs = new ArrayList<>();
|
||||
private final int cost;
|
||||
private final int radius;
|
||||
private final CostInfo costInfo;
|
||||
private final RadiusInfo radiusInfo;
|
||||
private Point focus;
|
||||
|
||||
public float fillerChance;
|
||||
|
||||
public CachedMeteorRecipe(Meteor meteor, ItemStack focusStack) {
|
||||
this.input.add(new PositionedStack(meteor.focusItem, 74, 4));
|
||||
this.input.add(new PositionedStack(meteor.focusItem, 75, 4));
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
float totalComponentWeight = MeteorComponent.getTotalListWeight(meteor.ores);
|
||||
float fillerChance = meteor.fillerChance;
|
||||
fillerChance = meteor.fillerChance;
|
||||
List<MeteorComponent> sortedComponents = new ArrayList<>(meteor.ores);
|
||||
sortedComponents.sort(Comparator.comparingInt(c -> -c.getWeight()));
|
||||
|
||||
@@ -115,8 +134,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
}
|
||||
|
||||
this.radius = meteor.radius;
|
||||
this.cost = meteor.cost;
|
||||
this.costInfo = new CostInfo(meteor.cost);
|
||||
this.radiusInfo = new RadiusInfo(meteor.radius);
|
||||
}
|
||||
|
||||
private String getReagentStrings(MeteorComponent component) {
|
||||
@@ -144,11 +163,11 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
return costInfo.getCost();
|
||||
}
|
||||
|
||||
public int getRadius() {
|
||||
return radius;
|
||||
return radiusInfo.getRadius();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,12 +257,10 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
CachedMeteorRecipe meteorRecipe = (CachedMeteorRecipe) this.arecipes.get(recipe);
|
||||
int cost = meteorRecipe.getCost();
|
||||
int radius = meteorRecipe.getRadius();
|
||||
Minecraft.getMinecraft().fontRenderer
|
||||
.drawString(I18n.format("nei.recipe.meteor.cost", String.format("%,d", cost)), 2, 168, 0x000000);
|
||||
Minecraft.getMinecraft().fontRenderer
|
||||
.drawString(I18n.format("nei.recipe.meteor.radius", radius), 2, 179, 0x000000);
|
||||
meteorRecipe.costInfo.onDraw(30, 4);
|
||||
meteorRecipe.radiusInfo.onDraw(120, 4);
|
||||
ritualInfo.onDraw(0, 0);
|
||||
reagentInfo.onDraw(153, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -275,6 +292,96 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@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 CachedMeteorRecipe) {
|
||||
CachedMeteorRecipe cachedRecipe = (CachedMeteorRecipe) cRecipe;
|
||||
Rectangle rect = cachedRecipe.costInfo.getRect(gui);
|
||||
if (rect.contains(mousePos)) {
|
||||
list.add(StatCollector.translateToLocal("nei.recipe.meteor.cost"));
|
||||
if (SoulNetworkHandler.getCurrentEssence(mc.thePlayer.getDisplayName()) < cachedRecipe.getCost()) {
|
||||
list.add(
|
||||
EnumChatFormatting.RED
|
||||
+ StatCollector.translateToLocal("nei.recipe.meteor.tooExpensive"));
|
||||
}
|
||||
}
|
||||
|
||||
rect = cachedRecipe.radiusInfo.getRect(gui);
|
||||
if (rect.contains(mousePos)) {
|
||||
list.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"nei.recipe.meteor.diameter",
|
||||
2 * cachedRecipe.radiusInfo.getRadius() + 1));
|
||||
}
|
||||
|
||||
rect = ritualInfo.getRect(gui);
|
||||
if (rect.contains(mousePos)) {
|
||||
ritualInfo.onHover(list);
|
||||
}
|
||||
|
||||
rect = reagentInfo.getRect(gui);
|
||||
if (rect.contains(mousePos)) {
|
||||
reagentInfo.onHover(list);
|
||||
addMeteorReagentInfo(list, cachedRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.handleTooltip(gui, list, recipeIndex);
|
||||
}
|
||||
|
||||
private void addMeteorReagentInfo(List<String> list, CachedMeteorRecipe cachedRecipe) {
|
||||
DecimalFormat fmt = new DecimalFormat("###.##");
|
||||
for (Map.Entry<Reagent, MeteorReagent> entry : MeteorReagentRegistry.reagents.entrySet()) {
|
||||
ArrayList<String> l = new ArrayList<>();
|
||||
Reagent r = entry.getKey();
|
||||
MeteorReagent mr = entry.getValue();
|
||||
|
||||
if (mr.radiusChange != 0) {
|
||||
l.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"nei.recipe.reagent.meteor.radius",
|
||||
mr.radiusChange,
|
||||
Meteor.getNewRadius(cachedRecipe.getRadius(), Collections.singletonList(r))));
|
||||
}
|
||||
|
||||
if (cachedRecipe.fillerChance > 0) {
|
||||
if (mr.fillerChanceChange != 0 || mr.rawFillerChanceChange != 0) {
|
||||
l.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"nei.recipe.reagent.meteor.filler.chance",
|
||||
fmt.format(
|
||||
Meteor.getNewFillerChance(
|
||||
cachedRecipe.fillerChance,
|
||||
Collections.singletonList(r)))));
|
||||
}
|
||||
|
||||
if (!mr.filler.isEmpty()) {
|
||||
l.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"nei.recipe.reagent.meteor.filler.blocks",
|
||||
reagentFillerBlockNames(mr)));
|
||||
}
|
||||
}
|
||||
|
||||
if (mr.disableExplosions) {
|
||||
l.add(StatCollector.translateToLocal("nei.recipe.reagent.meteor.explosions"));
|
||||
} else if (mr.invertExplosionBlockDamage && AlchemicalWizardry.doMeteorsDestroyBlocks) {
|
||||
l.add(StatCollector.translateToLocal("nei.recipe.reagent.meteor.blockDamage.off"));
|
||||
} else if (mr.invertExplosionBlockDamage) {
|
||||
l.add(StatCollector.translateToLocal("nei.recipe.reagent.meteor.blockDamage.on"));
|
||||
}
|
||||
|
||||
if (!l.isEmpty()) {
|
||||
list.add(r.name + ":");
|
||||
list.addAll(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return I18n.format("nei.recipe.meteor.category");
|
||||
@@ -292,4 +399,12 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
private int getEstimatedAmount(float chance, int radius) {
|
||||
return (int) Math.ceil(4f / 3 * Math.PI * Math.pow(radius + 0.5, 3) * chance);
|
||||
}
|
||||
|
||||
private String reagentFillerBlockNames(MeteorReagent mr) {
|
||||
ArrayList<String> blockNames = new ArrayList<>();
|
||||
for (MeteorComponent mc : mr.filler) {
|
||||
blockNames.add(mc.getBlock().getDisplayName());
|
||||
}
|
||||
return Joiner.on(", ").join(blockNames);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package WayofTime.alchemicalWizardry.client.nei.widgets;
|
||||
|
||||
import static WayofTime.alchemicalWizardry.client.ClientUtils.mc;
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
|
||||
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getOrbsByCapacity;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
|
||||
public class CostInfo {
|
||||
|
||||
private final int cost;
|
||||
private int prevX, prevY;
|
||||
private final int orbLP;
|
||||
private final ItemStack orbStack;
|
||||
private static final RenderItem renderItem = new RenderItem();
|
||||
static {
|
||||
renderItem.renderWithColor = false;
|
||||
}
|
||||
|
||||
public CostInfo(int cost) {
|
||||
this.cost = cost;
|
||||
|
||||
Item orb = null;
|
||||
getOrbsByCapacity();
|
||||
ArrayList<Item> orbList = getBloodOrbs();
|
||||
for (Item o : orbList) {
|
||||
if (((IBloodOrb) o).getMaxEssence() >= cost) {
|
||||
orb = o;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (orb == null) {
|
||||
orb = orbList.get(orbList.size() - 1);
|
||||
}
|
||||
|
||||
orbLP = ((IBloodOrb) orb).getMaxEssence();
|
||||
orbStack = new ItemStack(orb);
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public void onDraw(int x, int y) {
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
int currentLP = SoulNetworkHandler.getCurrentEssence(mc.thePlayer.getDisplayName());
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (orbLP > currentLP) {
|
||||
GL11.glColor4f(0.4f, 0.4f, 0.4f, 1.0f);
|
||||
} else {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), orbStack, x, y);
|
||||
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
String costText = String.format("%,d", cost);
|
||||
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 + 4, gui.guiTop + prevY + 14, 18, 18);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
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;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
|
||||
public class ReagentInfo {
|
||||
|
||||
private final float scale;
|
||||
private int prevX, prevY;
|
||||
private static final RenderItem renderItem = new RenderItem();
|
||||
private static final ItemStack item = new ItemStack(ModBlocks.blockReagentConduit);
|
||||
|
||||
public ReagentInfo(float scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public void onDraw(int x, int y) {
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, 0);
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
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.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
|
||||
public class RitualInfo {
|
||||
|
||||
private final String id;
|
||||
private final int cost;
|
||||
private final float scale;
|
||||
private final ItemStack crystal;
|
||||
private int prevX, prevY;
|
||||
private static final RenderItem renderItem = new RenderItem();
|
||||
|
||||
public RitualInfo(String id, float scale) {
|
||||
this.id = id;
|
||||
this.scale = scale;
|
||||
this.cost = Rituals.getCostForActivation(id);
|
||||
Rituals r = Rituals.ritualMap.get(id);
|
||||
|
||||
// This is hardcoded unlike the orbs. I'm not aware of any addon that makes tier 3 rituals or crystals.
|
||||
if (r == null || r.crystalLevel == 1) {
|
||||
crystal = new ItemStack(ModItems.activationCrystal);
|
||||
} else {
|
||||
crystal = new ItemStack(ModItems.activationCrystal, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public void onDraw(int x, int y) {
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, 0);
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
renderItem.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), crystal, 0, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public Rectangle getRect(GuiRecipe<?> gui) {
|
||||
return new Rectangle(gui.guiLeft + prevX + 4, gui.guiTop + prevY + 14, (int) (18 * scale), (int) (18 * scale));
|
||||
}
|
||||
|
||||
public void onHover(List<String> list) {
|
||||
list.add(
|
||||
StatCollector
|
||||
.translateToLocalFormatted("nei.recipe.ritual.name", Rituals.getLocalizedNameOfRitual(id)));
|
||||
list.add(StatCollector.translateToLocalFormatted("nei.recipe.ritual.cost", this.cost));
|
||||
}
|
||||
}
|
||||
@@ -87,13 +87,13 @@ public class Meteor {
|
||||
}
|
||||
}
|
||||
|
||||
private int getNewRadius(int radius, List<Reagent> reagents) {
|
||||
public static int getNewRadius(int radius, List<Reagent> reagents) {
|
||||
radius += MeteorReagentRegistry.getLargestRadiusIncrease(reagents);
|
||||
radius += MeteorReagentRegistry.getLargestRadiusDecrease(reagents);
|
||||
return Math.max(radius, 1);
|
||||
}
|
||||
|
||||
private float getNewFillerChance(float fillerChance, List<Reagent> reagents) {
|
||||
public static float getNewFillerChance(float fillerChance, List<Reagent> reagents) {
|
||||
// Don't add filler to meteors that have none
|
||||
if (fillerChance <= 0) {
|
||||
return 0;
|
||||
@@ -120,7 +120,7 @@ public class Meteor {
|
||||
* @return a new filler list. The original list is entirely replaced if any of the supplied reagents have a filler
|
||||
* config.
|
||||
*/
|
||||
private List<MeteorComponent> getNewFillerList(List<MeteorComponent> fillerList, List<Reagent> reagents) {
|
||||
public static List<MeteorComponent> getNewFillerList(List<MeteorComponent> fillerList, List<Reagent> reagents) {
|
||||
List<MeteorComponent> reagentFillers = getFillerList(reagents);
|
||||
reagentFillers = removeBlocksMissingRequiredReagents(reagentFillers, reagents);
|
||||
if (!reagentFillers.isEmpty() && reagentFillers.get(0) != defaultMeteorBlock) {
|
||||
@@ -129,7 +129,7 @@ public class Meteor {
|
||||
return removeBlocksMissingRequiredReagents(fillerList, reagents);
|
||||
}
|
||||
|
||||
private List<MeteorComponent> removeBlocksMissingRequiredReagents(List<MeteorComponent> blockList,
|
||||
public static List<MeteorComponent> removeBlocksMissingRequiredReagents(List<MeteorComponent> blockList,
|
||||
List<Reagent> reagents) {
|
||||
ArrayList<MeteorComponent> newList = new ArrayList<>();
|
||||
for (MeteorComponent component : blockList) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -275,12 +275,24 @@ text.recipe.altar.tier=Tier: %s
|
||||
text.recipe.altar.bloodRequired=LP: %s
|
||||
text.recipe.shapedOrb=Shaped Orb Recipe
|
||||
nei.recipe.meteor.category=Meteor Ritual
|
||||
nei.recipe.meteor.cost=Cost: %s LP
|
||||
nei.recipe.meteor.cost=LP cost to summon this meteor
|
||||
nei.recipe.meteor.tooExpensive=Insufficient LP in Soul Network
|
||||
nei.recipe.meteor.radius=Radius: %s
|
||||
nei.recipe.meteor.diameter=Diameter: %d (2r + 1)
|
||||
nei.recipe.meteor.chance=Chance: %s%%
|
||||
nei.recipe.meteor.amount=Estimated amount: %s
|
||||
nei.recipe.meteor.filler=§7Filler block
|
||||
nei.recipe.meteor.reagent=§nRequired reagent§r: %s
|
||||
nei.recipe.ritual.name=Ritual Name: %s
|
||||
nei.recipe.ritual.cost=Activation Cost: %,d
|
||||
nei.recipe.reagent.text=Reagent Effects:
|
||||
nei.recipe.reagent.meteor.radius= %+d radius (%s)
|
||||
nei.recipe.reagent.meteor.filler.chance= Changes chance for filler block to %f%%
|
||||
nei.recipe.reagent.meteor.filler.blocks= Replaces filler with %s
|
||||
nei.recipe.reagent.meteor.explosions= Entirely disables meteor explosions
|
||||
nei.recipe.reagent.meteor.blockDamage.on= Enables meteor block damage
|
||||
nei.recipe.reagent.meteor.blockDamage.off= Disables meteor block damage
|
||||
nei.recipe.reagent.none=No reagents can be added to this ritual.
|
||||
|
||||
#Rituals
|
||||
ritual.AW001Water.name=Ritual of the Full Spring
|
||||
|
||||
Reference in new issue
Block a user