Minor tweaks + experimenting with a reagent guage for Project: Omega

This commit is contained in:
WayofTime 2014-12-09 19:06:47 -05:00
parent dd4c36b39c
commit 9ad3330e08
10 changed files with 259 additions and 189 deletions

View file

@ -1,5 +1,5 @@
#
#Fri Dec 05 14:08:30 EST 2014
#Sat Dec 06 10:00:16 EST 2014
mod_name=BloodMagic
forge_version=10.13.2.1232
ccc_version=1.0.4.29
@ -8,5 +8,5 @@ nei_version=1.0.3.64
package_group=com.wayoftime.bloodmagic
mod_version=1.3.0Beta
minetweaker_version=Dev-1.7.10-3.0.9B
build_number=3
mc_version=1.7.10
build_number=2

View file

@ -1,21 +1,14 @@
package WayofTime.alchemicalWizardry;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -1135,8 +1128,8 @@ public class AlchemicalWizardry
DemonVillageLootRegistry.init();
if(parseTextFiles)
this.parseTextFile();
// if(parseTextFiles)
// this.parseTextFile();
}
public static void initAlchemyPotionRecipes()
@ -1368,163 +1361,164 @@ public class AlchemicalWizardry
CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.cobblestone), 64);
}
public void parseTextFile()
{
File textFiles = new File("config/BloodMagic/bookDocs");
//if(textFiles.exists())
{
try {
System.out.println("I am in an island of files!");
InputStream input = AlchemicalWizardry.class.getResourceAsStream("/assets/alchemicalwizardryBooks/books/book.txt");
Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(true);
if(input != null)
{
DataInputStream in = new DataInputStream(input);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
int maxWidth = 25;
int maxLines = 16;
int currentPage = 0;
int pageIndex = 1;
String currentTitle = "aw.entry.Magnus";
String[] strings = new String[1];
strings[0] = "";
while ((strLine = br.readLine()) != null)
{
if(strLine.trim().isEmpty())
{
continue;
}
if(strLine.startsWith("//TITLE "))
{
String[] newStrings = new String[currentPage + 1 + 1]; //Just to show that it is increasing
for(int i=0; i<strings.length; i++)
{
newStrings[i] = strings[i];
}
currentPage++;
newStrings[currentPage - 1] = currentTitle + "." + pageIndex + "=" + newStrings[currentPage - 1];
newStrings[currentPage] = "";
strings = newStrings;
pageIndex = 1;
String title = strLine.replaceFirst("//TITLE ", " ").trim();
currentTitle = "aw.entry." + title;
continue;
}
strLine = strLine.replace('”', '"').replace('“','"');
if(Minecraft.getMinecraft() != null && Minecraft.getMinecraft().fontRenderer != null)
{
List list = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strLine, 110);
if(list != null)
{
System.out.println("Number of lines: " + list.size());
}
}
String[] cutStrings = strLine.split(" ");
for(String word : cutStrings)
{
boolean changePage = false;
int length = word.length();
word = word.replace('\t', ' ');
List list = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage] + " " + word, 110);
// if(currentWidth != 0 && currentWidth + length + 1 > maxWidth)
// {
// currentLine++;
// currentWidth = 0;
// }
//if(currentLine > maxLines)
if(list.size() > maxLines)
{
changePage = true;
}
if(changePage)
{
String[] newStrings = new String[currentPage + 1 + 1]; //Just to show that it is increasing
for(int i=0; i<strings.length; i++)
{
newStrings[i] = strings[i];
}
currentPage++;
newStrings[currentPage - 1] = currentTitle + "." + pageIndex + "=" + newStrings[currentPage - 1];
newStrings[currentPage] = word;
strings = newStrings;
pageIndex++;
changePage = false;
}else
{
strings[currentPage] = strings[currentPage] + " " + word;
}
}
int currentLines = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage], 110).size();
while(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage] + " ", 110).size() <= currentLines)
{
{
strings[currentPage] = strings[currentPage] + " ";
}
}
System.out.println("" + strLine);
}
strings[currentPage] = currentTitle + "." + pageIndex + "=" + strings[currentPage];
File bmDirectory = new File("src/main/resources/assets/alchemicalwizardryBooks");
if(!bmDirectory.exists())
{
bmDirectory.mkdirs();
}
File file = new File(bmDirectory, "books.txt");
// if (file.exists() && file.length() > 3L)
// {
//
// }else
{
PrintWriter writer = new PrintWriter(file);
for(String stri : strings)
{
writer.println(stri);
}
writer.close();
}
// @SideOnly(Side.CLIENT)
// public void parseTextFile()
// {
// File textFiles = new File("config/BloodMagic/bookDocs");
// //if(textFiles.exists())
// {
// try {
// System.out.println("I am in an island of files!");
//
// InputStream input = AlchemicalWizardry.class.getResourceAsStream("/assets/alchemicalwizardryBooks/books/book.txt");
//
// Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(true);
//
// if(input != null)
// {
// DataInputStream in = new DataInputStream(input);
// BufferedReader br = new BufferedReader(new InputStreamReader(in));
// String strLine;
// //Read File Line By Line
//
}
Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(false);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
// int maxWidth = 25;
// int maxLines = 16;
//
// int currentPage = 0;
//
// int pageIndex = 1;
//
// String currentTitle = "aw.entry.Magnus";
//
// String[] strings = new String[1];
// strings[0] = "";
//
// while ((strLine = br.readLine()) != null)
// {
// if(strLine.trim().isEmpty())
// {
// continue;
// }
//
// if(strLine.startsWith("//TITLE "))
// {
// String[] newStrings = new String[currentPage + 1 + 1]; //Just to show that it is increasing
// for(int i=0; i<strings.length; i++)
// {
// newStrings[i] = strings[i];
// }
//
// currentPage++;
// newStrings[currentPage - 1] = currentTitle + "." + pageIndex + "=" + newStrings[currentPage - 1];
// newStrings[currentPage] = "";
// strings = newStrings;
//
// pageIndex = 1;
//
// String title = strLine.replaceFirst("//TITLE ", " ").trim();
// currentTitle = "aw.entry." + title;
//
// continue;
// }
//
// strLine = strLine.replace('”', '"').replace('“','"');
//
// if(Minecraft.getMinecraft() != null && Minecraft.getMinecraft().fontRenderer != null)
// {
// List list = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strLine, 110);
// if(list != null)
// {
// System.out.println("Number of lines: " + list.size());
// }
// }
//
// String[] cutStrings = strLine.split(" ");
//
// for(String word : cutStrings)
// {
// boolean changePage = false;
// int length = word.length();
// word = word.replace('\t', ' ');
// List list = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage] + " " + word, 110);
//
//// if(currentWidth != 0 && currentWidth + length + 1 > maxWidth)
//// {
//// currentLine++;
//// currentWidth = 0;
//// }
// //if(currentLine > maxLines)
// if(list.size() > maxLines)
// {
// changePage = true;
// }
// if(changePage)
// {
// String[] newStrings = new String[currentPage + 1 + 1]; //Just to show that it is increasing
// for(int i=0; i<strings.length; i++)
// {
// newStrings[i] = strings[i];
// }
//
// currentPage++;
//
// newStrings[currentPage - 1] = currentTitle + "." + pageIndex + "=" + newStrings[currentPage - 1];
// newStrings[currentPage] = word;
// strings = newStrings;
//
// pageIndex++;
//
// changePage = false;
// }else
// {
// strings[currentPage] = strings[currentPage] + " " + word;
// }
// }
//
// int currentLines = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage], 110).size();
// while(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(strings[currentPage] + " ", 110).size() <= currentLines)
// {
// {
// strings[currentPage] = strings[currentPage] + " ";
// }
// }
//
// System.out.println("" + strLine);
// }
//
// strings[currentPage] = currentTitle + "." + pageIndex + "=" + strings[currentPage];
//
// File bmDirectory = new File("src/main/resources/assets/alchemicalwizardryBooks");
// if(!bmDirectory.exists())
// {
// bmDirectory.mkdirs();
// }
//
// File file = new File(bmDirectory, "books.txt");
//// if (file.exists() && file.length() > 3L)
//// {
////
//// }else
// {
// PrintWriter writer = new PrintWriter(file);
// for(String stri : strings)
// {
// writer.println(stri);
// }
// writer.close();
// }
//
////
// }
//
// Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(false);
//
// } catch (FileNotFoundException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// }
}

