mirror of
https://github.com/GTNewHorizons/Advanced-Botany.git
synced 2026-11-24 22:04:43 +00:00
no message
This commit is contained in:
1 parent
93f114dceb
commit
f435e13882
645 files changed
-59797
No files matched your search
@@ -1,42 +0,0 @@
|
||||
package ab.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ab.api.recipe.RecipeAdvancedPlate;
|
||||
import ab.api.recipe.RecipeAncientAlphirine;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
public class AdvancedBotanyAPI {
|
||||
|
||||
public static List<RecipeAdvancedPlate> advancedPlateRecipes = new ArrayList<RecipeAdvancedPlate>();
|
||||
public static List<RecipeAncientAlphirine> alphirineRecipes = new ArrayList<RecipeAncientAlphirine>();
|
||||
public static List<TerraFarmlandList> farmlandList = new ArrayList<TerraFarmlandList>();
|
||||
|
||||
public static Item.ToolMaterial mithrilToolMaterial = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 8.0F, 20);
|
||||
|
||||
public static RecipeAdvancedPlate registerAdvancedPlateRecipe(ItemStack output, ItemStack input1, ItemStack input2, ItemStack input3, int mana) {
|
||||
RecipeAdvancedPlate recipe = new RecipeAdvancedPlate(output, mana, input1, input2, input3);
|
||||
advancedPlateRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, ItemStack input, int chance) {
|
||||
if(chance > 100)
|
||||
chance = 100;
|
||||
else if(chance <= 0)
|
||||
chance = 1;
|
||||
RecipeAncientAlphirine recipe = new RecipeAncientAlphirine(output, input, chance);
|
||||
alphirineRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
public static TerraFarmlandList registerFarmlandSeed(Block block, int meta) {
|
||||
TerraFarmlandList seed = new TerraFarmlandList(block, meta);
|
||||
farmlandList.add(seed);
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
package ab.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import ab.common.integration.corporea.CustomWrappedIInventory;
|
||||
import ab.common.lib.utils.Pair;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.api.corporea.CorporeaRequest;
|
||||
import vazkii.botania.api.corporea.CorporeaRequestEvent;
|
||||
import vazkii.botania.api.corporea.ICorporeaInterceptor;
|
||||
import vazkii.botania.api.corporea.ICorporeaSpark;
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
|
||||
public class AdvancedCorporeaHelper {
|
||||
|
||||
public static ItemStack getStackBySlot(IInventory inv, int slot, int itemCount, ICorporeaSpark spark,
|
||||
boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
if (!CorporeaHelper.getSparkForInventory(inv).getConnections().contains(spark)
|
||||
|| inv.getStackInSlot(slot) == null)
|
||||
return null;
|
||||
Pair pair = new Pair<IInventory, Integer>(inv, slot);
|
||||
CorporeaRequestEvent event = new CorporeaRequestEvent(pair, itemCount, spark, false, doit);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return null;
|
||||
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
|
||||
IWrappedInventory invW = CustomWrappedIInventory.wrap(inv, spark);
|
||||
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
|
||||
CorporeaRequest request = new CorporeaRequest(pair, false, itemCount);
|
||||
|
||||
for (IInventory inv$ : inventories) {
|
||||
if (inv$ instanceof ICorporeaInterceptor) {
|
||||
ICorporeaSpark spark$ = CorporeaHelper.getSparkForInventory(inv$);
|
||||
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) inv$;
|
||||
interceptor.interceptRequest(pair, itemCount, spark$, spark, stacks, inventories, doit);
|
||||
interceptors.put(interceptor, spark$);
|
||||
}
|
||||
}
|
||||
|
||||
if (doit) {
|
||||
stacks.addAll(invW.extractItems(request));
|
||||
} else {
|
||||
stacks.addAll(invW.countItems(request));
|
||||
}
|
||||
|
||||
for (ICorporeaInterceptor interceptor : interceptors.keySet())
|
||||
interceptor.interceptRequestLast(pair, itemCount, interceptors.get(interceptor), spark, stacks, inventories,
|
||||
doit);
|
||||
|
||||
if (stacks.isEmpty())
|
||||
return null;
|
||||
else
|
||||
return stacks.get(0);
|
||||
}
|
||||
|
||||
public static Object trasformateRequest(ICorporeaSpark spark, Object from, Class class$) {
|
||||
ItemStack stack = null;
|
||||
if (from instanceof ItemStack)
|
||||
stack = (ItemStack) from;
|
||||
if (from instanceof Pair) {
|
||||
Pair pair = (Pair) from;
|
||||
Object key = pair.getKey();
|
||||
Object value = pair.getValue();
|
||||
if (key instanceof IInventory && value instanceof Integer)
|
||||
stack = ((IInventory) from).getStackInSlot((Integer) value);
|
||||
if (key instanceof String && value instanceof ItemStack) {
|
||||
int count = ((ItemStack) value).stackSize;
|
||||
List<ItemStack> stacks = requestSameNamedItem((String) key, (ItemStack) value, spark, count, false);
|
||||
if(stacks.isEmpty()) {
|
||||
stacks = requestSameNamedItem((String) key, null, spark, count, false);
|
||||
if(stacks.isEmpty())
|
||||
return null;
|
||||
}
|
||||
stack = stacks.get(0);
|
||||
}
|
||||
}
|
||||
if(String.class.isAssignableFrom(class$))
|
||||
return stack.getDisplayName();
|
||||
if(IInventory.class.isAssignableFrom(class$))
|
||||
return getFirstInventoryWithStackByRequest(spark, stack);
|
||||
if(ItemStack.class.isAssignableFrom(class$))
|
||||
return stack;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Pair<IInventory, Integer> getFirstInventoryWithStackByRequest(ICorporeaSpark spark, ItemStack stack) {
|
||||
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
|
||||
Pair<IInventory, Integer> pair = new Pair<IInventory, Integer>();
|
||||
for (IInventory inv : inventories) {
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack stack$ = inv.getStackInSlot(i);
|
||||
if (stack$ == null)
|
||||
continue;
|
||||
if (stack.getItem().equals(stack$.getItem()) && stack$.getItemDamage() == stack.getItemDamage()
|
||||
&& stack.getItem().equals(stack$.getItem())
|
||||
&& stack.getDisplayName().equals(stack$.getDisplayName())) {
|
||||
pair.set(inv, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pair;
|
||||
}
|
||||
|
||||
public static List<ItemStack> requestRandomItem(ICorporeaSpark spark, int itemCount, boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
CorporeaRequestEvent event = new CorporeaRequestEvent(null, itemCount, spark, false, doit);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return stacks;
|
||||
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
|
||||
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
|
||||
List<IWrappedInventory> inventoriesW = wrapInventory(inventories);
|
||||
CorporeaRequest request = new CorporeaRequest(null, false, itemCount);
|
||||
|
||||
for (IWrappedInventory inv : inventoriesW) {
|
||||
ICorporeaSpark invSpark = inv.getSpark();
|
||||
|
||||
Object originalInventory = inv.getWrappedObject();
|
||||
if (originalInventory instanceof ICorporeaInterceptor) {
|
||||
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
|
||||
interceptor.interceptRequest(null, itemCount, invSpark, spark, stacks, inventories, doit);
|
||||
interceptors.put(interceptor, invSpark);
|
||||
}
|
||||
|
||||
if (doit) {
|
||||
stacks.addAll(inv.extractItems(request));
|
||||
} else {
|
||||
stacks.addAll(inv.countItems(request));
|
||||
}
|
||||
}
|
||||
|
||||
for (ICorporeaInterceptor interceptor : interceptors.keySet())
|
||||
interceptor.interceptRequestLast(null, itemCount, interceptors.get(interceptor), spark, stacks, inventories,
|
||||
doit);
|
||||
|
||||
return stacks;
|
||||
}
|
||||
|
||||
public static int sumStackSizes(List<ItemStack> stacks) {
|
||||
int sum = 0;
|
||||
for (ItemStack stack : stacks)
|
||||
sum += stack.stackSize;
|
||||
return sum;
|
||||
}
|
||||
|
||||
public static List<IWrappedInventory> wrapInventory(List<IInventory> inventories) {
|
||||
ArrayList<IWrappedInventory> arrayList = new ArrayList<IWrappedInventory>();
|
||||
for (IInventory inv : inventories) {
|
||||
ICorporeaSpark spark = CorporeaHelper.getSparkForInventory(inv);
|
||||
IWrappedInventory wrapped = CustomWrappedIInventory.wrap(inv, spark);
|
||||
arrayList.add(wrapped);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<ItemStack> requestSameNamedItem(String name, ItemStack matcher, ICorporeaSpark spark, int count,
|
||||
boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
Pair pair = new Pair<String, ItemStack>(name, matcher);
|
||||
CorporeaRequestEvent event = new CorporeaRequestEvent(pair, count, spark, false, doit);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
return stacks;
|
||||
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
|
||||
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
|
||||
List<IWrappedInventory> inventoriesW = wrapInventory(inventories);
|
||||
CorporeaRequest request = new CorporeaRequest(pair, false, count);
|
||||
|
||||
for (IWrappedInventory inv : inventoriesW) {
|
||||
ICorporeaSpark invSpark = inv.getSpark();
|
||||
|
||||
Object originalInventory = inv.getWrappedObject();
|
||||
if (originalInventory instanceof ICorporeaInterceptor) {
|
||||
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
|
||||
interceptor.interceptRequest(pair, count, invSpark, spark, stacks, inventories, doit);
|
||||
interceptors.put(interceptor, invSpark);
|
||||
}
|
||||
|
||||
if (doit) {
|
||||
stacks.addAll(inv.extractItems(request));
|
||||
} else {
|
||||
stacks.addAll(inv.countItems(request));
|
||||
}
|
||||
}
|
||||
|
||||
for (ICorporeaInterceptor interceptor : interceptors.keySet())
|
||||
interceptor.interceptRequestLast(matcher, count, interceptors.get(interceptor), spark, stacks, inventories,
|
||||
doit);
|
||||
|
||||
return stacks;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package ab.api;
|
||||
|
||||
import ab.common.block.tile.TileCorporeaCatalyst;
|
||||
|
||||
public interface ICorporeaModification {
|
||||
|
||||
public void setCatalystCoords(int x, int y, int z);
|
||||
|
||||
public TileCorporeaCatalyst getCatalystTile();
|
||||
|
||||
public boolean isModified();
|
||||
|
||||
public void removeModification();
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package ab.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
|
||||
public interface IRankItem extends IManaItem {
|
||||
|
||||
public int getLevel(ItemStack stack);
|
||||
|
||||
public int[] getLevels();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package ab.api;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
||||
public interface IRenderHud {
|
||||
|
||||
public void renderHud(Minecraft mc, ScaledResolution res);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package ab.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class TerraFarmlandList {
|
||||
|
||||
Block block;
|
||||
int meta;
|
||||
|
||||
public TerraFarmlandList(Block block, int meta) {
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package ab.api.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RecipeAdvancedPlate {
|
||||
|
||||
private ItemStack output;
|
||||
private List<ItemStack> inputs;
|
||||
private int mana;
|
||||
|
||||
public RecipeAdvancedPlate(ItemStack output, int mana, ItemStack... inputs) {
|
||||
this.output = output;
|
||||
this.mana = mana;
|
||||
List<ItemStack> inputsToSet = new ArrayList();
|
||||
for (ItemStack obj : inputs)
|
||||
inputsToSet.add(obj);
|
||||
this.inputs = inputsToSet;
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs() {
|
||||
return new ArrayList(this.inputs);
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
public int getManaUsage() {
|
||||
return this.mana;
|
||||
}
|
||||
|
||||
public boolean matches(IInventory inv) {
|
||||
List<Object> inputsMissing = new ArrayList(this.inputs);
|
||||
for (int i = 1; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack == null)
|
||||
break;
|
||||
int stackIndex = -1;
|
||||
for (int j = 0; j < inputsMissing.size(); j++) {
|
||||
Object input = inputsMissing.get(j);
|
||||
if (input instanceof ItemStack && simpleAreStacksEqual((ItemStack)input, stack)) {
|
||||
stackIndex = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (stackIndex != -1) {
|
||||
inputsMissing.remove(stackIndex);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return inputsMissing.isEmpty();
|
||||
}
|
||||
|
||||
boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) {
|
||||
return (stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package ab.api.recipe;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RecipeAncientAlphirine {
|
||||
|
||||
private ItemStack output;
|
||||
private ItemStack input;
|
||||
private int chance;
|
||||
|
||||
public RecipeAncientAlphirine(ItemStack output, ItemStack input, int chance) {
|
||||
this.output = output;
|
||||
this.input = input;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public ItemStack getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return stack.getItem() == input.getItem() && stack.getItemDamage() == input.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package ab.api.recipe.lexicon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import ab.api.recipe.RecipeAdvancedPlate;
|
||||
import ab.client.core.ClientHelper;
|
||||
import ab.common.lib.register.BlockListAB;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lexicon.page.PageRecipe;
|
||||
|
||||
public class AdvancedPlateCraftPage extends PageRecipe {
|
||||
|
||||
private static final ResourceLocation plateOverlay = new ResourceLocation("botania:textures/gui/petalOverlay.png");
|
||||
private RecipeAdvancedPlate recipe;
|
||||
int ticksElapsed = 0;
|
||||
|
||||
public AdvancedPlateCraftPage(RecipeAdvancedPlate recipe) {
|
||||
super(".abCraft");
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
public AdvancedPlateCraftPage(RecipeAdvancedPlate recipe, String str) {
|
||||
super(".abCraft" + str);
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
TextureManager render = (Minecraft.getMinecraft()).renderEngine;
|
||||
renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false);
|
||||
renderItemAtGridPos(gui, 2, 1, new ItemStack(BlockListAB.blockABPlate), false);
|
||||
List<ItemStack> inputs = recipe.getInputs();
|
||||
int degreePerInput = (int)(360.0F / inputs.size());
|
||||
float currentDegree = ConfigHandler.lexiconRotatingItems ? (GuiScreen.isShiftKeyDown() ? this.ticksElapsed : (this.ticksElapsed + ClientTickHandler.partialTicks)) : 0.0F;
|
||||
for (ItemStack obj : inputs) {
|
||||
ItemStack copy = obj.copy();
|
||||
if (copy.getItemDamage() == 32767)
|
||||
copy.setItemDamage(0);
|
||||
renderItemAtAngle(gui, currentDegree, copy);
|
||||
currentDegree += degreePerInput;
|
||||
}
|
||||
renderManaBar(gui, mx, my);
|
||||
render.bindTexture(plateOverlay);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
((GuiScreen)gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderManaBar(IGuiLexiconEntry gui, int mx, int my) {
|
||||
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage");
|
||||
font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 105, 1711276032);
|
||||
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
|
||||
int y = gui.getTop() + 120;
|
||||
String stopStr = StatCollector.translateToLocal("botaniamisc.shiftToStopSpin");
|
||||
ClientHelper.renderPoolManaBar(x, y - 5, 0x239ddc, 1.0f, this.recipe.getManaUsage());
|
||||
boolean unicode = font.getUnicodeFlag();
|
||||
font.setUnicodeFlag(true);
|
||||
font.drawString(stopStr, x + 49 - font.getStringWidth(stopStr) / 2, y + 18, -1728053248);
|
||||
font.setUnicodeFlag(unicode);
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen() {
|
||||
if (GuiScreen.isShiftKeyDown())
|
||||
return;
|
||||
this.ticksElapsed++;
|
||||
}
|
||||
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
list.add(recipe.getOutput());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package ab.api.recipe.lexicon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import ab.api.recipe.RecipeAncientAlphirine;
|
||||
import ab.client.core.ClientHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lexicon.page.PageRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
|
||||
public class AlphirineCraftPage extends PageRecipe {
|
||||
|
||||
private static final ResourceLocation alphirineOverlay = new ResourceLocation("botania:textures/gui/pureDaisyOverlay.png");
|
||||
private RecipeAncientAlphirine recipe;
|
||||
|
||||
public AlphirineCraftPage(RecipeAncientAlphirine recipe) {
|
||||
super(".alphirineCraft");
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
public AlphirineCraftPage(RecipeAncientAlphirine recipe, String str) {
|
||||
super(".alphirineCraft" + str);
|
||||
this.recipe = recipe;
|
||||
}
|
||||
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
TextureManager render = (Minecraft.getMinecraft()).renderEngine;
|
||||
render.bindTexture(alphirineOverlay);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
((GuiScreen)gui).drawTexturedModalRect(gui.getLeft() + 40, gui.getTop() + 44, 0, 0, gui.getWidth(), gui.getHeight());
|
||||
GL11.glDisable(3042);
|
||||
ItemStack inp = recipe.getInput().copy();
|
||||
if (inp.getItemDamage() == 32767)
|
||||
inp.setItemDamage(0);
|
||||
this.renderItem(gui, gui.getLeft() + 34, gui.getTop() + 59, inp, false);
|
||||
this.renderItem(gui, gui.getLeft() + 62, gui.getTop() + 57, ItemBlockSpecialFlower.ofType("ancientAlphirine").copy(), false);
|
||||
this.renderItem(gui, gui.getLeft() + 93, gui.getTop() + 54, recipe.getOutput().copy(), false);
|
||||
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
|
||||
String text = ClientHelper.getChanceName(recipe.getChance());
|
||||
String name = EnumChatFormatting.BOLD + StatCollector.translateToLocal("ab.name.alpherine.craft");
|
||||
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
|
||||
int y = gui.getTop() + 85;
|
||||
boolean unicode = font.getUnicodeFlag();
|
||||
font.setUnicodeFlag(true);
|
||||
font.drawString(text, x + 50 - font.getStringWidth(text) / 2, y + 15, -1728053248);
|
||||
font.drawString(name, x + 50 - font.getStringWidth(name) / 2, y - 65, -1728053248);
|
||||
font.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
list.add(recipe.getOutput());
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user