From 9ad3330e0834ae593cd21da23c8cb7ed8998e569 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 9 Dec 2014 19:06:47 -0500 Subject: [PATCH] Minor tweaks + experimenting with a reagent guage for Project: Omega --- build.properties | 4 +- .../AlchemicalWizardry.java | 328 +++++++++--------- .../client/renderer/RenderHelper.java | 100 +++++- .../common/block/BlockTeleposer.java | 5 +- .../demon/EntityMinorDemonGruntWind.java | 1 + .../tileEntity/TEDemonPortal.java | 2 +- .../common/rituals/RitualEffectMagnetic.java | 2 +- .../earth/MeleeDefensiveEarth.java | 2 +- .../impactEffects/earth/SelfDefaultEarth.java | 2 +- .../common/tileEntity/TETeleposer.java | 2 +- 10 files changed, 259 insertions(+), 189 deletions(-) diff --git a/build.properties b/build.properties index 20198283..dfa1c4ce 100644 --- a/build.properties +++ b/build.properties @@ -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 diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 2e11cafd..b01f006f 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -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 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 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 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 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(); +// } +// } +// } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java index e74f7aa4..28ca5ae6 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java @@ -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) { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java index ddad5f9f..04aa2013 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockTeleposer.java @@ -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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java index f5ab85ee..19cc1ce9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGruntWind.java @@ -40,6 +40,7 @@ public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt @Override public void onLivingUpdate() { + super.onLivingUpdate(); this.fallDistance = 0; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java index 8d5da003..1fa12fff 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java @@ -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 diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java index 1c710b8f..4a6f6670 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectMagnetic.java @@ -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) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java index 7be57961..d82ca011 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/MeleeDefensiveEarth.java @@ -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); } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java index d32f7ace..53b038c0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/SelfDefaultEarth.java @@ -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; } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java index a9cfaa4d..1b3743e3 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java @@ -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++; }