View file

@ -1,22 +1,31 @@
package WayofTime.alchemicalWizardry.client.renderer;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
public class RenderHelper
{
@ -24,6 +33,8 @@ public class RenderHelper
public static boolean enableItemName = false;
public static boolean enabled = true;
public static boolean showInChat = true;
public static int zLevel = 0;
private static int xOffsetDefault = +50;
public static int xOffset = xOffsetDefault;
@ -53,6 +64,7 @@ public class RenderHelper
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
displayArmorStatus(mc);
renderTestHUD(mc);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
@ -141,6 +153,68 @@ public class RenderHelper
return r;
}
private static void renderTestHUD(Minecraft mc)
{
int x = 0;
int y = 0;
int l;
float f;
float f3;
float f4;
TextureManager p_77015_2_ = mc.getTextureManager();
ItemStack p_77015_3_ = new ItemStack(ModItems.activationCrystal);
Object object = p_77015_3_.getIconIndex();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
ResourceLocation resourcelocation = p_77015_2_.getResourceLocation(p_77015_3_.getItemSpriteNumber());
p_77015_2_.bindTexture(resourcelocation);
if (object == null)
{
object = ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("missingno");
}
l = p_77015_3_.getItem().getColorFromItemStack(p_77015_3_, 0);
f3 = (float)(l >> 16 & 255) / 255.0F;
f4 = (float)(l >> 8 & 255) / 255.0F;
f = (float)(l & 255) / 255.0F;
// if (this.renderWithColor)
// {
// GL11.glColor4f(f3, f4, f, 1.0F);
// }
GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up.
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
renderIcon(x, y, (IIcon)object, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
// if (renderEffect && p_77015_3_.hasEffect(0))
// {
// renderEffect(p_77015_2_, x, y);
// }
GL11.glEnable(GL11.GL_LIGHTING);
}
public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(p_94149_1_ + 0), (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMaxV());
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)(p_94149_2_ + p_94149_5_), (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMaxV());
tessellator.addVertexWithUV((double)(p_94149_1_ + p_94149_4_), (double)(p_94149_2_ + 0), (double)zLevel, (double)p_94149_3_.getMaxU(), (double)p_94149_3_.getMinV());
tessellator.addVertexWithUV((double)(p_94149_1_ + 0), (double)(p_94149_2_ + 0), (double)zLevel, (double)p_94149_3_.getMinU(), (double)p_94149_3_.getMinV());
tessellator.draw();
}
private static void displayArmorStatus(Minecraft mc)
{

View file

@ -19,6 +19,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import codechicken.multipart.MultipartHelper;
@ -152,7 +153,7 @@ public class BlockTeleposer extends BlockContainer
return new TETeleposer();
}
public static boolean swapBlocks(World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
{
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
@ -181,7 +182,7 @@ public class BlockTeleposer extends BlockContainer
return false;
}
if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner || blockI instanceof BlockPortal || blockF instanceof BlockPortal)
if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner || caller instanceof TEDemonPortal ? false : blockI instanceof BlockPortal || blockF instanceof BlockPortal)
{
return false;
}

