Merge pull request #351 from Arcaratus/master

Added useful things
This commit is contained in:
WayofTime 2015-06-13 18:03:49 -04:00
commit ff8cf59bb8
15 changed files with 302 additions and 30 deletions

View file

@ -1,13 +1,11 @@
#
#Sat May 30 11:48:23 EDT 2015
mod_name=BloodMagic 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 ccc_version=1.0.4.29
nei_version=1.0.3.64 nei_version=1.0.3.64
//=Dependency Information //=Dependency Information
guideapi_version=1.0.1-19 guideapi_version=1.0.1-20
package_group=com.wayoftime.bloodmagic package_group=com.wayoftime.bloodmagic
mod_version=1.3.3 mod_version=1.3.3
minetweaker_version=Dev-1.7.10-3.0.9B minetweaker_version=Dev-1.7.10-3.0.9B
build_number=5
mc_version=1.7.10 mc_version=1.7.10
build_number=3

View file

@ -11,6 +11,8 @@ import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; 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.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -296,7 +298,6 @@ import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.3.3", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory") @Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.3.3", guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
public class AlchemicalWizardry public class AlchemicalWizardry
{ {
public static boolean parseTextFiles = false; public static boolean parseTextFiles = false;
@ -498,8 +499,6 @@ public class AlchemicalWizardry
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) public void preInit(FMLPreInitializationEvent event)
{ {
File bmDirectory = new File("config/BloodMagic/schematics"); File bmDirectory = new File("config/BloodMagic/schematics");
if (!bmDirectory.exists() && bmDirectory.mkdirs()) if (!bmDirectory.exists() && bmDirectory.mkdirs())
@ -1270,8 +1269,6 @@ public class AlchemicalWizardry
isPneumaticCraftLoaded = Loader.isModLoaded("PneumaticCraft"); isPneumaticCraftLoaded = Loader.isModLoaded("PneumaticCraft");
isFMPLoaded = Loader.isModLoaded("ForgeMultipart"); isFMPLoaded = Loader.isModLoaded("ForgeMultipart");
BloodMagicConfiguration.loadBlacklist(); BloodMagicConfiguration.loadBlacklist();
BloodMagicConfiguration.blacklistRituals(); BloodMagicConfiguration.blacklistRituals();
@ -1921,5 +1918,6 @@ public class AlchemicalWizardry
event.registerServerCommand(new CommandBind()); event.registerServerCommand(new CommandBind());
event.registerServerCommand(new CommandUnbind()); event.registerServerCommand(new CommandUnbind());
event.registerServerCommand(new CommandSN()); event.registerServerCommand(new CommandSN());
event.registerServerCommand(new CommandDownloadGAPI());
} }
} }

View file

@ -4,5 +4,5 @@ import net.minecraft.item.ItemStack;
public interface ILPGauge public interface ILPGauge
{ {
public boolean canSeeLPBar(ItemStack itemStack); boolean canSeeLPBar(ItemStack itemStack);
} }

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.client; package WayofTime.alchemicalWizardry.client;
import WayofTime.alchemicalWizardry.common.thread.GAPIChecker;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
@ -194,5 +195,6 @@ public class ClientProxy extends CommonProxy
MinecraftForge.EVENT_BUS.register(ob); MinecraftForge.EVENT_BUS.register(ob);
KeyBindings.init(); KeyBindings.init();
MinecraftForge.EVENT_BUS.register(new ScrollHelper()); MinecraftForge.EVENT_BUS.register(new ScrollHelper());
new GAPIChecker().init();
} }
} }

View file

