diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 044e06d1..4b74fd24 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -33,6 +33,7 @@ import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler; import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry; import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry; import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry; +import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry; import WayofTime.alchemicalWizardry.api.rituals.Rituals; import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry; import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks; @@ -58,6 +59,8 @@ import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental; import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem; import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental; import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon; +import WayofTime.alchemicalWizardry.common.harvest.BloodMagicHarvestHandler; +import WayofTime.alchemicalWizardry.common.harvest.GourdHarvestHandler; import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner; import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding; import WayofTime.alchemicalWizardry.common.items.thaumcraft.ItemSanguineArmour; @@ -82,6 +85,7 @@ import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredEarth; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredKnife; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFlight; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectGrowth; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectHarvest; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectHealing; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectInterdiction; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectItemSuction; @@ -406,6 +410,7 @@ public class AlchemicalWizardry ItemStack runeOfSelfSacrificeStack = new ItemStack(ModBlocks.runeOfSelfSacrifice); ItemStack miningSigilStackCrafted = new ItemStack(ModItems.sigilOfTheFastMiner); ItemStack divinationSigilStackCrafted = new ItemStack(ModItems.divinationSigil); + ItemStack seerSigilStack = new ItemStack(ModItems.itemSeerSigil); // ItemStack elementalInkWaterStack = new ItemStack(elementalInkWater); // ItemStack elementalInkFireStack = new ItemStack(elementalInkFire); // ItemStack elementalInkEarthStack = new ItemStack(elementalInkEarth); @@ -478,7 +483,9 @@ public class AlchemicalWizardry GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', goldIngotStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack)); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSelfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', glowstoneDustStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack)); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(divinationSigilStackCrafted, "ggg", "gsg", "gog", 'g', glassStack, 's', blankSlateStack, 'o', weakBloodOrbStack)); -// GameRegistry.addRecipe(waterScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkWaterStack); + GameRegistry.addRecipe(new ShapedBloodOrbRecipe(seerSigilStack, "gbg", "gsg", "gog", 'g', glassStack, 's', divinationSigilStackCrafted, 'o', apprenticeBloodOrbStack,'b', new ItemStack(ModItems.bucketLife))); + + // GameRegistry.addRecipe(waterScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkWaterStack); // GameRegistry.addRecipe(fireScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkFireStack); // GameRegistry.addRecipe(earthScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkEarthStack); // GameRegistry.addRecipe(airScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkAirStack); @@ -594,6 +601,7 @@ public class AlchemicalWizardry this.initAltarRecipes(); this.initRituals(); this.initBindingRecipes(); + this.initHarvestRegistry(); //MinecraftForge.setToolClass(ModItems.boundPickaxe, "pickaxe", 5); //MinecraftForge.setToolClass(ModItems.boundAxe, "axe", 5); @@ -968,6 +976,7 @@ public class AlchemicalWizardry Rituals.registerRitual("AW021Expulsion", 1, 1000000, new RitualEffectExpulsion(), "Aura of Expulsion"); Rituals.registerRitual("AW022Supression", 1, 10000, new RitualEffectSupression(), "Dome of Supression"); Rituals.registerRitual("AW023Zephyr", 1, 25000, new RitualEffectItemSuction(),"Call of the Zephyr"); + Rituals.registerRitual("AW024Harvest", 1, 1000, new RitualEffectHarvest(), "Reap of the Harvest Moon"); //Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock")); } @@ -979,4 +988,10 @@ public class AlchemicalWizardry BindingRegistry.registerRecipe(new ItemStack(ModItems.energySword), new ItemStack(Items.diamond_sword)); BindingRegistry.registerRecipe(new ItemStack(ModItems.energyBlaster), new ItemStack(ModItems.apprenticeBloodOrb)); } + + public static void initHarvestRegistry() + { + HarvestRegistry.registerHarvestHandler(new BloodMagicHarvestHandler()); + HarvestRegistry.registerHarvestHandler(new GourdHarvestHandler()); + } } diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java new file mode 100644 index 00000000..886c0ea4 --- /dev/null +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java @@ -0,0 +1,33 @@ +package WayofTime.alchemicalWizardry.api.harvest; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.world.World; + +public class HarvestRegistry +{ + public static List handlerList = new ArrayList(); + + public static void registerHarvestHandler(IHarvestHandler handler) + { + handlerList.add(handler); + } + + public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord) + { + Block block = world.getBlock(xCoord, yCoord, zCoord); + int meta = world.getBlockMetadata(xCoord, yCoord, zCoord); + + for(IHarvestHandler handler : handlerList) + { + if(handler.canHandleBlock(block) && handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta)) + { + return true; + } + } + + return false; + } +} diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java new file mode 100644 index 00000000..88e47835 --- /dev/null +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java @@ -0,0 +1,16 @@ +package WayofTime.alchemicalWizardry.api.harvest; + +import net.minecraft.block.Block; +import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; + +public interface IHarvestHandler +{ + public boolean canHandleBlock(Block block); + + public int getHarvestMeta(Block block); + + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta); + + public IPlantable getSeedItem(Block block); +} diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java index f6f97f03..b0777a46 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonBuilding.java @@ -112,4 +112,9 @@ public class DemonBuilding { schematic.destroyAllInField(world, xCoord, yCoord, zCoord, dir); } + + public int getNumberOfGridSpaces() + { + return area.getNumberOfGridSpaces(); + } } diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java index 5ce845c1..95438be0 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/demonVillage/GridSpaceHolder.java @@ -289,4 +289,21 @@ public class GridSpaceHolder } } } + + public int getNumberOfGridSpaces() + { + int num = 0; + for(int i=-this.negXRadius; i<=this.posXRadius; i++) + { + for(int j=-this.negZRadius; j<=this.posZRadius; j++) + { + if(!this.getGridSpace(i, j).isEmpty()) + { + num++; + } + } + } + + return num; + } } diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java index f07dc92c..95275b21 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/entity/mob/EntityElemental.java @@ -342,7 +342,6 @@ public class EntityElemental extends EntityDemon { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", this.isAngry()); - par1NBTTagCompound.setByte("CollarColor", (byte) this.getCollarColor()); } /** @@ -353,11 +352,6 @@ public class EntityElemental extends EntityDemon super.readEntityFromNBT(par1NBTTagCompound); this.setAngry(par1NBTTagCompound.getBoolean("Angry")); - if (par1NBTTagCompound.hasKey("CollarColor")) - { - this.setCollarColor(par1NBTTagCompound.getByte("CollarColor")); - } - this.setCombatTask(); } diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/harvest/BloodMagicHarvestHandler.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/harvest/BloodMagicHarvestHandler.java new file mode 100644 index 00000000..861932f9 --- /dev/null +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/harvest/BloodMagicHarvestHandler.java @@ -0,0 +1,122 @@ +package WayofTime.alchemicalWizardry.common.harvest; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; +import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler; + +public class BloodMagicHarvestHandler implements IHarvestHandler +{ + @Override + public boolean canHandleBlock(Block block) + { + return block == Blocks.wheat || block == Blocks.carrots || block == Blocks.potatoes; + } + + @Override + public int getHarvestMeta(Block block) + { + if(block == Blocks.wheat) + { + return 7; + } + if(block == Blocks.carrots) + { + return 7; + } + if(block == Blocks.potatoes) + { + return 7; + } + return 7; + } + + @Override + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) + { + if(!this.canHandleBlock(block) || meta != this.getHarvestMeta(block)) + { + return false; + } + + IPlantable seed = this.getSeedItem(block); + + if(seed == null) + { + return false; + } + + int fortune = 0; + + List list = block.getDrops(world, xCoord, yCoord, zCoord, meta, fortune); + boolean foundAndRemovedSeed = false; + + for(ItemStack stack : list) + { + if(stack == null) + { + continue; + } + + Item item = stack.getItem(); + if(item == seed) + { + int itemSize = stack.stackSize; + if(itemSize > 1) + { + stack.stackSize--; + foundAndRemovedSeed = true; + break; + }else if(itemSize == 1) + { + list.remove(stack); + foundAndRemovedSeed = true; + break; + } + } + } + + if(foundAndRemovedSeed) + { + int plantMeta = seed.getPlantMetadata(world, xCoord, yCoord, zCoord); + Block plantBlock = seed.getPlant(world, xCoord, yCoord, zCoord); + + world.setBlock(xCoord, yCoord, zCoord, plantBlock, plantMeta, 3); + + for(ItemStack stack : list) + { + EntityItem itemEnt = new EntityItem(world, xCoord, yCoord, zCoord, stack); + + world.spawnEntityInWorld(itemEnt); + } + } + + return false; + } + + @Override + public IPlantable getSeedItem(Block block) + { + if(block == Blocks.wheat) + { + return (IPlantable) Items.wheat_seeds; + } + if(block == Blocks.carrots) + { + return (IPlantable) Items.carrot; + } + if(block == Blocks.potatoes) + { + return (IPlantable) Items.potato; + } + + return null; + } +} \ No newline at end of file diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/harvest/GourdHarvestHandler.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/harvest/GourdHarvestHandler.java new file mode 100644 index 00000000..7870cf09 --- /dev/null +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/harvest/GourdHarvestHandler.java @@ -0,0 +1,58 @@ +package WayofTime.alchemicalWizardry.common.harvest; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; +import WayofTime.alchemicalWizardry.api.harvest.IHarvestHandler; + +public class GourdHarvestHandler implements IHarvestHandler +{ + @Override + public boolean canHandleBlock(Block block) + { + return block == Blocks.melon_block || block == Blocks.pumpkin; + } + + @Override + public int getHarvestMeta(Block block) + { + return 0; + } + + @Override + public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta) + { + if(!this.canHandleBlock(block)) + { + return false; + } + + int fortune = 0; + + List list = block.getDrops(world, xCoord, yCoord, zCoord, meta, fortune); + + world.setBlockToAir(xCoord, yCoord, zCoord); + + for(ItemStack stack : list) + { + EntityItem itemEnt = new EntityItem(world, xCoord, yCoord, zCoord, stack); + + world.spawnEntityInWorld(itemEnt); + } + + return false; + } + + @Override + public IPlantable getSeedItem(Block block) + { + return null; + } +} \ No newline at end of file diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java index 00d9c533..9ab96a21 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/items/ItemRitualDiviner.java @@ -144,6 +144,10 @@ 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.2/main/java/WayofTime/alchemicalWizardry/common/items/spell/ItemSpellMultiTool.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/items/spell/ItemSpellMultiTool.java index f770c9dd..6f1806a1 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/items/spell/ItemSpellMultiTool.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/items/spell/ItemSpellMultiTool.java @@ -417,7 +417,7 @@ public class ItemSpellMultiTool extends Item @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { - par3List.add("Here's a 'Tool Tip' :D"); + par3List.add("A mace filled with ancient alchemy"); if (!(par1ItemStack.stackTagCompound == null)) { @@ -434,7 +434,7 @@ public class ItemSpellMultiTool extends Item par3List.add(""); float damage = this.getCustomItemAttack(par1ItemStack); par3List.add("\u00A79+" + ((int)(damage*10))/10.0f + " " + "Attack Damage"); - float critChance = ((int)(this.getCritChance(par1ItemStack)*1000))/10; + float critChance = ((int)(this.getCritChance(par1ItemStack)*1000))/10.0f; par3List.add("\u00A79+" + critChance + "% " + "Crit Chance"); } } diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHarvest.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHarvest.java new file mode 100644 index 00000000..42564449 --- /dev/null +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectHarvest.java @@ -0,0 +1,123 @@ +package WayofTime.alchemicalWizardry.common.rituals; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; +import WayofTime.alchemicalWizardry.api.harvest.HarvestRegistry; +import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; +import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; +import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; +import WayofTime.alchemicalWizardry.api.soulNetwork.LifeEssenceNetwork; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; + +public class RitualEffectHarvest extends RitualEffect +{ + @Override + public void performEffect(IMasterRitualStone ritualStone) + { + String owner = ritualStone.getOwner(); + World worldSave = MinecraftServer.getServer().worldServers[0]; + LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); + + if (data == null) + { + data = new LifeEssenceNetwork(owner); + worldSave.setItemData(owner, data); + } + + int currentEssence = data.currentEssence; + World world = ritualStone.getWorld(); + int x = ritualStone.getXCoord(); + int y = ritualStone.getYCoord(); + int z = ritualStone.getZCoord(); + int maxCount = 9; + + if (currentEssence < this.getCostPerRefresh() * maxCount) + { + EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner); + + if (entityOwner == null) + { + return; + } + + entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); + } else + { + if (world.getWorldTime() % 20 != 0) + { + return; + } + + int flag = 0; + int range = 4; + + for (int i = -range; i <= range; i++) + { + for (int j = -range; j <= range; j++) + { + for(int k = -range; k<=range; k++) + { + if(HarvestRegistry.harvestBlock(world, x + i, y + j, z + k)) + { + flag++; + } + } + } + } + + if (flag > 0) + { + data.currentEssence = currentEssence - this.getCostPerRefresh() * Math.min(maxCount, flag); + data.markDirty(); + } + } + } + + @Override + public int getCostPerRefresh() + { + return 20; + } + + @Override + public List getRitualComponentList() + { + ArrayList harvestRitual = new ArrayList(); + + harvestRitual.add(new RitualComponent(1,0,1,RitualComponent.DUSK)); + harvestRitual.add(new RitualComponent(1,0,-1,RitualComponent.DUSK)); + harvestRitual.add(new RitualComponent(-1,0,-1,RitualComponent.DUSK)); + harvestRitual.add(new RitualComponent(-1,0,1,RitualComponent.DUSK)); + harvestRitual.add(new RitualComponent(2,0,0,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(-2,0,0,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(0,0,2,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(0,0,-2,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(3,0,1,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(3,0,-1,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(-3,0,1,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(-3,0,-1,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(1,0,3,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(-1,0,3,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(1,0,-3,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(-1,0,-3,RitualComponent.EARTH)); + harvestRitual.add(new RitualComponent(2,0,3,RitualComponent.WATER)); + harvestRitual.add(new RitualComponent(3,0,2,RitualComponent.WATER)); + harvestRitual.add(new RitualComponent(2,0,-3,RitualComponent.WATER)); + harvestRitual.add(new RitualComponent(-3,0,2,RitualComponent.WATER)); + harvestRitual.add(new RitualComponent(-2,0,3,RitualComponent.WATER)); + harvestRitual.add(new RitualComponent(3,0,-2,RitualComponent.WATER)); + harvestRitual.add(new RitualComponent(-2,0,-3,RitualComponent.WATER)); + harvestRitual.add(new RitualComponent(-3,0,-2,RitualComponent.WATER)); + + + return harvestRitual; + } +} diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java index 7c712ec7..d405b21f 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectItemSuction.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; @@ -73,7 +74,7 @@ public class RitualEffectItemSuction extends RitualEffect entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); } else { - List itemDropList = SpellHelper.getItemsInRange(world, x+0.5f, y+0.5f, z+0.5f, 10, 10); + List itemDropList = SpellHelper.getItemsInRange(world, x+0.5f, y+0.5f, z+0.5f, range, range); int count = 0; @@ -100,7 +101,10 @@ public class RitualEffectItemSuction extends RitualEffect copyStack.stackSize = 0; } else { - if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage()) + NBTTagCompound data1 = itemStack.getTagCompound(); + NBTTagCompound data2 = copyStack.getTagCompound(); + //TODO + if (itemStack.getItem().equals(copyStack.getItem()) && itemStack.getItemDamage() == copyStack.getItemDamage() && ((data1 == null && data2 == null) || (data1 != null && data1.equals(data2)))) { int itemSize = itemStack.stackSize; int copySize = copyStack.stackSize; diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java index 96e284b2..094d3fb4 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java @@ -263,22 +263,18 @@ public class SpellEffectEarth extends SpellEffect @Override protected int getCostForOffenseTool() { - // TODO Auto-generated method stub - return 0; + return 1000; } - @Override protected int getCostForDefenseTool() { return (int)(1000 * (1 + this.potencyEnhancement*0.1f) * (1 + this.powerEnhancement*0.2f) * Math.pow(0.85, costEnhancement)); } - @Override protected int getCostForEnvironmentTool() { return (int)(10 * (1+this.potencyEnhancement*0.8) * Math.pow(1.5*this.powerEnhancement + 3, 2) * Math.pow(0.85, this.costEnhancement)); } - } diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java index a6f03bc1..a3ee9ce2 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/earth/ToolEnvironmentalEarth.java @@ -28,8 +28,8 @@ public class ToolEnvironmentalEarth extends DigAreaEffect int z = blockPos.blockZ; ForgeDirection sidehit = ForgeDirection.getOrientation(blockPos.sideHit); - int radius = 2; - int depth = 5; + int radius = this.powerUpgrades + 1; + int depth = 1 + this.potencyUpgrades * 2; depth--; diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java index 4a4fac77..8cf4bc63 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ToolDefensiveIce.java @@ -25,7 +25,7 @@ public class ToolDefensiveIce extends SummonToolEffect public int onSummonTool(ItemStack toolStack, World world, Entity entity) { int horizRadius = this.powerUpgrades*2+2; - int vertRadius = this.powerUpgrades * 3 + 2; + int vertRadius = this.potencyUpgrades * 3 + 2; List entityList = SpellHelper.getEntitiesInRange(world, entity.posX, entity.posY, entity.posZ, horizRadius, vertRadius); for(Entity ent : entityList) diff --git a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEDemonPortal.java b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEDemonPortal.java index b9273060..9b6f08d6 100644 --- a/1.7.2/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEDemonPortal.java +++ b/1.7.2/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEDemonPortal.java @@ -36,6 +36,9 @@ import com.google.gson.GsonBuilder; public class TEDemonPortal extends TileEntity { + public static int buildingGridDelay = 25; + public static int roadGridDelay = 10; + public static List buildingList = new ArrayList(); public Random rand = new Random(); private GridSpace[][] area; @@ -105,12 +108,41 @@ public class TEDemonPortal extends TileEntity } } - this.houseCooldown = 1000; - this.roadCooldown = 100; + this.houseCooldown = TEDemonPortal.buildingGridDelay; + this.roadCooldown = TEDemonPortal.roadGridDelay; isInitialized = true; } + @Override + public void updateEntity() + { + if(!isInitialized) + { + return; + } + + if(this.roadCooldown <= 0) + { + int roadsMade = this.createRandomRoad(); + if(roadsMade > 0) + { + this.roadCooldown = TEDemonPortal.roadGridDelay * roadsMade; + } + } + else if(this.houseCooldown <= 0) + { + int gridsUsed = this.createRandomBuilding(0, 0); + if(gridsUsed > 0) + { + this.houseCooldown = TEDemonPortal.buildingGridDelay * gridsUsed; + } + } + + this.houseCooldown = Math.max(0, this.houseCooldown - 1); + this.roadCooldown = Math.max(0, this.roadCooldown - 1); + } + @Override public void readFromNBT(NBTTagCompound par1NBTTagCompound) { @@ -140,6 +172,9 @@ public class TEDemonPortal extends TileEntity } this.isInitialized = par1NBTTagCompound.getBoolean("init"); + + this.tier = par1NBTTagCompound.getInteger("tier"); + this.totalPoints = par1NBTTagCompound.getInteger("totalPoints"); } @Override @@ -179,6 +214,8 @@ public class TEDemonPortal extends TileEntity par1NBTTagCompound.setTag("Grid", gridList); par1NBTTagCompound.setBoolean("init", isInitialized); + par1NBTTagCompound.setInteger("tier", this.tier); + par1NBTTagCompound.setInteger("totalPoints", this.totalPoints); } public int createRandomRoad() //Return the number of road spaces @@ -745,7 +782,6 @@ public class TEDemonPortal extends TileEntity { return; } - Int3 roadMarker = this.getNextRoadMarker(); this.initialize(); @@ -761,20 +797,20 @@ public class TEDemonPortal extends TileEntity } } - public void createRandomBuilding(int type, int tier) + public int createRandomBuilding(int type, int tier) { switch(type) { case DemonBuilding.BUILDING_HOUSE: - this.createRandomHouse(tier); - break; + return this.createRandomHouse(tier); case DemonBuilding.BUILDING_PORTAL: - this.createPortalBuilding(tier); - break; + return this.createPortalBuilding(tier); } + + return 0; } - public void createPortalBuilding(int buildingTier) + public int createPortalBuilding(int buildingTier) { int x = 0; int z = 0; @@ -797,7 +833,7 @@ public class TEDemonPortal extends TileEntity if(directions.isEmpty()) { - return; + return 0; } HashMap> schemMap = new HashMap(); @@ -823,7 +859,7 @@ public class TEDemonPortal extends TileEntity if(schemMap.keySet().isEmpty()) { - return; + return 0; } ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())]; @@ -847,9 +883,11 @@ public class TEDemonPortal extends TileEntity build.buildAll(worldObj, xCoord + (x)*5, yLevel, zCoord + (z)*5, chosenDirection.getOpposite()); build.setAllGridSpaces(x, z, yLevel, chosenDirection.getOpposite(), GridSpace.MAIN_PORTAL, grid); this.loadGSH(grid); + + return build.getNumberOfGridSpaces(); } - public void createRandomHouse(int buildingTier) + public int createRandomHouse(int buildingTier) { int next = rand.nextInt(4); ForgeDirection dir; @@ -872,8 +910,6 @@ public class TEDemonPortal extends TileEntity dir = ForgeDirection.NORTH; } - int length = 5; - boolean newProtocol = true; if(newProtocol) @@ -890,7 +926,7 @@ public class TEDemonPortal extends TileEntity if(!this.getGridSpace(x, z).isRoadSegment()) { - return; + return 0; } List directions = new ArrayList(); @@ -906,7 +942,7 @@ public class TEDemonPortal extends TileEntity if(directions.isEmpty()) { - return; + return 0; } HashMap> schemMap = new HashMap(); @@ -942,7 +978,7 @@ public class TEDemonPortal extends TileEntity if(schemMap.keySet().isEmpty()) { - return; + return 0; } ForgeDirection chosenDirection = (ForgeDirection) schemMap.keySet().toArray()[new Random().nextInt(schemMap.keySet().size())]; @@ -956,6 +992,8 @@ public class TEDemonPortal extends TileEntity build.buildAll(worldObj, xCoord + (x + xOff)*5, yLevel, zCoord + (z + zOff)*5, chosenDirection.getOpposite()); build.setAllGridSpaces(x + xOff, z + zOff, yLevel, chosenDirection.getOpposite(), GridSpace.HOUSE, grid); this.loadGSH(grid); + + return build.getNumberOfGridSpaces(); }else { Int3 space = findEmptySpaceNearRoad(dir, 3*(rand.nextInt(negXRadius + negZRadius + posXRadius + posZRadius))+1, 2); @@ -967,12 +1005,12 @@ public class TEDemonPortal extends TileEntity GridSpace newSpace = this.getGridSpace(x, z); if(!newSpace.isEmpty()) { - return; + return 0; } if(yLevel == -1) { - return; + return 0; } GridSpaceHolder grid = this.createGSH(); @@ -1012,7 +1050,7 @@ public class TEDemonPortal extends TileEntity build = buildingList.get(new Random().nextInt(buildingList.size())); }else { - return; + return 0; } //TODO: Finish the selection algorythm //TODO: Should favour those directions that have a road right next to them. @@ -1021,7 +1059,8 @@ public class TEDemonPortal extends TileEntity build.setAllGridSpaces(x, z, yLevel, chosenDirection, GridSpace.HOUSE, grid); this.loadGSH(grid); - System.out.println("X: " + x + " Z: " + z + " Direction: " + chosenDirection.toString()); + return build.getNumberOfGridSpaces(); +// System.out.println("X: " + x + " Z: " + z + " Direction: " + chosenDirection.toString()); } } @@ -1091,34 +1130,6 @@ public class TEDemonPortal extends TileEntity return 10; } - public Block getRoadMarker() - { - return ModBlocks.ritualStone; - } - - public Int3 getNextRoadMarker() - { - int horizSearchMax = 25; - int vertSearchMax = 10; - - for(int xPos=xCoord-horizSearchMax; xPos<=xCoord+horizSearchMax; xPos++) - { - for(int zPos=zCoord-horizSearchMax; zPos<=zCoord+horizSearchMax; zPos++) - { - for(int yPos=yCoord-vertSearchMax; yPos<=yCoord+vertSearchMax; yPos++) - { - Block block = worldObj.getBlock(xPos, yPos, zPos); - if(block == this.getRoadMarker()) - { - return new Int3(xPos,yPos,zPos); - } - } - } - } - - return null; - } - public int getRoadSpacer() { return 1; @@ -1177,4 +1188,14 @@ public class TEDemonPortal extends TileEntity } + + public int getTotalPoints() + { + return this.totalPoints; + } + + public void addToPoints(int addition) + { + this.totalPoints += addition; + } } diff --git a/1.7.2/main/resources/assets/alchemicalwizardry/lang/en_US.lang b/1.7.2/main/resources/assets/alchemicalwizardry/lang/en_US.lang index a550139b..510f46c9 100644 --- a/1.7.2/main/resources/assets/alchemicalwizardry/lang/en_US.lang +++ b/1.7.2/main/resources/assets/alchemicalwizardry/lang/en_US.lang @@ -130,7 +130,7 @@ item.bloodLightSigil.name=Sigil of the Blood Lamp item.itemComplexSpellCrystal.name=Complex Spell Crystal item.itemSigilOfSupression.name=Sigil of Supression item.itemSigilOfEnderSeverance.name=Sigil of Ender Severance -item.bucketLive.name=Bucket of Life +item.bucketLife.name=Bucket of Life item.bloodMagicBaseItem.QuartzRod.name=Quartz Rod item.bloodMagicBaseItem.EmptyCore.name=Empty Core item.bloodMagicBaseItem.MagicalesCable.name=Magicales Cable diff --git a/1.7.2/main/resources/assets/alchemicalwizardry/schematics/building/buildings.zip b/1.7.2/main/resources/assets/alchemicalwizardry/schematics/building/buildings.zip index 88db9bbc..795c7595 100644 Binary files a/1.7.2/main/resources/assets/alchemicalwizardry/schematics/building/buildings.zip and b/1.7.2/main/resources/assets/alchemicalwizardry/schematics/building/buildings.zip differ