mirror of
https://github.com/GTNewHorizons/Advanced-Botany.git
synced 2026-11-25 22:34:27 +00:00
no message
This commit is contained in:
1 parent
8c1bd5995b
commit
93f114dceb
645 files changed
+59797
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package ab.client.nei;
|
||||
|
||||
import ab.AdvancedBotany;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.recipe.ICraftingHandler;
|
||||
import codechicken.nei.recipe.IUsageHandler;
|
||||
|
||||
public class NEIConfig implements IConfigureNEI {
|
||||
|
||||
public String getName() {
|
||||
return AdvancedBotany.modid;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return AdvancedBotany.version;
|
||||
}
|
||||
|
||||
public void loadConfig() {
|
||||
API.registerRecipeHandler((ICraftingHandler)new RecipeHandlerAlphirine());
|
||||
API.registerUsageHandler((IUsageHandler)new RecipeHandlerAlphirine());
|
||||
API.registerRecipeHandler((ICraftingHandler)new RecipeHandlerAdvancedPlate());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package ab.client.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import ab.api.AdvancedBotanyAPI;
|
||||
import ab.api.recipe.RecipeAdvancedPlate;
|
||||
import ab.client.core.ClientHelper;
|
||||
import ab.client.nei.RecipeHandlerAlphirine.CachedHandlerAlphirine;
|
||||
import ab.common.lib.register.BlockListAB;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class RecipeHandlerAdvancedPlate extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedAdvancedPlateRecipe extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
|
||||
public PositionedStack output;
|
||||
public int manaUsage;
|
||||
|
||||
public CachedAdvancedPlateRecipe(RecipeAdvancedPlate recipe) {
|
||||
setIngredients(recipe.getInputs());
|
||||
this.output = new PositionedStack(recipe.getOutput(), 111, 21);
|
||||
this.inputs.add(new PositionedStack(new ItemStack(BlockListAB.blockABPlate), 73, 55));
|
||||
this.manaUsage = recipe.getManaUsage();
|
||||
}
|
||||
|
||||
public void setIngredients(List<ItemStack> inputs) {
|
||||
float degreePerInput = 360.0F / inputs.size();
|
||||
float currentDegree = -90.0F;
|
||||
for (Object o : inputs) {
|
||||
int posX = (int)Math.round(73.0D + Math.cos(currentDegree * Math.PI / 180.0D) * 32.0D);
|
||||
int posY = (int)Math.round(55.0D + Math.sin(currentDegree * Math.PI / 180.0D) * 32.0D);
|
||||
this.inputs.add(new PositionedStack(o, posX, posY));
|
||||
currentDegree += degreePerInput;
|
||||
}
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(RecipeHandlerAdvancedPlate.this.cycleticks / 20, this.inputs);
|
||||
}
|
||||
|
||||
public PositionedStack getResult() {
|
||||
return this.output;
|
||||
}
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("ab.nei.advancedPlate");
|
||||
}
|
||||
|
||||
public String getRecipeID() {
|
||||
return "ab.advancedPlate";
|
||||
}
|
||||
|
||||
public String getGuiTexture() {
|
||||
return "botania:textures/gui/neiBlank.png";
|
||||
}
|
||||
|
||||
public void loadTransferRects() {
|
||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID(), new Object[0]));
|
||||
}
|
||||
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GuiDraw.changeTexture("botania:textures/gui/petalOverlay.png");
|
||||
GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
|
||||
int mana = ((CachedAdvancedPlateRecipe)this.arecipes.get(recipe)).manaUsage;
|
||||
ClientHelper.renderPoolManaBar(32, 112, 0x239ddc, 1.0f, mana);
|
||||
}
|
||||
|
||||
public CachedAdvancedPlateRecipe getCachedRecipe(RecipeAdvancedPlate recipe) {
|
||||
return new CachedAdvancedPlateRecipe(recipe);
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getRecipeID())) {
|
||||
for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
|
||||
this.arecipes.add(getCachedRecipe(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (((recipe.getOutput()).stackTagCompound != null && NEIServerUtils.areStacksSameType(recipe.getOutput(), result)) || ((recipe.getOutput()).stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)))
|
||||
this.arecipes.add(getCachedRecipe(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
|
||||
if (recipe == null)
|
||||
continue;
|
||||
CachedAdvancedPlateRecipe crecipe = getCachedRecipe(recipe);
|
||||
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package ab.client.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import ab.api.AdvancedBotanyAPI;
|
||||
import ab.api.recipe.RecipeAncientAlphirine;
|
||||
import ab.client.core.ClientHelper;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
public class RecipeHandlerAlphirine extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedHandlerAlphirine extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
|
||||
public PositionedStack output;
|
||||
public List<PositionedStack> otherStacks = new ArrayList<PositionedStack>();
|
||||
public int chance;
|
||||
|
||||
public CachedHandlerAlphirine(RecipeAncientAlphirine recipe) {
|
||||
if (recipe == null)
|
||||
return;
|
||||
this.inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType("ancientAlphirine"), 71, 23));
|
||||
this.inputs.add(new PositionedStack(recipe.getInput(), 42, 23));
|
||||
this.output = new PositionedStack(recipe.getOutput(), 101, 23);
|
||||
this.chance = recipe.getChance();
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(RecipeHandlerAlphirine.this.cycleticks / 20, this.inputs);
|
||||
}
|
||||
|
||||
public PositionedStack getResult() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return this.otherStacks;
|
||||
}
|
||||
|
||||
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
|
||||
if (ingredients == this.inputs)
|
||||
for (PositionedStack stack : ingredients) {
|
||||
if (stack.contains(ingredient))
|
||||
return true;
|
||||
}
|
||||
return super.contains(ingredients, ingredient);
|
||||
}
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("ab.nei.alphirine");
|
||||
}
|
||||
|
||||
public String getRecipeID() {
|
||||
return "ab.alphirine";
|
||||
}
|
||||
|
||||
public String getGuiTexture() {
|
||||
return "botania:textures/gui/neiBlank.png";
|
||||
}
|
||||
|
||||
public int recipiesPerPage() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void loadTransferRects() {
|
||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(70, 22, 18, 18), getRecipeID(), new Object[0]));
|
||||
}
|
||||
|
||||
public void drawBackground(int recipe) {
|
||||
super.drawBackground(recipe);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||
GuiDraw.changeTexture("botania:textures/gui/pureDaisyOverlay.png");
|
||||
GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44);
|
||||
int chance = ((CachedHandlerAlphirine)this.arecipes.get(recipe)).chance;
|
||||
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
|
||||
String s = ClientHelper.getChanceName(chance);
|
||||
font.drawString(s, 82 - font.getStringWidth(s) / 2, 58, 4210752);
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals(getRecipeID())) {
|
||||
for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
|
||||
if (recipe == null)
|
||||
continue;
|
||||
this.arecipes.add(new CachedHandlerAlphirine(recipe));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
|
||||
this.arecipes.add(new CachedHandlerAlphirine(recipe));
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
|
||||
if (recipe == null)
|
||||
continue;
|
||||
CachedHandlerAlphirine crecipe = new CachedHandlerAlphirine(recipe);
|
||||
if (crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user