@ -1,5 +1,7 @@
package WayofTime.alchemicalWizardry.client.renderer; package WayofTime.alchemicalWizardry.client.renderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.ModBlocks; import WayofTime.alchemicalWizardry.ModBlocks;
@ -21,6 +23,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
* Created in Scala by Alex-Hawks * Created in Scala by Alex-Hawks
* Translated and implemented by Arcaratus * Translated and implemented by Arcaratus
*/ */
@SideOnly(Side.CLIENT)
public class RitualDivinerRender public class RitualDivinerRender
{ {
@SubscribeEvent @SubscribeEvent

View file

@ -78,7 +78,6 @@ public class BlockTeleposer extends BlockContainer
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) 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(); ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null) if (playerItem != null)
@ -169,8 +168,6 @@ public class BlockTeleposer extends BlockContainer
{ {
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi); TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf); TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
TileEntity tileI;
TileEntity tileF;
NBTTagCompound nbttag1 = new NBTTagCompound(); NBTTagCompound nbttag1 = new NBTTagCompound();
NBTTagCompound nbttag2 = new NBTTagCompound(); NBTTagCompound nbttag2 = new NBTTagCompound();

View file

@ -71,8 +71,17 @@ public class CommandSN extends CommandBase
} }
else if ("get".equalsIgnoreCase(astring[1])) else if ("get".equalsIgnoreCase(astring[1]))
{ {
int amount = SoulNetworkHandler.getCurrentEssence(owner); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
func_152373_a(icommandsender, this, "commands.soulnetwork.get.success", amount, 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 else
{ {

View file

@ -6,6 +6,7 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ISigil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; 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 posY = (float) (par3Entity.posY - par3Entity.getEyeHeight());
float posZ = Math.round(par3Entity.posZ); float posZ = Math.round(par3Entity.posZ);
List<EntityItem> 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<EntityItem> 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<EntityXPOrb> 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) for (EntityItem entity : entities)
{ {
@ -161,9 +163,15 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
entity.onCollideWithPlayer(par3EntityPlayer); entity.onCollideWithPlayer(par3EntityPlayer);
} }
} }
}
return; for (EntityXPOrb xpOrb : xpOrbs)
{
if (xpOrb != null && !par2World.isRemote)
{
xpOrb.onCollideWithPlayer(par3EntityPlayer);
}
}
}
} }
@Override @Override
@ -175,6 +183,7 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
float posY = (float) (player.posY - player.getEyeHeight()); float posY = (float) (player.posY - player.getEyeHeight());
float posZ = Math.round(player.posZ); float posZ = Math.round(player.posZ);
List<EntityItem> 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<EntityItem> 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<EntityXPOrb> 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) for (EntityItem entity : entities)
{ {
@ -183,6 +192,14 @@ public class SigilOfMagnetism extends EnergyItems implements ArmourUpgrade, IHol
entity.onCollideWithPlayer(player); entity.onCollideWithPlayer(player);
} }
} }
for (EntityXPOrb xpOrb : xpOrbs)
{
if (xpOrb != null && !world.isRemote)
{
xpOrb.onCollideWithPlayer(player);
}
}
} }
@Override @Override

View file

@ -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");
}
}

View file

@ -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<File> modFiles()
{
List<File> 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;
}
}
}

View file

@ -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)));
}
}
}

View file

@ -1,10 +0,0 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.tileentity.TileEntity;
public class TEImperfectRitualStone extends TileEntity
{
public TEImperfectRitualStone()
{
}
}

View file

@ -94,7 +94,7 @@ public class TETeleposer extends TEInventory
int zf = focusItem.zCoord(focus); int zf = focusItem.zCoord(focus);
World worldF = focusItem.getWorld(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 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 transportCount = 0;
int entityCount = 0; int entityCount = 0;

View file

@ -0,0 +1 @@
1.0.1-20

View file

@ -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.noPlayer=There is no player specified
commands.soulnetwork.noCommand=There is no command specified commands.soulnetwork.noCommand=There is no command specified
commands.soulnetwork.notACommand=That is not a valid command commands.soulnetwork.notACommand=That is not a valid command
commands.soulnetwork.fillMax.success=Successfully filled %s's Soul Network to their orb max!
#Tooltips #Tooltips
tooltip.activationcrystal.creativeonly=Creative Only - activates any ritual 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:firstPrick.desc=The first drop of life into the Altar...
achievement.alchemicalwizardry:weakOrb=Faintly Glowing Red... achievement.alchemicalwizardry:weakOrb=Faintly Glowing Red...
achievement.alchemicalwizardry:weakOrb.desc=This orb will suffice...for now... 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.