View file

@ -40,6 +40,7 @@ public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt
@Override
public void onLivingUpdate()
{
super.onLivingUpdate();
this.fallDistance = 0;
}

View file

@ -1296,7 +1296,7 @@ public class TEDemonPortal extends TileEntity
int yDestination = yLevel + yOffset;
if(yCoord != yDestination)
{
BlockTeleposer.swapBlocks(worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yDestination, zCoord);
BlockTeleposer.swapBlocks(this, worldObj, worldObj, xCoord, yCoord, zCoord, xCoord, yDestination, zCoord);
}else
{
//Nuthin - just as a reminder that we can now increment properly

View file

@ -96,7 +96,7 @@ public class RitualEffectMagnetic extends RitualEffect
if (oreName.contains("ore"))
{
//Allow swapping code. This means the searched block is an ore.
BlockTeleposer.swapBlocks(world, world, x + i, j, z + k, xRep, yRep, zRep);
BlockTeleposer.swapBlocks(this, world, world, x + i, j, z + k, xRep, yRep, zRep);
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
if (hasPotentia)

View file

@ -30,7 +30,7 @@ public class MeleeDefensiveEarth extends MeleeSpellCenteredWorldEffect
{
for (int j = 0; j < vertRadius; j++)
{
BlockTeleposer.swapBlocks(world, world, posX + i * zOff, posY + j, posZ + i * xOff, posX + i * zOff, posY + j - vertRadius, posZ + i * xOff);
BlockTeleposer.swapBlocks(this, world, world, posX + i * zOff, posY + j, posZ + i * xOff, posX + i * zOff, posY + j - vertRadius, posZ + i * xOff);
}
}
}

View file

@ -40,7 +40,7 @@ public class SelfDefaultEarth extends SelfSpellEffect
{
if (!world.isAirBlock(posX + i, posY + j, posZ + k) && !SpellHelper.isBlockFluid(world.getBlock(posX + i, posY + j, posZ + k)))
{
BlockTeleposer.swapBlocks(world, world, posX + i, posY, posZ + k, posX + i, posY + j, posZ + k);
BlockTeleposer.swapBlocks(this, world, world, posX + i, posY, posZ + k, posX + i, posY + j, posZ + k);
break;
}

View file

@ -248,7 +248,7 @@ public class TETeleposer extends TileEntity implements IInventory
for (int j = -(focusLevel - 1); j <= (focusLevel - 1); j++)
{
{
if (BlockTeleposer.swapBlocks(worldObj, worldF, xCoord + i, yCoord + 1 + k, zCoord + j, xf + i, yf + 1 + k, zf + j))
if (BlockTeleposer.swapBlocks(this, worldObj, worldF, xCoord + i, yCoord + 1 + k, zCoord + j, xf + i, yf + 1 + k, zf + j))
{
transportCount++;
}