mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-17 10:55:10 +00:00
Update build script (#13)
* Remove most copied dependencies * Draft for unified build script * Remove custom updater * Adapt bee frame to "new" forestry API * Add missing dependency * Refactor branch naming * Resolve todos
This commit is contained in:
1 parent
4666fc6f47
commit
fbaaed088b
354 files changed
+923
-16207
No files matched your search
@@ -66,7 +66,6 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.*;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.*;
|
||||
import WayofTime.alchemicalWizardry.common.spell.simple.*;
|
||||
import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW;
|
||||
import WayofTime.alchemicalWizardry.common.thread.CommandDownloadGAPI;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.*;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler;
|
||||
import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration;
|
||||
@@ -104,7 +103,7 @@ import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.3.3", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
|
||||
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "GRADLETOKEN_VERSION", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
|
||||
public class AlchemicalWizardry
|
||||
{
|
||||
public static boolean parseTextFiles = false;
|
||||
@@ -1824,7 +1823,6 @@ public class AlchemicalWizardry
|
||||
// event.registerServerCommand(new CommandBind());
|
||||
// event.registerServerCommand(new CommandUnbind());
|
||||
// event.registerServerCommand(new CommandSN());
|
||||
event.registerServerCommand(new CommandDownloadGAPI());
|
||||
event.registerServerCommand(new CommandBloodMagic());
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,6 @@ import WayofTime.alchemicalWizardry.common.renderer.model.ModelWingedFireDemon;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor;
|
||||
import WayofTime.alchemicalWizardry.common.thread.GAPIChecker;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
@@ -196,6 +195,5 @@ public class ClientProxy extends CommonProxy
|
||||
MinecraftForge.EVENT_BUS.register(ob);
|
||||
KeyBindings.init();
|
||||
MinecraftForge.EVENT_BUS.register(new ScrollHelper());
|
||||
new GAPIChecker().init();
|
||||
}
|
||||
}
|
||||
+74
-84
@@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.items.forestry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.*;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -11,13 +12,11 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
|
||||
public class ItemBloodFrame extends EnergyItems implements IHiveFrame
|
||||
{
|
||||
private final IBeeModifier beeModifier = new BloodFrameBeeModifier();
|
||||
|
||||
public ItemBloodFrame()
|
||||
{
|
||||
super();
|
||||
@@ -27,6 +26,59 @@ public class ItemBloodFrame extends EnergyItems implements IHiveFrame
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
private static class BloodFrameBeeModifier implements IBeeModifier {
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 0.0001f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
{
|
||||
@@ -61,85 +113,23 @@ public class ItemBloodFrame extends EnergyItems implements IHiveFrame
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0.0001f;
|
||||
}
|
||||
|
||||
@Override public float getProductionModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override public float getFloweringModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override public float getGeneticDecay(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override public boolean isSealed()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public boolean isSelfLighted()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public boolean isSunlightSimulated()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public boolean isHellish()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
if(EnergyItems.canSyphonInContainer(frame, getEnergyUsed()*wear))
|
||||
{
|
||||
EnergyItems.syphonWhileInContainer(frame, getEnergyUsed()*wear);
|
||||
return frame;
|
||||
}else
|
||||
{
|
||||
frame.setItemDamage(frame.getItemDamage() + wear);
|
||||
if(frame.getItemDamage()>=frame.getMaxDamage())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) {
|
||||
// TODO Auto-generated method stub
|
||||
if (EnergyItems.canSyphonInContainer(frame, getEnergyUsed() * wear)) {
|
||||
EnergyItems.syphonWhileInContainer(frame, getEnergyUsed() * wear);
|
||||
return frame;
|
||||
} else {
|
||||
frame.setItemDamage(frame.getItemDamage() + wear);
|
||||
if (frame.getItemDamage() >= frame.getMaxDamage()) {
|
||||
return null;
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return beeModifier;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [May 31, 2014, 10:22:44 PM (GMT)]
|
||||
*/
|
||||
package WayofTime.alchemicalWizardry.common.thread;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class CommandDownloadGAPI extends CommandBase
|
||||
{
|
||||
private static final boolean ENABLED = true;
|
||||
|
||||
@Override
|
||||
public String getCommandName()
|
||||
{
|
||||
return "bloodmagic-download-g-api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender var1)
|
||||
{
|
||||
return "/bloodmagic-download-g-api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender var1, String[] var2)
|
||||
{
|
||||
if (!ENABLED)
|
||||
var1.addChatMessage(new ChatComponentTranslation("bm.versioning.disabled").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
|
||||
else
|
||||
if (GAPIChecker.downloadedFile)
|
||||
var1.addChatMessage(new ChatComponentTranslation("bm.versioning.downloadedAlready").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
else if (GAPIChecker.startedDownload)
|
||||
var1.addChatMessage(new ChatComponentTranslation("bm.versioning.downloadingAlready").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
else new ThreadDownloadGAPI("Guide-API-1.7.10-" + GAPIChecker.onlineVersion + ".jar");
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package WayofTime.alchemicalWizardry.common.thread;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class GAPIChecker
|
||||
{
|
||||
public static boolean doneChecking = false;
|
||||
public static String onlineVersion = "@VERSION@";
|
||||
public static boolean triedToWarnPlayer = false;
|
||||
|
||||
public static boolean startedDownload = false;
|
||||
public static boolean downloadedFile = false;
|
||||
|
||||
private File modsDir;
|
||||
|
||||
public void init()
|
||||
{
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
File mcDir = (File)cpw.mods.fml.relauncher.FMLInjectionData.data()[6];
|
||||
|
||||
this.modsDir = new File(mcDir, "mods");
|
||||
|
||||
scanDepInfos();
|
||||
}
|
||||
|
||||
private void scanDepInfos()
|
||||
{
|
||||
for (File file : modFiles())
|
||||
{
|
||||
if ((file.getName().endsWith(".jar")) && file.getName().contains("BloodMagic"))
|
||||
{
|
||||
scanDepInfo(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void scanDepInfo(File file)
|
||||
{
|
||||
try
|
||||
{
|
||||
ZipFile zip = new ZipFile(file);
|
||||
ZipEntry e = zip.getEntry("Guide-API-Version.info");
|
||||
if (e == null)
|
||||
{
|
||||
e = zip.getEntry("Guide-API-Version.info");
|
||||
}
|
||||
if (e != null)
|
||||
{
|
||||
readConfigFile(zip.getInputStream(e));
|
||||
}
|
||||
zip.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Failed to load dependencies.info from " + file.getName() + " as JSON");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private List<File> modFiles()
|
||||
{
|
||||
List<File> list = new LinkedList<File>();
|
||||
list.addAll(Arrays.asList(this.modsDir.listFiles()));
|
||||
return list;
|
||||
}
|
||||
|
||||
private void readConfigFile(InputStream inputStream) throws IOException
|
||||
{
|
||||
if (inputStream != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
BufferedReader r = new BufferedReader(new InputStreamReader(inputStream));
|
||||
onlineVersion = r.readLine();
|
||||
doneChecking = true;
|
||||
r.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent.ClientTickEvent event)
|
||||
{
|
||||
if (!Loader.isModLoaded("guideapi"))
|
||||
{
|
||||
if (event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !triedToWarnPlayer)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
IChatComponent component = IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal("bm.versioning.getGAPI"));
|
||||
player.addChatComponentMessage(component);
|
||||
}
|
||||
|
||||
triedToWarnPlayer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [May 31, 2014, 10:22:44 PM (GMT)]
|
||||
*/
|
||||
package WayofTime.alchemicalWizardry.common.thread;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
public class ThreadDownloadGAPI extends Thread
|
||||
{
|
||||
String fileName;
|
||||
|
||||
byte[] buffer = new byte[10240];
|
||||
|
||||
int totalBytesDownloaded;
|
||||
int bytesJustDownloaded;
|
||||
|
||||
InputStream webReader;
|
||||
|
||||
public ThreadDownloadGAPI(String fileName)
|
||||
{
|
||||
setName("Blood Magic Download Guide-API Thread");
|
||||
this.fileName = fileName;
|
||||
setDaemon(true);
|
||||
start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
IChatComponent component = IChatComponent.Serializer.func_150699_a(String.format(StatCollector.translateToLocal("bm.versioning.startingDownload"), fileName));
|
||||
|
||||
if (Minecraft.getMinecraft().thePlayer != null)
|
||||
{
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(component);
|
||||
}
|
||||
|
||||
GAPIChecker.startedDownload = true;
|
||||
|
||||
String base = "http://minecraft.curseforge.com/mc-mods/228832-guide-api";
|
||||
URL url = new URL(base + "/files/latest");
|
||||
|
||||
try
|
||||
{
|
||||
url.openStream().close(); // Add to DL Counter
|
||||
}
|
||||
catch(IOException e) {}
|
||||
|
||||
webReader = url.openStream();
|
||||
|
||||
File dir = new File(".", "mods");
|
||||
File f = new File(dir, "Guide-API-" + MinecraftForge.MC_VERSION + "-" + GAPIChecker.onlineVersion + ".jar");
|
||||
f.createNewFile();
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(f.getAbsolutePath());
|
||||
|
||||
while ((bytesJustDownloaded = webReader.read(buffer)) > 0)
|
||||
{
|
||||
outputStream.write(buffer, 0, bytesJustDownloaded);
|
||||
buffer = new byte[10240];
|
||||
totalBytesDownloaded += bytesJustDownloaded;
|
||||
}
|
||||
|
||||
if (Minecraft.getMinecraft().thePlayer != null)
|
||||
{
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("bm.versioning.doneDownloading", fileName).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
}
|
||||
|
||||
Desktop.getDesktop().open(dir);
|
||||
GAPIChecker.downloadedFile = true;
|
||||
|
||||
outputStream.close();
|
||||
webReader.close();
|
||||
finalize();
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendError()
|
||||
{
|
||||
if (Minecraft.getMinecraft().thePlayer != null)
|
||||
{
|
||||
Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentTranslation("bm.versioning.error").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user