diff --git a/1.7.10/api/java/thaumcraft/api/IRunicArmor.java b/1.7.10/api/java/thaumcraft/api/IRunicArmor.java index 89d3c379..5dd31100 100644 --- a/1.7.10/api/java/thaumcraft/api/IRunicArmor.java +++ b/1.7.10/api/java/thaumcraft/api/IRunicArmor.java @@ -1,6 +1,5 @@ package thaumcraft.api; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; /** diff --git a/1.7.10/api/java/thaumcraft/api/ThaumcraftApi.java b/1.7.10/api/java/thaumcraft/api/ThaumcraftApi.java index 9dd0b6d2..0b135d31 100644 --- a/1.7.10/api/java/thaumcraft/api/ThaumcraftApi.java +++ b/1.7.10/api/java/thaumcraft/api/ThaumcraftApi.java @@ -115,7 +115,7 @@ public class ThaumcraftApi { */ public static void addSmeltingBonus(ItemStack in, ItemStack out) { smeltingBonus.put( - Arrays.asList(Item.getIdFromItem(in.getItem()),in.getItemDamage()), + Arrays.asList(in.getItem(),in.getItemDamage()), new ItemStack(out.getItem(),0,out.getItemDamage())); } @@ -135,9 +135,9 @@ public class ThaumcraftApi { * @return the The bonus item that can be produced */ public static ItemStack getSmeltingBonus(ItemStack in) { - ItemStack out = smeltingBonus.get(Arrays.asList(Item.getIdFromItem(in.getItem()),in.getItemDamage())); + ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage())); if (out==null) { - out = smeltingBonus.get(Arrays.asList(Item.getIdFromItem(in.getItem()),OreDictionary.WILDCARD_VALUE)); + out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE)); } if (out==null) { String od = OreDictionary.getOreName( OreDictionary.getOreID(in)); @@ -232,6 +232,7 @@ public class ThaumcraftApi { /** * @param key the research key required for this recipe to work. * @param result the output result + * @param catalyst an itemstack of the catalyst or a string if it is an ore dictionary item * @param cost the vis cost * @param tags the aspects required to craft this */ @@ -388,6 +389,43 @@ public class ThaumcraftApi { registerObjectTag(item,tmp); } } + + //WARP /////////////////////////////////////////////////////////////////////////////////////// + private static HashMap warpMap = new HashMap(); + + /** + * This method is used to determine how much warp is gained if the item is crafted + * @param craftresult The item crafted + * @param amount how much warp is gained + */ + public static void addWarpToItem(ItemStack craftresult, int amount) { + warpMap.put(Arrays.asList(craftresult.getItem(),craftresult.getItemDamage()),amount); + } + + /** + * This method is used to determine how much warp is gained if the sent item is crafted + * @param in The item crafted + * @param amount how much warp is gained + */ + public static void addWarpToResearch(String research, int amount) { + warpMap.put(research, amount); + } + + /** + * Returns how much warp is gained from the item or research passed in + * @param in itemstack or string + * @return how much warp it will give + */ + public static int getWarp(Object in) { + if (in==null) return 0; + if (in instanceof ItemStack && warpMap.containsKey(Arrays.asList(((ItemStack)in).getItem(),((ItemStack)in).getItemDamage()))) { + return warpMap.get(Arrays.asList(((ItemStack)in).getItem(),((ItemStack)in).getItemDamage())); + } else + if (in instanceof String && warpMap.containsKey((String)in)) { + return warpMap.get((String)in); + } + return 0; + } //CROPS ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/1.7.10/api/java/thaumcraft/api/ThaumcraftApiHelper.java b/1.7.10/api/java/thaumcraft/api/ThaumcraftApiHelper.java index b5feb068..a4b6d42a 100644 --- a/1.7.10/api/java/thaumcraft/api/ThaumcraftApiHelper.java +++ b/1.7.10/api/java/thaumcraft/api/ThaumcraftApiHelper.java @@ -140,7 +140,8 @@ public class ThaumcraftApiHelper { { return false; } - return (target.getItem() == input.getItem() && ((target.getItemDamage() == OreDictionary.WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); + return (target.getItem() == input.getItem() && + ((target.getItemDamage() == OreDictionary.WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); } diff --git a/1.7.10/api/java/thaumcraft/api/TileThaumcraft.java b/1.7.10/api/java/thaumcraft/api/TileThaumcraft.java new file mode 100644 index 00000000..56ccae87 --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/TileThaumcraft.java @@ -0,0 +1,63 @@ +package thaumcraft.api; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; + +/** + * + * @author azanor + * + * Custom tile entity class I use for most of my tile entities. Setup in such a way that only + * the nbt data within readCustomNBT / writeCustomNBT will be sent to the client when the tile + * updates. Apart from all the normal TE data that gets sent that is. + * + */ +public class TileThaumcraft extends TileEntity { + + //NBT stuff + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + readCustomNBT(nbttagcompound); + } + + public void readCustomNBT(NBTTagCompound nbttagcompound) + { + //TODO + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + writeCustomNBT(nbttagcompound); + } + + public void writeCustomNBT(NBTTagCompound nbttagcompound) + { + //TODO + } + + //Client Packet stuff + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeCustomNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, nbttagcompound); + } + + @Override + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + super.onDataPacket(net, pkt); + this.readCustomNBT(pkt.func_148857_g()); + } + + + + +} diff --git a/1.7.10/api/java/thaumcraft/api/WorldCoordinates.java b/1.7.10/api/java/thaumcraft/api/WorldCoordinates.java new file mode 100644 index 00000000..6c620af5 --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/WorldCoordinates.java @@ -0,0 +1,117 @@ +package thaumcraft.api; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public class WorldCoordinates implements Comparable +{ + public int x; + + /** the y coordinate */ + public int y; + + /** the z coordinate */ + public int z; + + public int dim; + + public WorldCoordinates() {} + + public WorldCoordinates(int par1, int par2, int par3, int d) + { + this.x = par1; + this.y = par2; + this.z = par3; + this.dim = d; + } + + public WorldCoordinates(TileEntity tile) + { + this.x = tile.xCoord; + this.y = tile.yCoord; + this.z = tile.zCoord; + this.dim = tile.getWorldObj().provider.dimensionId; + } + + public WorldCoordinates(WorldCoordinates par1ChunkCoordinates) + { + this.x = par1ChunkCoordinates.x; + this.y = par1ChunkCoordinates.y; + this.z = par1ChunkCoordinates.z; + this.dim = par1ChunkCoordinates.dim; + } + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof WorldCoordinates)) + { + return false; + } + else + { + WorldCoordinates coordinates = (WorldCoordinates)par1Obj; + return this.x == coordinates.x && this.y == coordinates.y && this.z == coordinates.z && this.dim == coordinates.dim ; + } + } + + public int hashCode() + { + return this.x + this.y << 8 + this.z << 16 + this.dim << 24; + } + + /** + * Compare the coordinate with another coordinate + */ + public int compareWorldCoordinate(WorldCoordinates par1) + { + return this.dim == par1.dim ? ( + this.y == par1.y ? (this.z == par1.z ? this.x - par1.x : this.z - par1.z) : this.y - par1.y) : -1; + } + + public void set(int par1, int par2, int par3, int d) + { + this.x = par1; + this.y = par2; + this.z = par3; + this.dim = d; + } + + /** + * Returns the squared distance between this coordinates and the coordinates given as argument. + */ + public float getDistanceSquared(int par1, int par2, int par3) + { + float f = (float)(this.x - par1); + float f1 = (float)(this.y - par2); + float f2 = (float)(this.z - par3); + return f * f + f1 * f1 + f2 * f2; + } + + /** + * Return the squared distance between this coordinates and the ChunkCoordinates given as argument. + */ + public float getDistanceSquaredToWorldCoordinates(WorldCoordinates par1ChunkCoordinates) + { + return this.getDistanceSquared(par1ChunkCoordinates.x, par1ChunkCoordinates.y, par1ChunkCoordinates.z); + } + + public int compareTo(Object par1Obj) + { + return this.compareWorldCoordinate((WorldCoordinates)par1Obj); + } + + public void readNBT(NBTTagCompound nbt) { + this.x = nbt.getInteger("w_x"); + this.y = nbt.getInteger("w_y"); + this.z = nbt.getInteger("w_z"); + this.dim = nbt.getInteger("w_d"); + } + + public void writeNBT(NBTTagCompound nbt) { + nbt.setInteger("w_x",x); + nbt.setInteger("w_y",y); + nbt.setInteger("w_z",z); + nbt.setInteger("w_d",dim); + } + +} diff --git a/1.7.10/api/java/thaumcraft/api/aspects/AspectSourceHelper.java b/1.7.10/api/java/thaumcraft/api/aspects/AspectSourceHelper.java index 14dbf8bc..f22d8ce5 100644 --- a/1.7.10/api/java/thaumcraft/api/aspects/AspectSourceHelper.java +++ b/1.7.10/api/java/thaumcraft/api/aspects/AspectSourceHelper.java @@ -9,6 +9,7 @@ import cpw.mods.fml.common.FMLLog; public class AspectSourceHelper { static Method drainEssentia; + static Method findEssentia; /** * This method is what is used to drain essentia from jars and other sources for things like * infusion crafting or powering the arcane furnace. A record of possible sources are kept track of @@ -23,14 +24,35 @@ public class AspectSourceHelper { public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) { try { if(drainEssentia == null) { - Class fake = Class.forName("thaumcraft.common.lib.EssentiaHandler"); + Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler"); drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class); } return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range); } catch(Exception ex) { - FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.EssentiaHandler method drainEssentia"); + FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method drainEssentia"); } return false; } + /** + * This method returns if there is any essentia of the passed type that can be drained. It in no way checks how + * much there is, only if an essentia container nearby contains at least 1 point worth. + * @param tile the tile entity that is checking the essentia + * @param aspect the aspect that you are looking for + * @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions. + * @param range how many blocks you wish to search for essentia sources. + * @return boolean returns true if essentia was found and removed from a source. + */ + public static boolean findEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) { + try { + if(findEssentia == null) { + Class fake = Class.forName("thaumcraft.common.lib.events.EssentiaHandler"); + findEssentia = fake.getMethod("findEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class); + } + return (Boolean) findEssentia.invoke(null, tile, aspect, direction, range); + } catch(Exception ex) { + FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.events.EssentiaHandler method findEssentia"); + } + return false; + } } diff --git a/1.7.10/api/java/thaumcraft/api/crafting/CrucibleRecipe.java b/1.7.10/api/java/thaumcraft/api/crafting/CrucibleRecipe.java index ebd84791..9c1e8a62 100644 --- a/1.7.10/api/java/thaumcraft/api/crafting/CrucibleRecipe.java +++ b/1.7.10/api/java/thaumcraft/api/crafting/CrucibleRecipe.java @@ -34,7 +34,8 @@ public class CrucibleRecipe { return false; } else if (catalyst instanceof ArrayList && ((ArrayList)catalyst).size()>0) { - if (!ThaumcraftApiHelper.containsMatch(true, ((ArrayList)catalyst).toArray(new ItemStack[]{}), cat)) return false; + ItemStack[] ores = ((ArrayList)catalyst).toArray(new ItemStack[]{}); + if (!ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return false; } if (itags==null) return false; for (Aspect tag:aspects.getAspects()) { @@ -48,8 +49,8 @@ public class CrucibleRecipe { return true; } else if (catalyst instanceof ArrayList && ((ArrayList)catalyst).size()>0) { - if (ThaumcraftApiHelper.containsMatch(true, - ((ArrayList)catalyst).toArray(new ItemStack[]{}), cat)) return true; + ItemStack[] ores = ((ArrayList)catalyst).toArray(new ItemStack[]{}); + if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{cat},ores)) return true; } return false; } @@ -71,4 +72,24 @@ public class CrucibleRecipe { return recipeOutput; } + +// @Override +// public int hashCode() { +// String hash = ""; +// if (catalyst instanceof ItemStack) { +// hash += ((ItemStack)catalyst).toString(); +// } else if (catalyst instanceof ArrayList && ((ArrayList)catalyst).size()>0) { +// for (ItemStack s:(ArrayList)catalyst) { +// hash += s.toString(); +// } +// } else { +// hash += catalyst.hashCode(); +// } +// hash += getRecipeOutput().toString(); +// for (Aspect a:aspects.getAspectsSorted()) { +// hash += a.getTag() + aspects.getAmount(a); +// } +// return hash.hashCode(); +// } + } diff --git a/1.7.10/api/java/thaumcraft/api/damagesource/DamageSourceIndirectThaumcraftEntity.java b/1.7.10/api/java/thaumcraft/api/damagesource/DamageSourceIndirectThaumcraftEntity.java new file mode 100644 index 00000000..1562d052 --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/damagesource/DamageSourceIndirectThaumcraftEntity.java @@ -0,0 +1,32 @@ +package thaumcraft.api.damagesource; + +import net.minecraft.entity.Entity; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; + +public class DamageSourceIndirectThaumcraftEntity extends EntityDamageSourceIndirect { + + private boolean fireDamage; + private float hungerDamage; + private boolean isUnblockable; + + + public DamageSourceIndirectThaumcraftEntity(String par1Str, + Entity par2Entity, Entity par3Entity) { + super(par1Str, par2Entity, par3Entity); + } + + + public DamageSource setFireDamage() + { + this.fireDamage = true; + return this; + } + + public DamageSource setDamageBypassesArmor() + { + this.isUnblockable = true; + this.hungerDamage = 0.0F; + return this; + } +} diff --git a/1.7.10/api/java/thaumcraft/api/damagesource/DamageSourceThaumcraft.java b/1.7.10/api/java/thaumcraft/api/damagesource/DamageSourceThaumcraft.java new file mode 100644 index 00000000..7c277f28 --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/damagesource/DamageSourceThaumcraft.java @@ -0,0 +1,46 @@ +package thaumcraft.api.damagesource; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSource; + +public class DamageSourceThaumcraft extends DamageSource +{ + + public static DamageSource taint = new DamageSourceThaumcraft("taint").setDamageBypassesArmor().setMagicDamage(); + public static DamageSource tentacle = new DamageSourceThaumcraft("tentacle"); + public static DamageSource swarm = new DamageSourceThaumcraft("swarm"); + + protected DamageSourceThaumcraft(String par1Str) { + super(par1Str); + } + + /** This kind of damage can be blocked or not. */ + private boolean isUnblockable = false; + private boolean isDamageAllowedInCreativeMode = false; + private float hungerDamage = 0.3F; + + /** This kind of damage is based on fire or not. */ + private boolean fireDamage; + + /** This kind of damage is based on a projectile or not. */ + private boolean projectile; + + /** + * Whether this damage source will have its damage amount scaled based on the current difficulty. + */ + private boolean difficultyScaled; + private boolean magicDamage = false; + private boolean explosion = false; + + public static DamageSource causeSwarmDamage(EntityLivingBase par0EntityLiving) + { + return new EntityDamageSource("swarm", par0EntityLiving); + } + + public static DamageSource causeTentacleDamage(EntityLivingBase par0EntityLiving) + { + return new EntityDamageSource("tentacle", par0EntityLiving); + } + +} diff --git a/1.7.10/api/java/thaumcraft/api/entities/ITaintedMob.java b/1.7.10/api/java/thaumcraft/api/entities/ITaintedMob.java new file mode 100644 index 00000000..83fb1fcb --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/entities/ITaintedMob.java @@ -0,0 +1,5 @@ +package thaumcraft.api.entities; + +public interface ITaintedMob { + +} diff --git a/1.7.10/api/java/thaumcraft/api/package-info.java b/1.7.10/api/java/thaumcraft/api/package-info.java new file mode 100644 index 00000000..0de39267 --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/package-info.java @@ -0,0 +1,4 @@ +@API(owner = "Thaumcraft", apiVersion = "4.2.0.0", provides = "Thaumcraft|API") +package thaumcraft.api; + +import cpw.mods.fml.common.API; diff --git a/1.7.10/api/java/thaumcraft/api/potions/PotionFluxTaint.java b/1.7.10/api/java/thaumcraft/api/potions/PotionFluxTaint.java new file mode 100644 index 00000000..b718de4b --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/potions/PotionFluxTaint.java @@ -0,0 +1,67 @@ +package thaumcraft.api.potions; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.util.ResourceLocation; +import thaumcraft.api.damagesource.DamageSourceThaumcraft; +import thaumcraft.api.entities.ITaintedMob; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class PotionFluxTaint extends Potion +{ + public static PotionFluxTaint instance = null; // will be instantiated at runtime + private int statusIconIndex = -1; + + public PotionFluxTaint(int par1, boolean par2, int par3) + { + super(par1,par2,par3); + setIconIndex(0, 0); + } + + public static void init() + { + instance.setPotionName("potion.fluxtaint"); + instance.setIconIndex(3, 1); + instance.setEffectiveness(0.25D); + } + + @Override + public boolean isBadEffect() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public int getStatusIconIndex() { + Minecraft.getMinecraft().renderEngine.bindTexture(rl); + return super.getStatusIconIndex(); + } + + ResourceLocation rl = new ResourceLocation("thaumcraft","textures/misc/potions.png"); + + @Override + public void performEffect(EntityLivingBase target, int par2) { + if (target instanceof ITaintedMob) { + target.heal(1); + } else + if (!target.isEntityUndead() && !(target instanceof EntityPlayer)) + { + target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); + } + else + if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer))) + { + target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); + } + } + + public boolean isReady(int par1, int par2) + { + int k = 40 >> par2; + return k > 0 ? par1 % k == 0 : true; + } + +} diff --git a/1.7.10/api/java/thaumcraft/api/research/ResearchPage.java b/1.7.10/api/java/thaumcraft/api/research/ResearchPage.java index a2e7824a..fdada843 100644 --- a/1.7.10/api/java/thaumcraft/api/research/ResearchPage.java +++ b/1.7.10/api/java/thaumcraft/api/research/ResearchPage.java @@ -3,6 +3,7 @@ package thaumcraft.api.research; import java.util.List; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; @@ -24,7 +25,8 @@ public class ResearchPage { NORMAL_CRAFTING, INFUSION_CRAFTING, COMPOUND_CRAFTING, - INFUSION_ENCHANTMENT + INFUSION_ENCHANTMENT, + SMELTING } public PageType type = PageType.TEXT; @@ -79,6 +81,14 @@ public class ResearchPage { this.recipe = recipe; } + /** + * @param recipe a collection of arcane crafting recipes. + */ + public ResearchPage(CrucibleRecipe[] recipe) { + this.type = PageType.CRUCIBLE_CRAFTING; + this.recipe = recipe; + } + /** * @param recipe a collection of infusion crafting recipes. */ @@ -113,6 +123,15 @@ public class ResearchPage { this.recipeOutput = recipe.getRecipeOutput(); } + /** + * @param recipe a furnace smelting crafting recipe. + */ + public ResearchPage(ItemStack input) { + this.type = PageType.SMELTING; + this.recipe = input; + this.recipeOutput = FurnaceRecipes.smelting().getSmeltingResult(input); + } + /** * @param recipe an infusion crafting recipe. */ diff --git a/1.7.10/api/java/thaumcraft/api/visnet/TileVisNode.java b/1.7.10/api/java/thaumcraft/api/visnet/TileVisNode.java new file mode 100644 index 00000000..84b1400d --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/visnet/TileVisNode.java @@ -0,0 +1,188 @@ +package thaumcraft.api.visnet; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.HashMap; + +import thaumcraft.api.TileThaumcraft; +import thaumcraft.api.WorldCoordinates; +import thaumcraft.api.aspects.Aspect; + +/** + * @author Azanor + * + * The tile entity used by nodes in the vis energy network. A node is either a source (like an aura node), + * a transport relay or vis receiver (like the infernal furnace). + * + */ +public abstract class TileVisNode extends TileThaumcraft { + + WeakReference parent = null; + ArrayList> children = new ArrayList>(); + + /** + * @return the WorldCoordinates location of where this node is located + */ + public WorldCoordinates getLocation() { + return new WorldCoordinates(this); + } + + /** + * @return the number of blocks away this node will check for parent nodes to connect to. + */ + public abstract int getRange(); + + /** + * @return true if this is the source or root node of the vis network. + */ + public abstract boolean isSource(); + + /** + * This method should never be called directly. Use VisNetHandler.drainVis() instead + * @param aspect what aspect to drain + * @param vis how much to drain + * @return how much was actually drained + */ + public int consumeVis(Aspect aspect, int vis) { + if (VisNetHandler.isNodeValid(getParent())) { + int out = getParent().get().consumeVis(aspect, vis); + if (out>0) { + triggerConsumeEffect(aspect); + } + return out; + } + return 0; + } + + public void removeThisNode() { + for (WeakReference n:getChildren()) { + if (n!=null && n.get()!=null) { + n.get().removeThisNode(); + } + } + + children = new ArrayList>(); + if (VisNetHandler.isNodeValid(this.getParent())) { + this.getParent().get().nodeRefresh=true; + } + this.setParent(null); + this.parentChanged(); + + if (this.isSource()) { + HashMap> sourcelist = VisNetHandler.sources.get(worldObj.provider.dimensionId); + if (sourcelist==null) { + sourcelist = new HashMap>(); + } + sourcelist.remove(getLocation()); + VisNetHandler.sources.put( worldObj.provider.dimensionId, sourcelist ); + } + + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + + + @Override + public void invalidate() { + removeThisNode(); + super.invalidate(); + } + + public void triggerConsumeEffect(Aspect aspect) { } + + /** + * @return + */ + public WeakReference getParent() { + return parent; + } + + /** + * @return + */ + public WeakReference getRootSource() { + return VisNetHandler.isNodeValid(getParent()) ? + getParent().get().getRootSource() : this.isSource() ? + new WeakReference(this) : null; + } + + /** + * @param parent + */ + public void setParent(WeakReference parent) { + this.parent = parent; + } + + /** + * @return + */ + public ArrayList> getChildren() { + return children; + } + + @Override + public boolean canUpdate() { + return true; + } + + protected int nodeCounter = 0; + private boolean nodeRegged = false; + public boolean nodeRefresh = false; + + @Override + public void updateEntity() { + + if (!worldObj.isRemote && ((nodeCounter++) % 40==0 || nodeRefresh)) { + //check for changes + if (!nodeRefresh && children.size()>0) { + for (WeakReference n:children) { + if (n==null || n.get()==null) { + nodeRefresh=true; + break; + } + } + } + + //refresh linked nodes + if (nodeRefresh) { + for (WeakReference n:children) { + if (n.get()!=null) { + n.get().nodeRefresh=true; + } + } + children.clear(); + parent=null; + } + + //redo stuff + if (isSource() && !nodeRegged) { + VisNetHandler.addSource(getWorldObj(), this); + nodeRegged = true; + } else + if (!isSource() && !VisNetHandler.isNodeValid(getParent())) { + setParent(VisNetHandler.addNode(getWorldObj(), this)); + nodeRefresh=true; + } + + if (nodeRefresh) { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + parentChanged(); + } + nodeRefresh=false; + } + + } + + public void parentChanged() { } + + /** + * @return the type of shard this is attuned to: + * none -1, air 0, fire 1, water 2, earth 3, order 4, entropy 5 + * Should return -1 for most implementations + */ + public byte getAttunement() { + return -1; + } + + +} diff --git a/1.7.10/api/java/thaumcraft/api/visnet/VisNetHandler.java b/1.7.10/api/java/thaumcraft/api/visnet/VisNetHandler.java new file mode 100644 index 00000000..baf46d8e --- /dev/null +++ b/1.7.10/api/java/thaumcraft/api/visnet/VisNetHandler.java @@ -0,0 +1,284 @@ +package thaumcraft.api.visnet; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; + +import net.minecraft.world.World; +import thaumcraft.api.WorldCoordinates; +import thaumcraft.api.aspects.Aspect; +import cpw.mods.fml.common.FMLLog; + +public class VisNetHandler { + + // / NODE DRAINING + /** + * This method drains vis from a relay or source near the passed in + * location. The amount received can be less than the amount requested so + * take that into account. + * + * @param world + * @param x the x position of the draining block or entity + * @param y the y position of the draining block or entity + * @param z the z position of the draining block or entity + * @param aspect what aspect to drain + * @param vis how much to drain + * @return how much was actually drained + */ + public static int drainVis(World world, int x, int y, int z, Aspect aspect, int amount) { + + int drainedAmount = 0; + + WorldCoordinates drainer = new WorldCoordinates(x, y, z, + world.provider.dimensionId); + if (!nearbyNodes.containsKey(drainer)) { + calculateNearbyNodes(world, x, y, z); + } + + ArrayList> nodes = nearbyNodes.get(drainer); + if (nodes!=null && nodes.size()>0) + for (WeakReference noderef : nodes) { + + TileVisNode node = noderef.get(); + + if (node == null) continue; + + int a = node.consumeVis(aspect, amount); + drainedAmount += a; + amount -= a; + if (a>0) { + int color = Aspect.getPrimalAspects().indexOf(aspect); + generateVisEffect(world.provider.dimensionId, x, y, z, node.xCoord, node.yCoord, node.zCoord, color); + } + if (amount <= 0) { + break; + } + } + + return drainedAmount; + } + + static Method generateVisEffect; + public static void generateVisEffect(int dim, int x, int y, int z, int x2, int y2, int z2, int color) { + try { + if(generateVisEffect == null) { + Class fake = Class.forName("thaumcraft.common.lib.Utils"); + generateVisEffect = fake.getMethod("generateVisEffect", int.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class); + } + generateVisEffect.invoke(null, dim, x,y,z,x2,y2,z2,color); + } catch(Exception ex) { + FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.Utils method generateVisEffect"); + } + } + + public static HashMap>> sources = new HashMap>>(); + + public static void addSource(World world, TileVisNode vs) { + HashMap> sourcelist = sources + .get(world.provider.dimensionId); + if (sourcelist == null) { + sourcelist = new HashMap>(); + } + sourcelist.put(vs.getLocation(), new WeakReference(vs)); + sources.put(world.provider.dimensionId, sourcelist); + nearbyNodes.clear(); + } + + public static boolean isNodeValid(WeakReference node) { + if (node == null || node.get() == null || node.get().isInvalid()) + return false; + return true; + } + + public static WeakReference addNode(World world, TileVisNode vn) { + WeakReference ref = new WeakReference(vn); + + HashMap> sourcelist = sources + .get(world.provider.dimensionId); + if (sourcelist == null) { + sourcelist = new HashMap>(); + return null; + } + + ArrayList nearby = new ArrayList(); + + for (WeakReference root : sourcelist.values()) { + if (!isNodeValid(root)) + continue; + + TileVisNode source = root.get(); + + float r = inRange(world, vn.getLocation(), source.getLocation(), + vn.getRange()); + if (r > 0) { + nearby.add(new Object[] { source, r - vn.getRange() * 2 }); + } + nearby = findClosestNodes(vn, source, nearby); + } + + float dist = Float.MAX_VALUE; + TileVisNode closest = null; + if (nearby.size() > 0) { + for (Object[] o : nearby) { + if ((Float) o[1] < dist) {// && canNodeBeSeen(vn,(TileVisNode) + // o[0])) { + dist = (Float) o[1]; + closest = (TileVisNode) o[0]; + } + } + } + if (closest != null) { + closest.getChildren().add(ref); + nearbyNodes.clear(); + return new WeakReference(closest); + } + + return null; + } + + public static ArrayList findClosestNodes(TileVisNode target, + TileVisNode root, ArrayList in) { + TileVisNode closestChild = null; + + for (WeakReference child : root.getChildren()) { + TileVisNode n = child.get(); + + if (n != null + && !n.equals(target) + && !n.equals(root) + && (target.getAttunement() == -1 || n.getAttunement() == -1 || n + .getAttunement() == target.getAttunement())) { + + float r2 = inRange(n.getWorldObj(), n.getLocation(), + target.getLocation(), target.getRange()); + if (r2 > 0) { + in.add(new Object[] { n, r2 }); + } + + in = findClosestNodes(target, n, in); + } + } + return in; + } + + private static float inRange(World world, WorldCoordinates cc1, + WorldCoordinates cc2, int range) { + float distance = cc1.getDistanceSquaredToWorldCoordinates(cc2); + return distance > range * range ? -1 : distance; + } + + private static HashMap>> nearbyNodes = new HashMap>>(); + + private static void calculateNearbyNodes(World world, int x, int y, int z) { + + HashMap> sourcelist = sources + .get(world.provider.dimensionId); + if (sourcelist == null) { + sourcelist = new HashMap>(); + return; + } + + ArrayList> cn = new ArrayList>(); + WorldCoordinates drainer = new WorldCoordinates(x, y, z, + world.provider.dimensionId); + + ArrayList nearby = new ArrayList(); + + for (WeakReference root : sourcelist.values()) { + + if (!isNodeValid(root)) + continue; + + TileVisNode source = root.get(); + + TileVisNode closest = null; + float range = Float.MAX_VALUE; + + float r = inRange(world, drainer, source.getLocation(), + source.getRange()); + if (r > 0) { + range = r; + closest = source; + } + + ArrayList> children = new ArrayList>(); + children = getAllChildren(source,children); + + for (WeakReference child : children) { + TileVisNode n = child.get(); + if (n != null && !n.equals(root)) { + + float r2 = inRange(n.getWorldObj(), n.getLocation(), + drainer, n.getRange()); + if (r2 > 0 && r2 < range) { + range = r2; + closest = n; + } + } + } + + if (closest != null) { + + cn.add(new WeakReference(closest)); + } + } + + nearbyNodes.put(drainer, cn); + } + + private static ArrayList> getAllChildren(TileVisNode source, ArrayList> list) { + for (WeakReference child : source.getChildren()) { + TileVisNode n = child.get(); + if (n != null) { + list.add(child); + list = getAllChildren(n,list); + } + } + return list; + } + + // public static boolean canNodeBeSeen(TileVisNode source,TileVisNode + // target) + // { + // double d = Math.sqrt(source.getDistanceFrom(target.xCoord, target.yCoord, + // target.zCoord)); + // double xd = (source.xCoord-target.xCoord) / d; + // double yd = (source.yCoord-target.yCoord) / d; + // double zd = (source.zCoord-target.zCoord) / d; + // return source.getWorldObj().rayTraceBlocks( + // Vec3.createVectorHelper(source.xCoord-xd+.5+.5, source.yCoord-yd, + // source.zCoord-zd), + // Vec3.createVectorHelper(target.xCoord+.5, target.yCoord+.5, + // target.zCoord+.5)) == null; + // } + + // public static HashMap> + // noderef = new HashMap>(); + // + // public static TileVisNode getClosestNodeWithinRadius(World world, int x, + // int y, int z, int radius) { + // TileVisNode out = null; + // WorldCoordinates wc = null; + // float cd = Float.MAX_VALUE; + // for (int sx = x - radius; sx <= x + radius; sx++) { + // for (int sy = y - radius; sy <= y + radius; sy++) { + // for (int sz = z - radius; sz <= z + radius; sz++) { + // wc = new WorldCoordinates(sx,sy,sz,world.provider.dimensionId); + // if (noderef.containsKey(wc)) { + // float d = wc.getDistanceSquared(x, y, z); + // if (d ritualMap = new HashMap(); - @Deprecated - public static List ritualList = new LinkedList(); public static List keyList = new LinkedList(); - public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name) + public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) { - this.crystalLevel = crystalLevel; //For a test commit + this.crystalLevel = crystalLevel; this.actCost = actCost; this.effect = effect; this.name = name; keyList.add(name); ritualMap.put(name, this); + this.customRenderer = renderer; } + public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name) + { + this(crystalLevel, actCost, effect, name, null); + } + /** * Static method to register a ritual to the Ritual Registry * @param key Unique identification key - must be different from all others to properly register @@ -40,6 +46,22 @@ public class Rituals * @param name The name of the ritual * @return Returns true if properly registered, or false if the key is already used */ + public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) + { + if(ritualMap.containsKey(key)) + { + return false; + } + else + { + Rituals ritual = new Rituals(crystalLevel, actCost, effect, name, renderer); + ritual.removeRitualFromList(); + ritualMap.put(key, ritual); + keyList.add(key); + return true; + } + } + public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name) { if(ritualMap.containsKey(key)) @@ -270,6 +292,11 @@ public class Rituals { return this.crystalLevel; } + + private MRSRenderer getRenderer() + { + return this.customRenderer; + } public static void performEffect(IMasterRitualStone ritualStone, String ritualID) { @@ -330,4 +357,18 @@ public class Rituals return firstKey; } + + public static MRSRenderer getRendererForKey(String ritualID) + { + if(ritualMap.containsKey(ritualID)) + { + Rituals ritual = ritualMap.get(ritualID); + if(ritual != null) + { + return ritual.getRenderer(); + } + } + + return null; + } } diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java index c60e734d..c06e3e74 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/client/ClientProxy.java @@ -23,13 +23,16 @@ import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjecti import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile; import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor; import WayofTime.alchemicalWizardry.common.renderer.block.RenderConduit; +import WayofTime.alchemicalWizardry.common.renderer.block.RenderMasterStone; import WayofTime.alchemicalWizardry.common.renderer.block.RenderPedestal; import WayofTime.alchemicalWizardry.common.renderer.block.RenderPlinth; +import WayofTime.alchemicalWizardry.common.renderer.block.RenderReagentConduit; import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEffectBlock; import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEnhancementBlock; import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellModifierBlock; import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellParadigmBlock; import WayofTime.alchemicalWizardry.common.renderer.block.RenderWritingTable; +import WayofTime.alchemicalWizardry.common.renderer.block.ShaderHelper; import WayofTime.alchemicalWizardry.common.renderer.block.TEAltarRenderer; import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAltarItemRenderer; import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEConduitItemRenderer; @@ -61,8 +64,10 @@ import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor; import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; +import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock; @@ -122,7 +127,9 @@ public class ClientProxy extends CommonProxy ClientRegistry.bindTileEntitySpecialRenderer(TESpellEnhancementBlock.class, new RenderSpellEnhancementBlock()); ClientRegistry.bindTileEntitySpecialRenderer(TESpellParadigmBlock.class, new RenderSpellParadigmBlock()); ClientRegistry.bindTileEntitySpecialRenderer(TESpellModifierBlock.class, new RenderSpellModifierBlock()); - + ClientRegistry.bindTileEntitySpecialRenderer(TEReagentConduit.class, new RenderReagentConduit()); + ClientRegistry.bindTileEntitySpecialRenderer(TEMasterStone.class, new RenderMasterStone()); + //Item Renderer stuff MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockConduit), new TEConduitItemRenderer()); MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellEffect), new TESpellEffectBlockItemRenderer()); @@ -132,6 +139,8 @@ public class ClientProxy extends CommonProxy //RenderingRegistry.registerEntityRenderingHandler(FireProjectile.class, new RenderFireProjectile()); //RenderingRegistry.registerBlockHandler(new AltarRenderer()); + + ShaderHelper.initShaders(); } @Override diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java index 8e55d286..9cf82935 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/NewPacketHandler.java @@ -15,6 +15,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable; import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; @@ -58,12 +59,6 @@ public enum NewPacketHandler } } - - /** - * This is only called on the client side - it adds an - * {@link IronChestMessageHandler} to the client side pipeline, since the - * only place we expect to handle messages is on the client. - */ @SideOnly(Side.CLIENT) private void addClientHandler() { @@ -79,6 +74,7 @@ public enum NewPacketHandler clientChannel.pipeline().addAfter(tileAltarCodec, "TEWritingTableHandler", new TEWritingTableMessageHandler()); clientChannel.pipeline().addAfter(tileAltarCodec, "ParticleHandler", new ParticleMessageHandler()); clientChannel.pipeline().addAfter(tileAltarCodec, "VelocityHandler", new VelocityMessageHandler()); + clientChannel.pipeline().addAfter(tileAltarCodec, "TEMasterStoneHandler", new TEMasterStoneMessageHandler()); } @@ -229,6 +225,23 @@ public enum NewPacketHandler } } } + + private static class TEMasterStoneMessageHandler extends SimpleChannelInboundHandler + { + @Override + protected void channelRead0(ChannelHandlerContext ctx, TEMasterStoneMessage msg) throws Exception + { + World world = AlchemicalWizardry.proxy.getClientWorld(); + TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z); + if (te instanceof TEMasterStone) + { + TEMasterStone masterStone = (TEMasterStone) te; + + masterStone.setCurrentRitual(msg.ritual); + masterStone.isRunning = msg.isRunning; + } + } + } public static class BMMessage { @@ -320,6 +333,16 @@ public enum NewPacketHandler double yVel; double zVel; } + + public static class TEMasterStoneMessage extends BMMessage + { + int x; + int y; + int z; + + String ritual; + boolean isRunning; + } private class TEAltarCodec extends FMLIndexedMessageToMessageCodec { @@ -334,6 +357,7 @@ public enum NewPacketHandler addDiscriminator(6, TEWritingTableMessage.class); addDiscriminator(7, ParticleMessage.class); addDiscriminator(8, VelocityMessage.class); + addDiscriminator(9, TEMasterStoneMessage.class); } @Override @@ -497,6 +521,22 @@ public enum NewPacketHandler target.writeDouble(((VelocityMessage)msg).yVel); target.writeDouble(((VelocityMessage)msg).zVel); + break; + + case 9: + target.writeInt(((TEMasterStoneMessage)msg).x); + target.writeInt(((TEMasterStoneMessage)msg).y); + target.writeInt(((TEMasterStoneMessage)msg).z); + + String ritual = ((TEMasterStoneMessage)msg).ritual; + target.writeInt(ritual.length()); + for(int i=0; i potionList = new ArrayList(); + + public static void registerCombinedPotionRecipe(Potion result, Potion pot1, Potion pot2) + { + potionList.add(new CombinedPotionComponent(result, pot1, pot2)); + } + + public static boolean isRecipeValid(Potion pot1, Potion pot2) + { + for(CombinedPotionComponent recipe : potionList) + { + if(recipe.isRecipeValid(pot1, pot2)) + { + return true; + } + } + + return false; + } + + public static boolean isRecipeValid(int pot1, int pot2) + { + for(CombinedPotionComponent recipe : potionList) + { + if(recipe.isRecipeValid(pot1, pot2)) + { + return true; + } + } + + return false; + } + + public static Potion getPotion(Potion pot1, Potion pot2) + { + for(CombinedPotionComponent recipe : potionList) + { + if(recipe.isRecipeValid(pot1, pot2)) + { + return recipe.result; + } + } + + return null; + } + + public static Potion getPotion(int pot1, int pot2) + { + for(CombinedPotionComponent recipe : potionList) + { + if(recipe.isRecipeValid(pot1, pot2)) + { + return recipe.result; + } + } + + return null; + } + + public static ItemStack applyPotionEffect(ItemStack stack) + { + if(stack == null || !(stack.getItem() instanceof AlchemyFlask)) + { + return null; + } + + List list = AlchemyFlask.getEffects(stack); + if(list == null) + { + return stack; + } + + boolean isDone = false; + + for(AlchemyPotionHelper helper1 : list) + { + if(isDone) + { + continue; + } + + for(int i=0; i list = AlchemyFlask.getEffects(stack); + if(list == null) + { + return false; + } + + for(AlchemyPotionHelper helper1 : list) + { + for(AlchemyPotionHelper helper2 : list) + { + int pot1 = helper1.getPotionID(); + int pot2 = helper2.getPotionID(); + + if(isRecipeValid(pot1, pot2)) + { + return true; + } + } + } + + return false; + } + + public static PotionEffect getResultantPotion(AlchemyPotionHelper potE1, AlchemyPotionHelper potE2) + { + if(potE1 == null || potE2 == null) + { + return null; + } + + int pot1 = potE1.getPotionID(); + int pot2 = potE2.getPotionID(); + + if(isRecipeValid(pot1, pot2)) + { + int duration = (int)((potE1.getTickDuration()* Math.pow(8.0f / 3.0f, potE1.getdurationFactor()) + potE2.getdurationFactor() * Math.pow(8.0f / 3.0f, potE2.getdurationFactor()))/2.0); + int amplifier = (potE1.getConcentration() + potE2.getConcentration())/2; + + Potion pot = getPotion(pot1, pot2); + + return new PotionEffect(pot.id, duration, amplifier); + } + + return null; + } +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/alchemy/ICombinationalCatalyst.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/alchemy/ICombinationalCatalyst.java new file mode 100644 index 00000000..9acdc197 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/alchemy/ICombinationalCatalyst.java @@ -0,0 +1,6 @@ +package WayofTime.alchemicalWizardry.common.alchemy; + +public interface ICombinationalCatalyst +{ + +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java index 10da3ed7..fbc115c8 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java @@ -18,9 +18,6 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockOrientable extends BlockContainer { - @SideOnly(Side.CLIENT) - private static IIcon[] fireIcons; - public BlockOrientable() { super(Material.rock); @@ -31,67 +28,11 @@ public class BlockOrientable extends BlockContainer //func_111022_d("AlchemicalWizardry:blocks"); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { - this.fireIcons = this.registerIconsWithString(iconRegister, "fireEffectBlock"); - } - - @SideOnly(Side.CLIENT) - public static IIcon[] registerIconsWithString(IIconRegister iconRegister, String blockString) - { - IIcon[] icons = new IIcon[7]; - - icons[0] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_input"); - icons[1] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_output"); - icons[2] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_upArrow"); - icons[3] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_downArrow"); - icons[4] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_leftArrow"); - icons[5] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_rightArrow"); - icons[6] = iconRegister.registerIcon("AlchemicalWizardry:" + blockString + "_blank"); - - return icons; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { - IIcon[] icons = this.getIconsForMeta(meta); - switch (side) - { - case 4: return icons[1]; - default: return icons[6]; - } - } - // @Override // public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) // { // return false; // } - - @SideOnly(Side.CLIENT) - - /** - * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side - */ - public IIcon getBlockTexture(IBlockAccess par1IBlockAccess, int x, int y, int z, int side) - { - TileEntity tile = par1IBlockAccess.getTileEntity(x, y, z); - int meta = par1IBlockAccess.getBlockMetadata(x, y, z); - - if(tile instanceof TEOrientable) - { - ForgeDirection input = ((TEOrientable)tile).getInputDirection(); - ForgeDirection output = ((TEOrientable)tile).getOutputDirection(); - - return this.getIconsForMeta(meta)[this.getTextureIndexForSideAndOrientation(side, input, output)]; - } - - return this.getIcon(side, meta); - } @Override public TileEntity createNewTileEntity(World world, int dunno) @@ -99,11 +40,6 @@ public class BlockOrientable extends BlockContainer return new TEOrientable(); } - public IIcon[] getIconsForMeta(int metadata) - { - return this.fireIcons; - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) { diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java new file mode 100644 index 00000000..58aa94b2 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockReagentConduit.java @@ -0,0 +1,75 @@ +package WayofTime.alchemicalWizardry.common.block; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockReagentConduit extends BlockContainer +{ + public BlockReagentConduit() + { + super(Material.rock); + this.setBlockName("blockReagentConduit"); + this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) + { + super.registerBlockIcons(iconRegister); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) + { + return new TEReagentConduit(); + } + +// @Override +// @SideOnly(Side.CLIENT) +// public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) +// { +// if (this.equals(ModBlocks.blockSpellParadigm)) +// { +// par3List.add(new ItemStack(par1, 1, 0)); +// par3List.add(new ItemStack(par1, 1, 1)); +// par3List.add(new ItemStack(par1, 1, 2)); +// par3List.add(new ItemStack(par1, 1, 3)); +// } else +// { +// super.getSubBlocks(par1, par2CreativeTabs, par3List); +// } +// } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) + { + return super.onBlockActivated(world, x, y, z, player, side, what, these, are); + } + + @Override + public boolean isOpaqueCube() + { + return false; + } + + @Override + public boolean renderAsNormalBlock() + { + return false; + } + + @Override + public int getRenderType() + { + return -1; + } +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java index faadb7e8..f1945778 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java @@ -21,29 +21,13 @@ public class BlockSpellParadigm extends BlockOrientable { public static final float minPos = (3f/16f); public static final float maxPos = (13f/16f); - - IIcon[] projectileIcons = new IIcon[7]; public BlockSpellParadigm() { super(); this.setBlockName("blockSpellParadigm"); - //setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, maxPos); } - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) - { - this.projectileIcons = this.registerIconsWithString(iconRegister, "projectileParadigmBlock"); - } - -// @Override -// public Icon[] getIconsForMeta(int metadata) -// { -// return this.projectileIcons; -// } - @Override public TileEntity createNewTileEntity(World world, int meta) { @@ -109,104 +93,4 @@ public class BlockSpellParadigm extends BlockOrientable { return -1; } - - //TODO Need to make a renderer for the paradigm blocks and other spell blocks. - /* - @Override - public void addCollisionBoxesToList(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) - { - - setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, maxPos); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - - - TileEntity tile1 = world.getBlockTileEntity(i, j, k); - if (tile1 instanceof TESpellParadigmBlock) - { - TESpellParadigmBlock tileG = (TESpellParadigmBlock) tile1; - - - if (tileG.isSideRendered(ForgeDirection.WEST)) - { - setBlockBounds(0.0F, minPos, minPos, maxPos, maxPos, maxPos); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - } - - - if (tileG.isSideRendered(ForgeDirection.EAST)) - { - setBlockBounds(minPos, minPos, minPos, 1.0F, maxPos, maxPos); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - } - - - if (tileG.isSideRendered(ForgeDirection.DOWN)) - { - setBlockBounds(minPos, 0.0F, minPos, maxPos, maxPos, maxPos); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - } - - - if (tileG.isSideRendered(ForgeDirection.UP)) - { - setBlockBounds(minPos, minPos, minPos, maxPos, 1.0F, maxPos); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - } - - - if (tileG.isSideRendered(ForgeDirection.NORTH)) - { - setBlockBounds(minPos, minPos, 0.0F, maxPos, maxPos, maxPos); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - } - - - if (tileG.isSideRendered(ForgeDirection.SOUTH)) - { - setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, 1.0F); - super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); - } - - -// float facadeThickness = TransportConstants.FACADE_THICKNESS; -// -// -// if (tileG.hasFacade(ForgeDirection.EAST)) { -// setBlockBounds(1 - facadeThickness, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); -// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); -// } -// -// -// if (tileG.hasFacade(ForgeDirection.WEST)) { -// setBlockBounds(0.0F, 0.0F, 0.0F, facadeThickness, 1.0F, 1.0F); -// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); -// } -// -// -// if (tileG.hasFacade(ForgeDirection.UP)) { -// setBlockBounds(0.0F, 1 - facadeThickness, 0.0F, 1.0F, 1.0F, 1.0F); -// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); -// } -// -// -// if (tileG.hasFacade(ForgeDirection.DOWN)) { -// setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, facadeThickness, 1.0F); -// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); -// } -// -// -// if (tileG.hasFacade(ForgeDirection.SOUTH)) { -// setBlockBounds(0.0F, 0.0F, 1 - facadeThickness, 1.0F, 1.0F, 1.0F); -// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); -// } -// -// -// if (tileG.hasFacade(ForgeDirection.NORTH)) { -// setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, facadeThickness); -// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); -// } - } - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - */ } diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java index c3467192..8100c7b2 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java @@ -66,9 +66,9 @@ public class ImperfectRitualStone extends Block if (world.isRemote) { world.setRainStrength(1.0F); + world.setThunderStrength(1.0f); } - world.setThunderStrength(1.0f); world.getWorldInfo().setThunderTime(0); world.getWorldInfo().setThundering(true); return true; diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java index 97872e73..fd56ebce 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityDemon.java @@ -49,13 +49,13 @@ public class EntityDemon extends EntityTameable implements IDemon protected void dropFewItems(boolean par1, int par2) { - if(!(this.getOwner() instanceof EntityPlayer)) - { - return; - } ItemStack drop = new ItemStack(ModItems.demonPlacer, 1, this.getDemonID()); - DemonPlacer.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer)this.getOwner())); + if((this.getOwner() instanceof EntityPlayer)) + { + DemonPlacer.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer)this.getOwner())); + } + if (this.hasCustomNameTag()) { drop.setStackDisplayName(this.getCustomNameTag()); diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/BoundArmour.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/BoundArmour.java index 23f3d126..30cbda83 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/BoundArmour.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/BoundArmour.java @@ -18,6 +18,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.util.Constants; import thaumcraft.api.IGoggles; +import thaumcraft.api.IRunicArmor; import thaumcraft.api.nodes.IRevealer; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.ModItems; @@ -28,8 +29,8 @@ import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -@Optional.InterfaceList(value = {@Interface(iface="thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), @Interface(iface="thaumcraft.api.IGoggles", modid = "Thaumcraft")}) -public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,IRevealer, IGoggles +@Optional.InterfaceList(value = {@Interface(iface="thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), @Interface(iface="thaumcraft.api.IGoggles", modid = "Thaumcraft"), @Interface(iface="thaumcraft.api.IRunicArmor", modid = "Thaumcraft")}) +public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,IRevealer, IGoggles, IRunicArmor { private static int invSize = 9; private static IIcon helmetIcon; @@ -56,7 +57,6 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I } @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) { if (this.equals(ModItems.boundHelmet)) @@ -91,6 +91,26 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + double armourReduction = 0.0; + + if(player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) + { + int i = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray).getAmplifier() + 1; + + armourReduction = (i+1)*0.1; + } + + double damageAmount = 0.25; + + if(!player.isPotionActive(AlchemicalWizardry.customPotionSoulHarden)) + { + damageAmount *= 0.9; + } + + damageAmount *= (1.0-armourReduction); + + int maxAbsorption = 100000; + if (source.equals(DamageSource.drown)) { return new ArmorProperties(-1, 0, 0); @@ -100,7 +120,7 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I { if (isImmuneToVoid(armor)) { - return new ArmorProperties(-1, 3, 100000); + return new ArmorProperties(-1, damageAmount, maxAbsorption); } else { return new ArmorProperties(-1, 0, 0); @@ -121,17 +141,10 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I { if (source.isUnblockable()) { - return new ArmorProperties(-1, 3, 4); - } - - if(player.isPotionActive(AlchemicalWizardry.customPotionSoulFray)) - { - int i = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulFray).getAmplifier() + 1; - - return new ArmorProperties(-1, 3, (int)(25*(1.0f - 0.15f*i))); + return new ArmorProperties(-1, damageAmount * 0.8d, maxAbsorption); } - return new ArmorProperties(-1, 3, 100000); + return new ArmorProperties(-1, damageAmount, maxAbsorption); } return new ArmorProperties(-1, 0, 0); @@ -410,6 +423,7 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I { itemStack.setTagCompound(new NBTTagCompound()); } + itemTag = itemStack.stackTagCompound; ItemStack[] inv = new ItemStack[9]; NBTTagList tagList = itemTag.getTagList("Inventory", Constants.NBT.TAG_COMPOUND); @@ -624,4 +638,60 @@ public class BoundArmour extends ItemArmor implements ISpecialArmor,IBindable ,I { return this.hasIGoggles(itemstack); } + + @Override + @Optional.Method(modid = "Thaumcraft") + public int getRunicCharge(ItemStack itemstack) + { + ItemStack[] inv = this.getInternalInventory(itemstack); + int shardLevel = this.getMaxBloodShardLevel(itemstack); + int count = 0; + int harden = 0; + + if(inv == null) + { + return 0; + } + + for(ItemStack stack : inv) + { + if(count >= shardLevel) + { + break; + } + + if(stack == null || !(stack.getItem() instanceof ArmourUpgrade)) + { + continue; + } + + if(stack.getItem() instanceof ItemArmor && ((ItemArmor)stack.getItem()).armorType != this.armorType) + { + continue; + } + + if(stack.hasTagCompound()) + { + NBTTagCompound tag = stack.getTagCompound(); + + int enchLvl = tag.getByte("RS.HARDEN"); + + if(stack.getItem() instanceof IRunicArmor) + { + enchLvl += ((IRunicArmor)stack.getItem()).getRunicCharge(stack); + } + + if(enchLvl > 0) + { + harden += enchLvl; + if(((ArmourUpgrade)stack.getItem()).isUpgrade()) + { + count += 1; + } + } + } + } + + return harden; + } } diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java index 00d9c533..0e74a674 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java @@ -144,6 +144,11 @@ public class ItemRitualDiviner extends EnergyItems { TEMasterStone masterStone = (TEMasterStone) tileEntity; List ritualList = Rituals.getRitualList(this.getCurrentRitual(par1ItemStack)); + if(ritualList == null) + { + return false; + } + int playerInvRitualStoneLocation = -1; for (int i = 0; i < playerInventory.length; i++) diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java index 30b08daf..5452e519 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/SacrificialDagger.java @@ -12,6 +12,7 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -77,7 +78,8 @@ public class SacrificialDagger extends Item par2World.spawnParticle("reddust", posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3); } - if (!par2World.isRemote && !(par3EntityPlayer.getClass().equals(EntityPlayerMP.class))) + if(!par2World.isRemote && SpellHelper.isFakePlayer(par2World, par3EntityPlayer)) + //if (!(par3EntityPlayer.getClass().equals(EntityPlayerMP.class))) { return par1ItemStack; } diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java index 11588be5..05f3d698 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/potion/AlchemyFlask.java @@ -92,7 +92,7 @@ public class AlchemyFlask extends Item } } - public void setEffects(ItemStack par1ItemStack, ArrayList list) + public static void setEffects(ItemStack par1ItemStack, List list) { NBTTagCompound itemTag = par1ItemStack.stackTagCompound; diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/potion/CombinationalCatalyst.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/potion/CombinationalCatalyst.java new file mode 100644 index 00000000..8097cde0 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/potion/CombinationalCatalyst.java @@ -0,0 +1,24 @@ +package WayofTime.alchemicalWizardry.common.items.potion; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst; + +public class CombinationalCatalyst extends Item implements ICombinationalCatalyst +{ + public CombinationalCatalyst() + { + super(); + this.setCreativeTab(AlchemicalWizardry.tabBloodMagic); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) + { + this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:CombinationalCatalyst"); + } +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java index 92963f18..54c64001 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/sigil/SigilOfGrowth.java @@ -3,27 +3,20 @@ package WayofTime.alchemicalWizardry.common.items.sigil; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.block.BlockCocoa; -import net.minecraft.block.BlockCrops; -import net.minecraft.block.BlockDirectional; -import net.minecraft.block.BlockMushroom; -import net.minecraft.block.BlockSapling; -import net.minecraft.block.BlockStem; import net.minecraft.block.IGrowable; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.BonemealEvent; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.relauncher.Side; diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusBase.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusBase.java deleted file mode 100644 index 469c0ff6..00000000 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusBase.java +++ /dev/null @@ -1,169 +0,0 @@ -package WayofTime.alchemicalWizardry.common.items.thaumcraft; - -import java.util.List; - -import javax.swing.Icon; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public abstract class FocusBase extends EnergyItems //implements IWandFocus -{ - protected IIcon ornament, depth; - - public FocusBase() - { - super(); - setMaxDamage(1); - setNoRepair(); - setMaxStackSize(1); - } - - boolean hasOrnament() - { - return false; - } - - boolean hasDepth() - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - super.registerIcons(iconRegister); -// if(hasOrnament()) -// { -// ornament = iconRegister.registerIcon("AlchemicalWizardry:" + this.getUnlocalizedName() + "Orn"); -// } -// if(hasDepth()) -// { -// depth = iconRegister.registerIcon("AlchemicalWizardry:" + this.getUnlocalizedName() + "Depth"); -// } - } - - @Override - public boolean isItemTool(ItemStack par1ItemStack) - { - return true; - } - -/*erride - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); - AspectList cost = getVisCost(); - - if (cost != null && cost.size() > 0) - { - par3List.add(StatCollector.translateToLocal(isVisCostPerTick() ? "item.Focus.cost2" : "item.Focus.cost1")); - - for (Aspect aspect : cost.getAspectsSorted()) - { - float amount = cost.getAmount(aspect) / 100.0F; - par3List.add(" " + '\u00a7' + aspect.getChatcolor() + aspect.getName() + '\u00a7' + "r x " + amount); - } - } - } - - @Override - public int getItemEnchantability() - { - return 5; - } - - @Override - public EnumRarity getRarity(ItemStack itemstack) - { - return EnumRarity.rare; - } - - @Override - public Icon getOrnament() - { - return ornament; - } - - @Override - public Icon getFocusDepthLayerIcon() - { - return depth; - } - - @Override - public WandFocusAnimation getAnimation() - { - return WandFocusAnimation.WAVE; - } - - @Override - public boolean isVisCostPerTick() - { - return false; - } - - public boolean isUseItem() - { - return isVisCostPerTick(); - } - - @Override - public ItemStack onFocusRightClick(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, MovingObjectPosition paramMovingObjectPosition) - { - if (isUseItem()) - { - paramEntityPlayer.setItemInUse(paramItemStack, Integer.MAX_VALUE); - } - - return paramItemStack; - } - - @Override - public void onUsingFocusTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) - { - // NO-OP - } - - @Override - public void onPlayerStoppedUsingFocus(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt) - { - // NO-OP - } - - @Override - public String getSortingHelper(ItemStack paramItemStack) - { - return "00"; - } - - @Override - public boolean onFocusBlockStartBreak(ItemStack paramItemStack, int paramInt1, int paramInt2, int paramInt3, EntityPlayer paramEntityPlayer) - { - return false; - } - - @Override - public boolean acceptsEnchant(int id) - { - if (id == ThaumcraftApi.enchantFrugal || - id == ThaumcraftApi.enchantPotency) - { - return true; - } - - return false; - } - - */ -} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusBloodBlast.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusBloodBlast.java deleted file mode 100644 index 8d377041..00000000 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusBloodBlast.java +++ /dev/null @@ -1,191 +0,0 @@ -package WayofTime.alchemicalWizardry.common.items.thaumcraft; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class FocusBloodBlast extends FocusBase -{ - //private static final AspectList visUsage = new AspectList().add(Aspect.AIR, 15).add(Aspect.ENTROPY, 45); - - private final int maxCooldown = 7; - - public static Map playerCooldown = new HashMap(); - - public FocusBloodBlast() - { - super(); - this.setUnlocalizedName("focusBloodBlast"); - this.setEnergyUsed(100); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - super.registerIcons(iconRegister); - - if (hasOrnament()) - { - ornament = iconRegister.registerIcon("AlchemicalWizardry:" + "focusBloodBlast" + "Orn"); - } - - if (hasDepth()) - { - depth = iconRegister.registerIcon("AlchemicalWizardry:" + "focusBloodBlast" + "Depth"); - } - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - //super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { - par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); - } - } - } - - /* - @Override - public void onUsingFocusTick(ItemStack stack, EntityPlayer par3EntityPlayer, int ticks) - { - if (AlchemicalWizardry.isThaumcraftLoaded) - { - Item item = stack.getItem(); - Class clazz = item.getClass(); - - while (!clazz.getName().equals("thaumcraft.common.items.wands.ItemWandCasting")) - { - if (clazz == Object.class) - { - return; - } - - clazz = clazz.getSuperclass(); - } - - //Item testItem = item.set - - //Method consumeAllVis = null; - try - { - if (!playerCooldown.containsKey(par3EntityPlayer.username)) - { - playerCooldown.put(par3EntityPlayer.username, 0); - } - - Method getFocusItem = clazz.getMethod("getFocusItem", ItemStack.class); - ItemStack focusStack = (ItemStack) getFocusItem.invoke(item, stack); - //int potency = EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantPotency, focusStack); - int cooldown = playerCooldown.get(par3EntityPlayer.username) + 1; - playerCooldown.put(par3EntityPlayer.username, cooldown); - - if (cooldown >= this.maxCooldown) - { - Method consumeAllVis = clazz.getMethod("consumeAllVis", ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class); - - if ((Boolean) consumeAllVis.invoke(item, stack, par3EntityPlayer, getVisCost(), true)) - { - playerCooldown.put(par3EntityPlayer.username, 0); - EnergyItems.checkAndSetItemOwner(focusStack, par3EntityPlayer); - World world = par3EntityPlayer.worldObj; - - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - this.syphonBatteries(focusStack, par3EntityPlayer, 100); - } - - //world.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - world.playSoundAtEntity(par3EntityPlayer, "thaumcraft:wand", 0.5F, 1F); - - if (!world.isRemote) - { - //par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage)); - world.spawnEntityInWorld(new EnergyBlastProjectile(world, par3EntityPlayer, (int) (5))); - //this.setDelay(par1ItemStack, maxDelay); - } - } - } - } catch (NoSuchMethodException e1) - { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SecurityException e1) - { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IllegalAccessException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - @Override - public void onPlayerStoppedUsingFocus(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer, int paramInt) - { - playerCooldown.put(paramEntityPlayer.username, 0); - } - - @Override - public String getSortingHelper(ItemStack itemstack) - { - return "BLOODBLAST"; - } - - @Override - public int getFocusColor() - { - return 0x8A0707; - } - - @Override - public AspectList getVisCost() - { - return visUsage; - } - - @Override - public boolean isVisCostPerTick() - { - return true; - } - - @Override - public WandFocusAnimation getAnimation() - { - return WandFocusAnimation.WAVE; - } - - boolean hasOrnament() - { - return true; - } - */ -} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusGravityWell.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusGravityWell.java deleted file mode 100644 index 8a0e3678..00000000 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/FocusGravityWell.java +++ /dev/null @@ -1,263 +0,0 @@ -package WayofTime.alchemicalWizardry.common.items.thaumcraft; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class FocusGravityWell extends FocusBase -{ - //private static final AspectList visUsage = new AspectList().add(Aspect.AIR, 5).add(Aspect.ORDER, 5); - - private final int maxCooldown = 1; - - public static Map playerCooldown = new HashMap(); - - public FocusGravityWell() - { - super(); - this.setUnlocalizedName("focusGravityWell"); - this.setEnergyUsed(100); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { - super.registerIcons(iconRegister); - - if (hasOrnament()) - { - ornament = iconRegister.registerIcon("AlchemicalWizardry:" + "focusGravityWell" + "Orn"); - } - - if (hasDepth()) - { - depth = iconRegister.registerIcon("AlchemicalWizardry:" + "focusGravityWell" + "Depth"); - } - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - //super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { - par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); - } - } - } - - /* - @Override - public void onUsingFocusTick(ItemStack stack, EntityPlayer par3EntityPlayer, int ticks) - { - if (AlchemicalWizardry.isThaumcraftLoaded) - { - Item item = stack.getItem(); - Class clazz = item.getClass(); - - while (!clazz.getName().equals("thaumcraft.common.items.wands.ItemWandCasting")) - { - if (clazz == Object.class) - { - return; - } - - clazz = clazz.getSuperclass(); - } - - //Item testItem = item.set - - //Method consumeAllVis = null; - try - { - if (!playerCooldown.containsKey(par3EntityPlayer.username)) - { - playerCooldown.put(par3EntityPlayer.username, 0); - } - - Method getFocusItem = clazz.getMethod("getFocusItem", ItemStack.class); - ItemStack focusStack = (ItemStack) getFocusItem.invoke(item, stack); - //int potency = EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantPotency, focusStack); - int cooldown = playerCooldown.get(par3EntityPlayer.username) + 1; - playerCooldown.put(par3EntityPlayer.username, cooldown); - //if(cooldown>=this.maxCooldown) - { - Method consumeAllVis = clazz.getMethod("consumeAllVis", ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class); - - if ((Boolean) consumeAllVis.invoke(item, stack, par3EntityPlayer, getVisCost(), true)) - { - playerCooldown.put(par3EntityPlayer.username, 0); - EnergyItems.checkAndSetItemOwner(focusStack, par3EntityPlayer); - Vec3 vector = par3EntityPlayer.getLookVec(); - float distance = 2; - //if(par3EntityPlayer.worldObj.isRemote) - { - List entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX + vector.xCoord * distance - 0.5f, par3EntityPlayer.posY + vector.yCoord * distance - 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance - 0.5f, par3EntityPlayer.posX + vector.xCoord * distance + 0.5f, par3EntityPlayer.posY + vector.yCoord * distance + 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance + 0.5f).expand(1, 1, 1)); - - for (Entity entity : entities) - { - if (entity.getEntityName() == par3EntityPlayer.username) - { - continue; - } - - entity.motionX = par3EntityPlayer.posX + vector.xCoord * distance - entity.posX; - entity.motionY = par3EntityPlayer.posY + vector.yCoord * distance - entity.posY; - entity.motionZ = par3EntityPlayer.posZ + vector.zCoord * distance - entity.posZ; - //entity.setVelocity(par3EntityPlayer.posX+vector.xCoord*distance-entity.posX, par3EntityPlayer.posY+vector.yCoord*distance-entity.posY, par3EntityPlayer.posZ+vector.zCoord*distance-entity.posZ); - } - } - World world = par3EntityPlayer.worldObj; - - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - this.syphonBatteriesWithoutParticles(focusStack, par3EntityPlayer, 10, false); - } - } - } - } catch (NoSuchMethodException e1) - { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SecurityException e1) - { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IllegalAccessException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - @Override - public void onPlayerStoppedUsingFocus(ItemStack stack, World paramWorld, EntityPlayer par3EntityPlayer, int paramInt) - { - playerCooldown.put(par3EntityPlayer.username, 0); - - if (AlchemicalWizardry.isThaumcraftLoaded) - { - Item item = stack.getItem(); - Class clazz = item.getClass(); - - while (!clazz.getName().equals("thaumcraft.common.items.wands.ItemWandCasting")) - { - if (clazz == Object.class) - { - return; - } - - clazz = clazz.getSuperclass(); - } - - //Item testItem = item.set - - //Method consumeAllVis = null; - try - { - Method getFocusItem = clazz.getMethod("getFocusItem", ItemStack.class); - ItemStack focusStack = (ItemStack) getFocusItem.invoke(item, stack); - int potency = EnchantmentHelper.getEnchantmentLevel(ThaumcraftApi.enchantPotency, focusStack); - - if (potency > 0) - { - EnergyItems.checkAndSetItemOwner(focusStack, par3EntityPlayer); - Vec3 vector = par3EntityPlayer.getLookVec(); - float distance = 2; - //if(par3EntityPlayer.worldObj.isRemote) - { - List entities = par3EntityPlayer.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX + vector.xCoord * distance - 0.5f, par3EntityPlayer.posY + vector.yCoord * distance - 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance - 0.5f, par3EntityPlayer.posX + vector.xCoord * distance + 0.5f, par3EntityPlayer.posY + vector.yCoord * distance + 0.5f, par3EntityPlayer.posZ + vector.zCoord * distance + 0.5f).expand(1, 1, 1)); - - for (Entity entity : entities) - { - if (entity.getEntityName() == par3EntityPlayer.username) - { - continue; - } - - float speed = 1.0F * potency; - entity.motionX = vector.xCoord * speed; - entity.motionY = vector.yCoord * speed; - entity.motionZ = vector.zCoord * speed; - //entity.setVelocity(par3EntityPlayer.posX+vector.xCoord*distance-entity.posX, par3EntityPlayer.posY+vector.yCoord*distance-entity.posY, par3EntityPlayer.posZ+vector.zCoord*distance-entity.posZ); - } - } - } - } catch (NoSuchMethodException e1) - { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SecurityException e1) - { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IllegalAccessException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - @Override - public String getSortingHelper(ItemStack itemstack) - { - return "BLOODBLAST"; - } - - @Override - public int getFocusColor() - { - return 0x8A0707; - } - - @Override - public AspectList getVisCost() - { - return visUsage; - } - - @Override - public boolean isVisCostPerTick() - { - return true; - } - - @Override - public WandFocusAnimation getAnimation() - { - return WandFocusAnimation.WAVE; - } - - boolean hasOrnament() - { - return false; - } - */ -} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java index 7cdef813..e418babc 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/items/thaumcraft/ItemSanguineArmour.java @@ -8,10 +8,15 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor; import thaumcraft.api.IGoggles; +import thaumcraft.api.IRepairable; +import thaumcraft.api.IRunicArmor; import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.nodes.IRevealer; import WayofTime.alchemicalWizardry.AlchemicalWizardry; @@ -20,13 +25,17 @@ import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGoggles, IVisDiscountGear, IRevealer +public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGoggles, IVisDiscountGear, IRevealer, IRunicArmor, IRepairable { - private static IIcon helmetIcon; + private static IIcon helmetIcon; + private static IIcon plateIcon; + private static IIcon leggingsIcon; + private static IIcon bootsIcon; - public ItemSanguineArmour() + public ItemSanguineArmour(int armorType) { - super(AlchemicalWizardry.sanguineArmourArmourMaterial, 4, 0); + super(AlchemicalWizardry.sanguineArmourArmourMaterial, 0, armorType); + setMaxDamage(1000); setCreativeTab(AlchemicalWizardry.tabBloodMagic); } @@ -34,36 +43,97 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { - //this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); - this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SanguineHelmet"); + this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:SheathedItem"); + this.helmetIcon = iconRegister.registerIcon("AlchemicalWizardry:SanguineHelmet"); + this.plateIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundPlate"); + this.leggingsIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundLeggings"); + this.bootsIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundBoots"); + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) + { + if (this.equals(ModItems.sanguineHelmet)) + { + return this.helmetIcon; + } + + if (this.equals(ModItems.sanguineRobe)) + { + return this.plateIcon; + } + + if (this.equals(ModItems.sanguinePants)) + { + return this.leggingsIcon; + } + + if (this.equals(ModItems.sanguineBoots)) + { + return this.bootsIcon; + } + + return this.itemIcon; } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - //if(AlchemicalWizardry.isThaumcraftLoaded) + if (this == ModItems.sanguineHelmet) { - if (this == ModItems.sanguineHelmet) - { - return "alchemicalwizardry:models/armor/sanguineArmour_layer_1.png"; - } + return "alchemicalwizardry:models/armor/sanguineArmour_layer_1.png"; + } + + if (this == ModItems.sanguineRobe || this == ModItems.sanguineBoots) + { + return "alchemicalwizardry:models/armor/boundArmour_layer_1.png"; + } + + if (this == ModItems.sanguinePants) + { + return "alchemicalwizardry:models/armor/boundArmour_layer_2.png"; + } else + { + return null; } - return null; } @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("A pair of goggles imbued with power"); - par3List.add("Vis discount: " + 8 + "%"); - } + int discount = 0; + + switch(this.armorType) + { + case 0: + discount = 8; + break; + case 1: + discount = 4; + break; + case 2: + discount = 3; + break; + case 3: + discount = 3; + break; + } + + switch(this.armorType) + { + case 0: + par3List.add("A pair of goggles imbued with power"); + break; + case 1: - -// @Override -// public boolean showNodes(ItemStack itemstack, EntityLivingBase player) -// { -// return true; -// } + case 2: + + case 3: + par3List.add("Robes imbued with forbidden power"); + } + + par3List.add("Vis discount: " + discount + "%"); + } @Override public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) @@ -74,7 +144,7 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog @Override public boolean isUpgrade() { - return false; + return true; } @Override @@ -92,7 +162,14 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog @Override public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) { - return 8; + switch(this.armorType) + { + case 0: return 8; + case 1: return 4; + case 2: return 3; + case 3: return 3; + } + return 0; } @Override @@ -100,4 +177,10 @@ public class ItemSanguineArmour extends ItemArmor implements ArmourUpgrade, IGog { return true; } -} + + @Override + public int getRunicCharge(ItemStack itemstack) { + // TODO Auto-generated method stub + return 0; + } +} \ No newline at end of file diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulHarden.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulHarden.java new file mode 100644 index 00000000..0ac24694 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/potion/PotionSoulHarden.java @@ -0,0 +1,18 @@ +package WayofTime.alchemicalWizardry.common.potion; + +import net.minecraft.potion.Potion; + +public class PotionSoulHarden extends Potion +{ + public PotionSoulHarden(int par1, boolean par2, int par3) + { + super(par1, par2, par3); + } + + @Override + public Potion setIconIndex(int par1, int par2) + { + super.setIconIndex(par1, par2); + return this; + } +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/AlchemyCircleRenderer.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/AlchemyCircleRenderer.java new file mode 100644 index 00000000..ffe8039f --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/AlchemyCircleRenderer.java @@ -0,0 +1,85 @@ +package WayofTime.alchemicalWizardry.common.renderer; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; + +public class AlchemyCircleRenderer extends MRSRenderer +{ + private ResourceLocation resourceLocation = new ResourceLocation("alchemicalwizardry:textures/models/TransCircle.png"); + private int colourRed; + private int colourGreen; + private int colourBlue; + private int colourIntensity; + private double xOffset; + private double yOffset; + private double zOffset; + private double radius; + private double initialY; + + public AlchemyCircleRenderer(ResourceLocation resource, int red, int green, int blue, int intensity, double xOff, double initialY, double yOff, double zOff, double radius) + { + this.resourceLocation = resource; + this.colourRed = red; + this.colourGreen = green; + this.colourBlue = blue; + this.colourIntensity = intensity; + this.xOffset = xOff; + this.initialY = initialY; + this.yOffset = yOff; + this.zOffset = zOff; + this.radius = radius; + } + + @Override + public void renderAt(TEMasterStone tile, double x, double y, double z) + { + GL11.glPushMatrix(); + float f1 = 1.0f; + Tessellator tessellator = Tessellator.instance; + this.bindTexture(resourceLocation); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_CULL_FACE); + float f2 = 0; + float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + GL11.glDepthMask(false); + + tessellator.startDrawingQuads(); + tessellator.setColorRGBA(colourRed, colourGreen, colourBlue, colourIntensity); + + GL11.glTranslated(x+0.5+xOffset, y+0.5+(yOffset-initialY)*(tile.runningTime/100d)+initialY, z+0.5+zOffset); + + float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); + + GL11.glRotatef(rotationAngle, 0F, 1F, 0F); //Rotate on planar axis + //GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis + //GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically + + tessellator.setBrightness(240); + + double finalRadius = (radius)*(tile.runningTime/100d); + + tessellator.addVertexWithUV(-finalRadius, 0, -finalRadius, 0.0d, 0.0d); + tessellator.addVertexWithUV(finalRadius, 0, -finalRadius, 1.0d, 0.0d); + tessellator.addVertexWithUV(finalRadius, 0, finalRadius, 1.0d, 1.0d); + tessellator.addVertexWithUV(-finalRadius, 0, finalRadius, 0.0d, 1.0d); + + tessellator.draw(); + + GL11.glDepthMask(true); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glPopMatrix(); + } +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/BeamRenderer.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/BeamRenderer.java new file mode 100644 index 00000000..e8c78f78 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/BeamRenderer.java @@ -0,0 +1,115 @@ +package WayofTime.alchemicalWizardry.common.renderer; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; + +public class BeamRenderer +{ + private static final ResourceLocation field_110629_a = new ResourceLocation("textures/entity/beacon_beam.png"); + protected static TileEntityRendererDispatcher field_147501_a; + + protected static void bindTexture(ResourceLocation p_147499_1_) + { + TextureManager texturemanager = BeamRenderer.field_147501_a.field_147553_e; + + if (texturemanager != null) + { + texturemanager.bindTexture(p_147499_1_); + } + } + + public static void render() + { + double d0 = 0; + double d1 = 0; + double d2 = 0; + + + float distance = 5; //Total distance + + GL11.glPushMatrix(); + float f1 = 1.0f; + Tessellator tessellator = Tessellator.instance; + BeamRenderer.bindTexture(field_110629_a); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_CULL_FACE); + float f2 = 0; + float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + + GL11.glDepthMask(false); + + tessellator.startDrawingQuads(); + tessellator.setColorRGBA(255, 0, 0, 50); + //tessellator.setColorOpaque(255, 255, 255); + + double inside = 0.45d-0.5d; + double outside = 1.0d-0.45d-0.5d; + + double d18 = inside; + double d19 = inside; + double d20 = outside; + double d21 = inside; + double d22 = inside; + double d23 = outside; + double d24 = outside; + double d25 = outside; + double d26 = (double)(distance * f1);// + 0.2; + double d27 = 0.0D; + double d28 = 1.0D; + double d29 = (double)(-1.0F + f3); + double d30 = (double)(distance * f1) + d29; + + GL11.glTranslated(d0+0.5, d1+0.5, d2+0.5); + + GL11.glRotatef(45F, 0F, 1F, 0F); //Rotate on planar axis + GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis + //GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically + + double offset = 0; + + tessellator.setBrightness(240); + float s = 1F / 16F; +// GL11.glTranslatef(0F, s, s); +// GL11.glScalef(1F, s * 14F, s * 14F); + tessellator.addVertexWithUV(d26, d18, d19, d28, d30); + tessellator.addVertexWithUV(offset, d18, d19, d28, d29); + tessellator.addVertexWithUV(offset, d20, d21, d27, d29); + tessellator.addVertexWithUV(d26, d20, d21, d27, d30); + tessellator.addVertexWithUV(d26, d24, d25, d28, d30); + tessellator.addVertexWithUV(offset, d24, d25, d28, d29); + tessellator.addVertexWithUV(offset, d22, d23, d27, d29); + tessellator.addVertexWithUV(d26, d22, d23, d27, d30); + tessellator.addVertexWithUV(d26, d20, d21, d28, d30); + tessellator.addVertexWithUV(offset, d20, d21, d28, d29); + tessellator.addVertexWithUV(offset, d24, d25, d27, d29); + tessellator.addVertexWithUV(d26, d24, d25, d27, d30); + tessellator.addVertexWithUV(d26, d22, d23, d28, d30); + tessellator.addVertexWithUV(offset, d22, d23, d28, d29); + tessellator.addVertexWithUV(offset, d18, d19, d27, d29); + tessellator.addVertexWithUV(d26, d18, d19, d27, d30); + + //ShaderHelper.useShaderWithProps(ShaderHelper.beam, "time", (int) tileAltar.getWorldObj().getTotalWorldTime()); + tessellator.draw(); + //ShaderHelper.releaseShader(); + + GL11.glDepthMask(true); + + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glPopMatrix(); + } +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/MRSRenderer.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/MRSRenderer.java new file mode 100644 index 00000000..4bf6de31 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/MRSRenderer.java @@ -0,0 +1,22 @@ +package WayofTime.alchemicalWizardry.common.renderer; + +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.util.ResourceLocation; +import WayofTime.alchemicalWizardry.common.renderer.block.RenderMasterStone; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; + +public abstract class MRSRenderer +{ + public abstract void renderAt(TEMasterStone tile, double x, double y, double z); + + protected void bindTexture(ResourceLocation p_147499_1_) + { + TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; + + if (texturemanager != null) + { + texturemanager.bindTexture(p_147499_1_); + } + } +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderMasterStone.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderMasterStone.java new file mode 100644 index 00000000..0a54d29d --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderMasterStone.java @@ -0,0 +1,30 @@ +package WayofTime.alchemicalWizardry.common.renderer.block; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import WayofTime.alchemicalWizardry.api.rituals.Rituals; +import WayofTime.alchemicalWizardry.common.renderer.MRSRenderer; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; + +public class RenderMasterStone extends TileEntitySpecialRenderer +{ + @Override + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) + { + if (tileEntity instanceof TEMasterStone) + { + String str = ((TEMasterStone) tileEntity).getCurrentRitual(); + MRSRenderer renderer = Rituals.getRendererForKey(str); + + if(renderer != null) + { + renderer.renderAt(((TEMasterStone) tileEntity), d0, d1, d2); + } + } + } +} \ No newline at end of file diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java index b1f5b4ec..3a474a32 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderPedestal.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.common.renderer.block; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -8,6 +9,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; @@ -86,6 +88,25 @@ public class RenderPedestal extends TileEntitySpecialRenderer GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); + + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(test); + GL11.glPushMatrix(); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); +// this.modelInputMirror.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, tileSpellBlock.getInputDirection(), tileSpellBlock.getOutputDirection()); + GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + + + } } diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderReagentConduit.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderReagentConduit.java new file mode 100644 index 00000000..bafec76d --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/RenderReagentConduit.java @@ -0,0 +1,70 @@ +package WayofTime.alchemicalWizardry.common.renderer.block; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import WayofTime.alchemicalWizardry.common.renderer.BeamRenderer; +import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; +import cpw.mods.fml.client.FMLClientHandler; + +public class RenderReagentConduit extends TileEntitySpecialRenderer +{ + private static final ResourceLocation field_110629_a = new ResourceLocation("alchemicalwizardry:textures/models/TransCircle.png"); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) + { + if (tileEntity instanceof TEReagentConduit) + { + GL11.glPushMatrix(); + float f1 = 1.0f; + Tessellator tessellator = Tessellator.instance; + this.bindTexture(field_110629_a); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_CULL_FACE); + float f2 = 0; + float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + + GL11.glDepthMask(false); + + tessellator.startDrawingQuads(); + tessellator.setColorRGBA(0, 0, 255, 90); + //tessellator.setColorOpaque(255, 255, 255); + + GL11.glTranslated(d0+0.5, d1+0.5, d2+0.5); + + GL11.glRotatef(tileEntity.getWorldObj().getWorldTime()/3.0f, 0F, 1F, 0F); //Rotate on planar axis + //GL11.glRotatef(30F, 0F, 0F, 1F); //Rotate vertical axis + //GL11.glRotatef(tileAltar.getWorldObj().getWorldTime()*2f, 1F, 0F, 0F); //Rotate cylindrically + + double offset = 0; + + tessellator.setBrightness(240); +// GL11.glTranslatef(0F, s, s); +// GL11.glScalef(1F, s * 14F, s * 14F); + tessellator.addVertexWithUV(-0.5d, 0, -0.5d, 0.0d, 0.0d); + tessellator.addVertexWithUV(0.5d, 0, -0.5d, 1.0d, 0.0d); + tessellator.addVertexWithUV(0.5d, 0, 0.5d, 1.0d, 1.0d); + tessellator.addVertexWithUV(-0.5d, 0, 0.5d, 0.0d, 1.0d); + + tessellator.draw(); + + GL11.glDepthMask(true); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glPopMatrix(); + } + } +} \ No newline at end of file diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/ShaderHelper.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/ShaderHelper.java new file mode 100644 index 00000000..46641497 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/renderer/block/ShaderHelper.java @@ -0,0 +1,184 @@ +/** + * This class was created by . 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 a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Apr 9, 2014, 11:20:26 PM (GMT)] + */ +package WayofTime.alchemicalWizardry.common.renderer.block; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.logging.Level; + +import org.lwjgl.opengl.ARBFragmentShader; +import org.lwjgl.opengl.ARBShaderObjects; +import org.lwjgl.opengl.ARBVertexShader; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.FMLLog; + +public final class ShaderHelper { + + private static final int VERT = ARBVertexShader.GL_VERTEX_SHADER_ARB; + private static final int FRAG = ARBFragmentShader.GL_FRAGMENT_SHADER_ARB; + + public static int beam = 0; + + public static void initShaders() { +// if(!useShaders()) +// return; + + beam = createProgram(null, "/assets/alchemicalwizardry/shaders/beam.frag"); + } + + public static void useShaderWithProps(int shader, Object... props) { +// if(!useShaders()) +// return; + + ARBShaderObjects.glUseProgramObjectARB(shader); + + if(shader != 0 && props.length % 2 == 0) { + int propCount = props.length / 2; + for(int i = 0; i < propCount; i++) { + String propName = (String) props[i * 2]; + Object propVal = props[i * 2 + 1]; + + int uniform = ARBShaderObjects.glGetUniformLocationARB(shader, propName); + if(propVal instanceof Integer) + ARBShaderObjects.glUniform1iARB(uniform, (Integer) propVal); + if(propVal instanceof Float) + ARBShaderObjects.glUniform1fARB(uniform, (Float) propVal); + // Possible Vector2, Vector3 and Vector4, no need yet. + } + } + } + + public static void useShader(int shader) { + useShaderWithProps(shader); + } + + public static void releaseShader() { + useShader(0); + } + + public static boolean useShaders() { + return true;//ConfigHandler.useShaders && OpenGlHelper.shadersSupported; + } + + // Most of the code taken from the LWJGL wiki + // http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL + + private static int createProgram(String vert, String frag) { + int vertId = 0, fragId = 0, program = 0; + if(vert != null) + vertId = createShader(vert, VERT); + if(frag != null) + fragId = createShader(frag, FRAG); + + program = ARBShaderObjects.glCreateProgramObjectARB(); + if(program == 0) + return 0; + + if(vert != null) + ARBShaderObjects.glAttachObjectARB(program, vertId); + if(frag != null) + ARBShaderObjects.glAttachObjectARB(program, fragId); + + ARBShaderObjects.glLinkProgramARB(program); + if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) { +// FMLLog.log(Level.WARNING, getLogInfo(program)); + return 0; + } + + ARBShaderObjects.glValidateProgramARB(program); + if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) { +// FMLLog.log(Level.WARNING, getLogInfo(program)); + return 0; + } + + return program; + } + + private static int createShader(String filename, int shaderType){ + int shader = 0; + try { + shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType); + + if(shader == 0) + return 0; + + ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename)); + ARBShaderObjects.glCompileShaderARB(shader); + + if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) + throw new RuntimeException("Error creating shader: " + getLogInfo(shader)); + + return shader; + } + catch(Exception e) { + ARBShaderObjects.glDeleteObjectARB(shader); + e.printStackTrace(); + return -1; + } + } + + private static String getLogInfo(int obj) { + return ARBShaderObjects.glGetInfoLogARB(obj, ARBShaderObjects.glGetObjectParameteriARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB)); + } + + private static String readFileAsString(String filename) throws Exception { + StringBuilder source = new StringBuilder(); + InputStream in = ShaderHelper.class.getResourceAsStream(filename); + Exception exception = null; + BufferedReader reader; + + if(in == null) + return ""; + + try { + reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); + + Exception innerExc= null; + try { + String line; + while((line = reader.readLine()) != null) + source.append(line).append('\n'); + } catch(Exception exc) { + exception = exc; + } finally { + try { + reader.close(); + } catch(Exception exc) { + if(innerExc == null) + innerExc = exc; + else exc.printStackTrace(); + } + } + + if(innerExc != null) + throw innerExc; + } catch(Exception exc) { + exception = exc; + } finally { + try { + in.close(); + } catch(Exception exc) { + if(exception == null) + exception = exc; + else exc.printStackTrace(); + } + + if(exception != null) + throw exception; + } + + return source.toString(); + } +} + diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java index 95a6638b..6d0d1b88 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectFeatheredKnife.java @@ -88,7 +88,7 @@ public class RitualEffectFeatheredKnife extends RitualEffect { entity = (EntityPlayer) iterator1.next(); - if (entity.getClass().equals(EntityPlayerMP.class) || entity.getClass().equals(EntityPlayer.class)) + if (!SpellHelper.isFakePlayer(world, entity)) { entityCount++; } @@ -114,9 +114,9 @@ public class RitualEffectFeatheredKnife extends RitualEffect entity = (EntityPlayer) iterator2.next(); //entity = (EntityPlayer)iterator1.next(); - if (entity.getClass().equals(EntityPlayerMP.class) || entity.getClass().equals(EntityPlayer.class)) + if (!SpellHelper.isFakePlayer(world, entity)) { - if (entity.getHealth() > 6.2f) + if (entity.getHealth()/entity.getMaxHealth() > 0.3d) { entity.setHealth(entity.getHealth() - 1); entityCount++; diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java index 5e7f1d3d..7bb7c70c 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java @@ -1,5 +1,8 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import java.util.List; + +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -7,6 +10,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.Packet; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; @@ -60,6 +65,8 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui protected FluidStack fluidOutput; protected FluidStack fluidInput; private int progress; + + private int lockdownDuration; public TEAltar() { @@ -81,6 +88,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui upgradeLevel = 0; isResultBlock = false; progress = 0; + this.lockdownDuration = 0; } @Override @@ -145,6 +153,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui bufferCapacity = par1NBTTagCompound.getInteger("bufferCapacity"); progress = par1NBTTagCompound.getInteger("progress"); isResultBlock = par1NBTTagCompound.getBoolean("isResultBlock"); + lockdownDuration = par1NBTTagCompound.getInteger("lockdownDuration"); } public void setMainFluid(FluidStack fluid) @@ -221,6 +230,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui par1NBTTagCompound.setInteger("capacity", capacity); par1NBTTagCompound.setInteger("progress", progress); par1NBTTagCompound.setInteger("bufferCapacity", bufferCapacity); + par1NBTTagCompound.setInteger("lockdownDuration", lockdownDuration); } @Override @@ -527,6 +537,11 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui public void updateEntity() { //this.capacity=(int) (10000*this.capacityMultiplier); + if(this.lockdownDuration > 0) + { + this.lockdownDuration --; + } + if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0) { //TODO @@ -541,9 +556,23 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui fluidOutputted = Math.min(this.fluid.amount, fluidOutputted); this.fluidOutput.amount += fluidOutputted; this.fluid.amount -= fluidOutputted; - } + + if(AlchemicalWizardry.lockdownAltar) + { + List list = SpellHelper.getPlayersInRange(worldObj, xCoord+0.5, yCoord+0.5, zCoord+0.5, 15, 15); + boolean hasHighRegen = false; + for(EntityPlayer player : list) + { + PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration); + if(regenEffect != null && regenEffect.getAmplifier() >= 2) + { + this.lockdownDuration += 20; + } + } + } + } - if (worldObj.getWorldTime() % 150 == 0) + if (worldObj.getWorldTime() % 100 == 0) { startCycle(); } @@ -564,6 +593,30 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui { return; } + + int range = 5; + + for(int i=-range; i<=range; i++) + { + for(int j=-range; j<=range; j++) + { + for(int k=-range; k<=range; k++) + { + Block block = worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k); + int meta = worldObj.getBlockMetadata(xCoord + i, yCoord + j, zCoord + k); + + List list = block.getDrops(worldObj, xCoord + i, yCoord + j, zCoord + k, meta, 1); + for(ItemStack stack : list) + { + String str = stack.getUnlocalizedName(); + if(str.contains("fallenKanade")) + { + System.out.println("" + str); + } + } + } + } + } //o,o this is always true if (worldTime % 1 == 0) @@ -726,7 +779,14 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui public void sacrificialDaggerCall(int amount, boolean isSacrifice) { - fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); + if(!isSacrifice && this.lockdownDuration > 0) + { + int amt = (int) Math.min(bufferCapacity - fluidInput.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); + fluidInput.amount += amt; + }else + { + fluid.amount += Math.min(capacity - fluid.amount, (isSacrifice ? 1 + sacrificeEfficiencyMultiplier : 1 + selfSacrificeEfficiencyMultiplier) * amount); + } } @Override diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java index 897b7857..1255a7dd 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java @@ -2,18 +2,20 @@ package WayofTime.alchemicalWizardry.common.tileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.Rituals; import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; public class TEMasterStone extends TileEntity implements IMasterRitualStone { - //private int currentRitual; private String currentRitualString; private boolean isActive; private String owner; @@ -21,10 +23,11 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone private int cooldown; private int var1; private int direction; + public boolean isRunning; + public int runningTime; public TEMasterStone() { - //currentRitual = 0; isActive = false; owner = ""; cooldown = 0; @@ -32,34 +35,36 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone direction = 0; varString1 = ""; currentRitualString = ""; + isRunning = false; + runningTime = 0; } @Override public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); - //currentRitual = par1NBTTagCompound.getInteger("currentRitual"); isActive = par1NBTTagCompound.getBoolean("isActive"); owner = par1NBTTagCompound.getString("owner"); cooldown = par1NBTTagCompound.getInteger("cooldown"); var1 = par1NBTTagCompound.getInteger("var1"); direction = par1NBTTagCompound.getInteger("direction"); currentRitualString = par1NBTTagCompound.getString("currentRitualString"); -// varString1 = par1NBTTagCompound.getString("varString1"); + isRunning = par1NBTTagCompound.getBoolean("isRunning"); + runningTime = par1NBTTagCompound.getInteger("runningTime"); } @Override public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); - //par1NBTTagCompound.setInteger("currentRitual", currentRitual); par1NBTTagCompound.setBoolean("isActive", isActive); par1NBTTagCompound.setString("owner", owner); par1NBTTagCompound.setInteger("cooldown", cooldown); par1NBTTagCompound.setInteger("var1", var1); par1NBTTagCompound.setInteger("direction", direction); par1NBTTagCompound.setString("currentRitualString", currentRitualString); -// par1NBTTagCompound.setString("varString1", varString1); + par1NBTTagCompound.setBoolean("isRunning", isRunning); + par1NBTTagCompound.setInteger("runningTime",runningTime); } public void activateRitual(World world, int crystalLevel, EntityPlayer player) @@ -101,7 +106,6 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone { player.addChatMessage(new ChatComponentText("You feel a pull, but you are too weak to push any further.")); - //TODO Bad stuff return; } @@ -122,6 +126,7 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone var1 = 0; currentRitualString = testRitual; isActive = true; + isRunning = true; direction = Rituals.getDirectionOfRitual(world, xCoord, yCoord, zCoord, testRitual); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } @@ -134,6 +139,14 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone @Override public void updateEntity() { + if(isRunning && runningTime < 100) + { + runningTime++; + }else if(!isRunning && runningTime > 0) + { + runningTime--; + } + if (!isActive) { return; @@ -156,14 +169,25 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone isActive = false; currentRitualString = ""; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(xCoord, yCoord, zCoord, (short)3)); return; } } if (worldObj.getBlockPowerInput(xCoord, yCoord, zCoord) > 0) { + if(isRunning) + { + isRunning = false; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } return; + }else + { + if(!isRunning) + { + isRunning = true; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } } performRitual(worldObj, xCoord, yCoord, zCoord, currentRitualString); @@ -202,6 +226,8 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone public void setActive(boolean active) { this.isActive = active; + this.isRunning = active; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } public int getDirection() @@ -232,4 +258,27 @@ public class TEMasterStone extends TileEntity implements IMasterRitualStone { return zCoord; } + + public String getCurrentRitual() + { + return this.currentRitualString; + } + + public void setCurrentRitual(String str) + { + this.currentRitualString = str; + } + + @Override + public Packet getDescriptionPacket() + { + return NewPacketHandler.getPacket(this); + } + + public AxisAlignedBB getRenderBoundingBox() + { + double renderExtention = 1.0d; + AxisAlignedBB bb = AxisAlignedBB. getBoundingBox(xCoord-renderExtention, yCoord-renderExtention, zCoord-renderExtention, xCoord+1+renderExtention, yCoord+1+renderExtention, zCoord+1+renderExtention); + return bb; + } } \ No newline at end of file diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java new file mode 100644 index 00000000..f8e52d79 --- /dev/null +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEReagentConduit.java @@ -0,0 +1,8 @@ +package WayofTime.alchemicalWizardry.common.tileEntity; + +import net.minecraft.tileentity.TileEntity; + +public class TEReagentConduit extends TileEntity +{ + +} diff --git a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java index bc005c4a..a106176a 100644 --- a/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java +++ b/1.7.10/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java @@ -19,6 +19,8 @@ import WayofTime.alchemicalWizardry.common.IBindingAgent; import WayofTime.alchemicalWizardry.common.ICatalyst; import WayofTime.alchemicalWizardry.common.IFillingAgent; import WayofTime.alchemicalWizardry.common.NewPacketHandler; +import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry; +import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; @@ -288,6 +290,30 @@ public class TEWritingTable extends TileEntity implements IInventory return -1; } + + public boolean containsCombinationCatalyst() + { + if (getCombinationCatalystPosition() != -1) + { + return true; + } else + { + return false; + } + } + + public int getCombinationCatalystPosition() + { + for (int i = 1; i <= 5; i++) + { + if (inv[i] != null && inv[i].getItem() instanceof ICombinationalCatalyst) + { + return i; + } + } + + return -1; + } public boolean containsRegisteredPotionIngredient() { @@ -615,7 +641,6 @@ public class TEWritingTable extends TileEntity implements IInventory } } else if (this.containsFillingAgent() && this.containsPotionFlask()) { - //TODO if (getStackInSlot(6) == null) { progress++; @@ -661,7 +686,55 @@ public class TEWritingTable extends TileEntity implements IInventory } } } - } else + } + else if (this.containsPotionFlask() && this.containsCombinationCatalyst()) + { + //TODO + if (getStackInSlot(6) == null && CombinedPotionRegistry.hasCombinablePotionEffect(inv[this.getPotionFlaskPosition()])) + { + progress++; + + if (worldTime % 4 == 0) + { + SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord); + } + + if (progress >= progressNeeded) + { + ItemStack flaskStack = inv[this.getPotionFlaskPosition()]; + //ItemStack ingredientStack = inv[this.getRegisteredPotionIngredientPosition()]; + ItemStack combinationCatalyst = inv[this.getCombinationCatalystPosition()]; + + if (flaskStack == null || combinationCatalyst == null) + { + progress = 0; + + if (worldObj != null) + { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + return; + } + + ItemStack newFlask = CombinedPotionRegistry.applyPotionEffect(flaskStack); + if(newFlask != null) + { + this.setInventorySlotContents(6, newFlask); + this.decrStackSize(this.getPotionFlaskPosition(), 1); + this.decrStackSize(this.getCombinationCatalystPosition(), 1); + + progress = 0; + + if (worldObj != null) + { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + } + } + } + else { if (!isRecipeValid()) { diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/lang/en_US.lang b/1.7.10/main/resources/assets/alchemicalwizardry/lang/en_US.lang index 778353db..a377343f 100644 --- a/1.7.10/main/resources/assets/alchemicalwizardry/lang/en_US.lang +++ b/1.7.10/main/resources/assets/alchemicalwizardry/lang/en_US.lang @@ -172,6 +172,10 @@ item.sanguineHelmet.name=Sanguine Helmet item.itemSeerSigil.name=Sigil of Sight item.itemFluidSigil.name= item.multiTool.name=Dynamic Mace +item.itemCombinationalCatalyst.name=Combinational Catalyst +item.sanguineRobe.name=Sanguine Robes +item.sanguinePants.name=Sanguine Leggings +item.sanguineBoots.name=Sanguine Boots #Creative Tab itemGroup.tabBloodMagic=Blood Magic diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/models/armor/armor - Shortcut.lnk b/1.7.10/main/resources/assets/alchemicalwizardry/models/armor/armor - Shortcut.lnk deleted file mode 100644 index 806150bd..00000000 Binary files a/1.7.10/main/resources/assets/alchemicalwizardry/models/armor/armor - Shortcut.lnk and /dev/null differ diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/shaders/beam.frag b/1.7.10/main/resources/assets/alchemicalwizardry/shaders/beam.frag new file mode 100644 index 00000000..82fccbe1 --- /dev/null +++ b/1.7.10/main/resources/assets/alchemicalwizardry/shaders/beam.frag @@ -0,0 +1,12 @@ + uniform sampler2D bgl_RenderedTexture; + uniform int time; + + void main() { + vec2 texcoord = vec2(gl_TexCoord[0]); + vec4 color = texture2D(bgl_RenderedTexture, texcoord); + + float gs = (color.r + color.g + color.b) / 3; + float r = sin(texcoord.x * 6 - 1.5 + sin(texcoord.y - time / 3.0)) * 1.1; //(sin((texcoord.x - texcoord.y) * 4 - time) + 1) / 2; + + gl_FragColor = vec4(gs, gs, max(gs, r), gl_Color.a); + } diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/textures/items/CombinationalCatalyst.png b/1.7.10/main/resources/assets/alchemicalwizardry/textures/items/CombinationalCatalyst.png new file mode 100644 index 00000000..dc14d2dc Binary files /dev/null and b/1.7.10/main/resources/assets/alchemicalwizardry/textures/items/CombinationalCatalyst.png differ diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/SimpleTransCircle.png b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/SimpleTransCircle.png new file mode 100644 index 00000000..77669e56 Binary files /dev/null and b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/SimpleTransCircle.png differ diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircle.png b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircle.png new file mode 100644 index 00000000..ecda29fc Binary files /dev/null and b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircle.png differ diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircleBinding.png b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircleBinding.png new file mode 100644 index 00000000..cc54eda5 Binary files /dev/null and b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircleBinding.png differ diff --git a/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircleSuffering.png b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircleSuffering.png new file mode 100644 index 00000000..52963252 Binary files /dev/null and b/1.7.10/main/resources/assets/alchemicalwizardry/textures/models/TransCircleSuffering.png differ