put 1.7.10 in main folder

This commit is contained in:
Martin Robertz committed 2023-01-13 19:25:21 +01:00
1 parent f6dd34eb96
commit b3a9147a3c
1429 files changed
+1 -135029

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
package ab.api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import vazkii.botania.api.item.IRelic;
public class AchievementAB extends Achievement {
public AchievementAB(String name, int x, int y, ItemStack icon, Achievement parent) {
super("achievement.ab:" + name, "ab:" + name, x, y, icon, parent);
AdvancedBotanyAPI.achievements.add(this);
registerStat();
if(icon.getItem() instanceof IRelic)
((IRelic)icon.getItem()).setBindAchievement(this);
}
}
@@ -0,0 +1,53 @@
package ab.api;
import java.util.ArrayList;
import java.util.List;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.common.core.handler.ConfigABHandler;
import ab.common.lib.register.ItemListAB;
import net.minecraft.block.Block;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.EnumHelper;
import vazkii.botania.common.item.ModItems;
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 List<Achievement> achievements = new ArrayList<Achievement>();
public static List<ItemStack> relicList = new ArrayList<ItemStack>();
public static List<ItemStack> diceList = new ArrayList<ItemStack>();
public static Item.ToolMaterial mithrilToolMaterial = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 4.0F, 24);
public static ItemArmor.ArmorMaterial nebulaArmorMaterial = EnumHelper.addArmorMaterial("NEBULA", 0, new int[] { (int)(3 * ConfigABHandler.protectionFactorNebula), (int)(8 * ConfigABHandler.protectionFactorNebula), (int)(6 * ConfigABHandler.protectionFactorNebula), (int)(3 * ConfigABHandler.protectionFactorNebula) }, 26);
public static ItemArmor.ArmorMaterial wildHundArmor = EnumHelper.addArmorMaterial("WILD_HUNT_MATERIAL", 34, new int[] { 7, 8, 3, 2 }, 26);
public static EnumRarity rarityNebula = EnumHelper.addRarity("NEBULA", EnumChatFormatting.LIGHT_PURPLE, "Nebula");
public static EnumRarity rarityWildHunt = EnumHelper.addRarity("WILD_HUNT", EnumChatFormatting.AQUA, "WildHunt");
public static RecipeAdvancedPlate registerAdvancedPlateRecipe(ItemStack output, ItemStack input1, ItemStack input2, ItemStack input3, int mana, int color) {
RecipeAdvancedPlate recipe = new RecipeAdvancedPlate(output, mana, color, input1, input2, input3);
advancedPlateRecipes.add(recipe);
return recipe;
}
public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, ItemStack input, int chance) {
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;
}
}
+9
View File
@@ -0,0 +1,9 @@
package ab.api;
import net.minecraft.util.ChunkCoordinates;
import vazkii.botania.api.wand.IWandBindable;
public interface IBoundRender extends IWandBindable {
public ChunkCoordinates[] getBlocksCoord();
}
+11
View File
@@ -0,0 +1,11 @@
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();
}
+9
View File
@@ -0,0 +1,9 @@
package ab.api;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
public interface IRenderHud {
public void renderHud(Minecraft mc, ScaledResolution res);
}
@@ -0,0 +1,22 @@
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;
}
}
@@ -0,0 +1,70 @@
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 int color;
private List<ItemStack> inputs;
private int mana;
public RecipeAdvancedPlate(ItemStack output, int mana, int color, ItemStack... inputs) {
this.output = output;
this.mana = mana;
this.color = color;
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 int getColor() {
return this.color;
}
public boolean matches(IInventory inv) {
List<ItemStack> 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++) {
ItemStack input = inputsMissing.get(j);
if (input instanceof ItemStack && simpleAreStacksEqual(input.copy(), stack)) {
stackIndex = j;
break;
}
}
if (stackIndex != -1) {
inputsMissing.remove(stackIndex);
} else {
return false;
}
}
return inputsMissing.isEmpty();
}
boolean simpleAreStacksEqual(ItemStack input, ItemStack stack) {
if(input.getItemDamage() == 32767)
input.setItemDamage(stack.getItemDamage());
return (input.getItem() == stack.getItem() && input.getItemDamage() == stack.getItemDamage());
}
}
@@ -0,0 +1,40 @@
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;
if(chance > 100)
chance = 100;
else if(chance <= 0)
chance = 1;
this.chance = chance;
}
public ItemStack getOutput() {
return output;
}
public ItemStack getInput() {
return input;
}
public int getChance() {
return chance;
}
public boolean matches(ItemStack stack) {
ItemStack inputCopy = this.input.copy();
if(inputCopy.getItemDamage() == 32767)
inputCopy.setItemDamage(stack.getItemDamage());
return stack.getItem() == input.getItem() && stack.getItemDamage() == inputCopy.getItemDamage();
}
}
@@ -0,0 +1,121 @@
package ab.api.recipe.lexicon;
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.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;
private final ItemStack resultStack;
int ticksElapsed = 0;
public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack) {
this(entry, stack, "");
}
public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack, String str) {
super(str);
resultStack = stack;
refreshRecipe(entry, stack);
}
public ItemStack getResult() {
return resultStack;
}
public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
RecipeAdvancedPlate rec = null;
for(RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
if(stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
rec = recipe;
break;
}
}
if(rec == null)
entry.pages.remove(this);
recipe = rec;
}
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;
}
}
@@ -0,0 +1,97 @@
package ab.api.recipe.lexicon;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
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;
private final ItemStack resultStack;
public AlphirineCraftPage(LexiconEntry entry, ItemStack stack) {
this(entry, stack, "");
}
public AlphirineCraftPage(LexiconEntry entry, ItemStack stack, String str) {
super(str);
resultStack = stack;
refreshRecipe(entry, stack);
}
public ItemStack getResult() {
return resultStack;
}
public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
RecipeAncientAlphirine rec = null;
for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
if(stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
rec = recipe;
break;
}
}
if(rec == null)
entry.pages.remove(this);
recipe = rec;
}
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;
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
render.bindTexture(alphirineOverlay);
((GuiScreen)gui).drawTexturedModalRect(gui.getLeft() + 40, gui.getTop() + 44, 0, 0, gui.getWidth(), gui.getHeight());
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);
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
int y = gui.getTop() + 85;
String name = EnumChatFormatting.BOLD + StatCollector.translateToLocal("ab.name.alpherine.craft");
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
font.drawString(name, x + 50 - font.getStringWidth(name) / 2, y - 65, -1728053248);
font.setUnicodeFlag(unicode);
ClientHelper.drawChanceBar(x + 21, y + 14, recipe.getChance());
GL11.glDisable(3042);
}
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(recipe.getOutput());
return list;
}
}