diff --git a/build.properties b/build.properties index 5f9be8ce..a0bb5147 100644 --- a/build.properties +++ b/build.properties @@ -1,13 +1,11 @@ -# -#Sat May 30 11:48:23 EDT 2015 mod_name=BloodMagic -forge_version=10.13.3.1374-1.7.10 +forge_version=10.13.4.1448-1.7.10 ccc_version=1.0.4.29 nei_version=1.0.3.64 //=Dependency Information -guideapi_version=1.0.1-19 +guideapi_version=1.0.1-20 package_group=com.wayoftime.bloodmagic mod_version=1.3.3 minetweaker_version=Dev-1.7.10-3.0.9B +build_number=5 mc_version=1.7.10 -build_number=3 diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 51bb7759..9f8800d0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -11,6 +11,8 @@ import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import WayofTime.alchemicalWizardry.common.thread.CommandDownloadGAPI; +import WayofTime.alchemicalWizardry.common.thread.GAPIChecker; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -296,7 +298,6 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.3.3", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory") - public class AlchemicalWizardry { public static boolean parseTextFiles = false; @@ -497,9 +498,7 @@ public class AlchemicalWizardry @EventHandler public void preInit(FMLPreInitializationEvent event) - { - - + { File bmDirectory = new File("config/BloodMagic/schematics"); if (!bmDirectory.exists() && bmDirectory.mkdirs()) @@ -1269,8 +1268,6 @@ public class AlchemicalWizardry isBotaniaLoaded = Loader.isModLoaded("Botania"); isPneumaticCraftLoaded = Loader.isModLoaded("PneumaticCraft"); isFMPLoaded = Loader.isModLoaded("ForgeMultipart"); - - BloodMagicConfiguration.loadBlacklist(); BloodMagicConfiguration.blacklistRituals(); @@ -1921,5 +1918,6 @@ public class AlchemicalWizardry event.registerServerCommand(new CommandBind()); event.registerServerCommand(new CommandUnbind()); event.registerServerCommand(new CommandSN()); + event.registerServerCommand(new CommandDownloadGAPI()); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java index 7607023f..b75815ca 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java @@ -4,5 +4,5 @@ import net.minecraft.item.ItemStack; public interface ILPGauge { - public boolean canSeeLPBar(ItemStack itemStack); + boolean canSeeLPBar(ItemStack itemStack); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java b/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java index c0d488d2..0cb1c207 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.client; +import WayofTime.alchemicalWizardry.common.thread.GAPIChecker; import net.minecraft.item.ItemBlock; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; @@ -194,5 +195,6 @@ public class ClientProxy extends CommonProxy MinecraftForge.EVENT_BUS.register(ob); KeyBindings.init(); MinecraftForge.EVENT_BUS.register(new ScrollHelper()); + new GAPIChecker().init(); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java index 31211814..94b0cfc1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RitualDivinerRender.java @@ -1,5 +1,7 @@ package WayofTime.alchemicalWizardry.client.renderer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; import WayofTime.alchemicalWizardry.ModBlocks; @@ -21,6 +23,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; * Created in Scala by Alex-Hawks * Translated and implemented by Arcaratus */ +@SideOnly(Side.CLIENT) public class RitualDivinerRender { @SubscribeEvent diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java index e969f1ba..de861321 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java @@ -78,7 +78,6 @@ public class BlockTeleposer extends BlockContainer @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { - TETeleposer tileEntity = (TETeleposer) world.getTileEntity(x, y, z); ItemStack playerItem = player.getCurrentEquippedItem(); if (playerItem != null) @@ -169,8 +168,6 @@ public class BlockTeleposer extends BlockContainer { TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi); TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf); - TileEntity tileI; - TileEntity tileF; NBTTagCompound nbttag1 = new NBTTagCompound(); NBTTagCompound nbttag2 = new NBTTagCompound(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java index 8d7368e6..58451a17 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/commands/CommandSN.java @@ -71,8 +71,17 @@ public class CommandSN extends CommandBase } else if ("get".equalsIgnoreCase(astring[1])) { - int amount = SoulNetworkHandler.getCurrentEssence(owner); - func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", amount, owner); + int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); + func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", currentEssence, owner); + } + else if ("fillMax".equalsIgnoreCase(astring[1])) + { + int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); + int orbTier = SoulNetworkHandler.getCurrentMaxOrb(owner); + int maxForOrb = SoulNetworkHandler.getMaximumForOrbTier(orbTier); + int fillAmount = maxForOrb - currentEssence; + SoulNetworkHandler.addCurrentEssenceToMaximum(owner, fillAmount, fillAmount); + func_152373_a(icommandsender, this, "commands.soulnetwork.fillMax.success", owner); } else { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java index 2d152898..b0a899e1 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfMagnetism.java @@ -6,6 +6,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -153,6 +154,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol float posY = (float) (par3Entity.posY - par3Entity.getEyeHeight()); float posZ = Math.round(par3Entity.posZ); List entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); + List xpOrbs = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); for (EntityItem entity : entities) { @@ -161,9 +163,15 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol entity.onCollideWithPlayer(par3EntityPlayer); } } - } - return; + for (EntityXPOrb xpOrb : xpOrbs) + { + if (xpOrb != null && !par2World.isRemote) + { + xpOrb.onCollideWithPlayer(par3EntityPlayer); + } + } + } } @Override @@ -175,6 +183,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol float posY = (float) (player.posY - player.getEyeHeight()); float posZ = Math.round(player.posZ); List entities = player.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); + List xpOrbs = player.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, AxisAlignedBB.getBoundingBox(posX - 0.5f, posY - 0.5f, posZ - 0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(range, verticalRange, range)); for (EntityItem entity : entities) { @@ -183,6 +192,14 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol entity.onCollideWithPlayer(player); } } + + for (EntityXPOrb xpOrb : xpOrbs) + { + if (xpOrb != null && !world.isRemote) + { + xpOrb.onCollideWithPlayer(player); + } + } } @Override diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/thread/CommandDownloadGAPI.java b/src/main/java/WayofTime/alchemicalWizardry/common/thread/CommandDownloadGAPI.java new file mode 100644 index 00000000..0c57dc79 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/common/thread/CommandDownloadGAPI.java @@ -0,0 +1,38 @@ +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"); + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/thread/GAPIChecker.java b/src/main/java/WayofTime/alchemicalWizardry/common/thread/GAPIChecker.java new file mode 100644 index 00000000..7b6da761 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/common/thread/GAPIChecker.java @@ -0,0 +1,113 @@ +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 = ""; + 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 modFiles() + { + List list = new LinkedList(); + 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; + } + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/thread/ThreadDownloadGAPI.java b/src/main/java/WayofTime/alchemicalWizardry/common/thread/ThreadDownloadGAPI.java new file mode 100644 index 00000000..cb390250 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/common/thread/ThreadDownloadGAPI.java @@ -0,0 +1,96 @@ +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))); + } + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEImperfectRitualStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEImperfectRitualStone.java deleted file mode 100644 index a6b0404c..00000000 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEImperfectRitualStone.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.common.tileEntity; - -import net.minecraft.tileentity.TileEntity; - -public class TEImperfectRitualStone extends TileEntity -{ - public TEImperfectRitualStone() - { - } -} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java index 1aacdfc5..57959fe8 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java @@ -94,7 +94,7 @@ public class TETeleposer extends TEInventory int zf = focusItem.zCoord(focus); World worldF = focusItem.getWorld(focus); int damage = (int) (0.5f * Math.sqrt((xCoord - xf) * (xCoord - xf) + (yCoord - yf + 1) * (yCoord - yf + 1) + (zCoord - zf) * (zCoord - zf))); - int focusLevel = ((TelepositionFocus) focusItem).getFocusLevel(); + int focusLevel = focusItem.getFocusLevel(); int transportCount = 0; int entityCount = 0; diff --git a/src/main/resources/Guide-API-Version.info b/src/main/resources/Guide-API-Version.info new file mode 100644 index 00000000..457dcccf --- /dev/null +++ b/src/main/resources/Guide-API-Version.info @@ -0,0 +1 @@ +1.0.1-20 \ No newline at end of file diff --git a/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang b/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang index bef5fe52..3dbec0b8 100644 --- a/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang +++ b/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang @@ -301,6 +301,7 @@ commands.soulnetwork.get.success=There is %dLP in %s's Soul Network! commands.soulnetwork.noPlayer=There is no player specified commands.soulnetwork.noCommand=There is no command specified commands.soulnetwork.notACommand=That is not a valid command +commands.soulnetwork.fillMax.success=Successfully filled %s's Soul Network to their orb max! #Tooltips tooltip.activationcrystal.creativeonly=Creative Only - activates any ritual @@ -467,3 +468,12 @@ achievement.alchemicalwizardry:firstPrick=Your First Prick! achievement.alchemicalwizardry:firstPrick.desc=The first drop of life into the Altar... achievement.alchemicalwizardry:weakOrb=Faintly Glowing Red... achievement.alchemicalwizardry:weakOrb.desc=This orb will suffice...for now... + +#G-API Downloading +bm.versioning.getGAPI=["[BM] You don't have Guide-API installed! Install it to get it to unlock the book! [",{"text":"Download","color":"red","hoverEvent":{"action":"show_text","value":{"text":"Click this to auto-magically download the latest version","color":"red"}},"clickEvent":{"action":"run_command","value":"/bloodmagic-download-g-api"}},"]"] +bm.versioning.startingDownload=[{"text":"Starting download of %s Please do not remove your hard disk.", "color":"orange"}] +bm.versioning.doneDownloading=Finished downloading %s Reload your game to update. +bm.versioning.error=An error has occurred while downloading the mod! +bm.versioning.downloadedAlready=You have the latest version already, reload your game to update! +bm.versioning.downloadingAlready=It's downloading! Be patient! +bm.versioning.disabled=This feature is disabled.