From 8315dcf86450924f2f3b419ca1116510b69fd7c9 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sun, 11 Jan 2015 21:19:49 -0500 Subject: [PATCH] Added demon limit to config - maximum number of demons that may spawn for a Demon Portal --- .../AlchemicalWizardry.java | 5 +- .../BloodMagicConfiguration.java | 1 + .../tileEntity/TEDemonPortal.java | 13 ++-- .../common/items/armour/OmegaArmour.java | 60 ++----------------- .../common/omega/OmegaParadigm.java | 6 ++ .../spell/simple/SpellLightningBolt.java | 8 ++- 6 files changed, 29 insertions(+), 64 deletions(-) diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index bd50322d..5ef4195c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -113,9 +113,8 @@ import WayofTime.alchemicalWizardry.common.harvest.PamHarvestCompatRegistry; import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner; import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding; import WayofTime.alchemicalWizardry.common.items.thaumcraft.ItemSanguineArmour; -import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigmWater; import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; -import WayofTime.alchemicalWizardry.common.omega.ReagentRegenConfiguration; import WayofTime.alchemicalWizardry.common.potion.PotionBoost; import WayofTime.alchemicalWizardry.common.potion.PotionDeaf; import WayofTime.alchemicalWizardry.common.potion.PotionDemonCloak; @@ -1311,7 +1310,7 @@ public class AlchemicalWizardry ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 7), new ReagentStack(ReagentRegistry.reductusReagent, 1000)); ReagentRegistry.registerItemAndReagent(new ItemStack(ModItems.baseAlchemyItems, 1, 8), new ReagentStack(ReagentRegistry.potentiaReagent, 1000)); - OmegaRegistry.registerParadigm(ReagentRegistry.aquasalusReagent, new OmegaParadigm(ReagentRegistry.aquasalusReagent, ModItems.boundHelmetWater, ModItems.boundPlateWater, ModItems.boundLeggingsWater, ModItems.boundBootsWater, new ReagentRegenConfiguration(20, 10, 1))); + OmegaRegistry.registerParadigm(ReagentRegistry.aquasalusReagent, new OmegaParadigmWater(ModItems.boundHelmetWater, ModItems.boundPlateWater, ModItems.boundLeggingsWater, ModItems.boundBootsWater)); } public static void initDemonPacketRegistiry() diff --git a/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java b/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java index 20ecf663..7d5027f9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java +++ b/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java @@ -151,6 +151,7 @@ public class BloodMagicConfiguration DemonVillagePath.createBridgeInAirIfObstructed = config.get(tempDemonConfigs, "createBridgeInAirIfObstructed", false).getBoolean(); TEDemonPortal.limit = config.get(tempDemonConfigs, "demonGridSpaceLimit", 100).getInt(); + TEDemonPortal.demonLimit = config.get(tempDemonConfigs, "demonHoardLimit", 100).getInt(); AlchemicalWizardry.isDemonRitualCreativeOnly = config.get(tempDemonConfigs, "IsDemonRitualCreativeOnly", false).getBoolean(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java index 022b2e6f..bde97f35 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java @@ -50,6 +50,8 @@ public class TEDemonPortal extends TileEntity public static int limit = 100; + public static int demonLimit = 100; + public static int buildingGridDelay = 25; public static int roadGridDelay = 10; public static int demonHoardDelay = 40; @@ -412,12 +414,15 @@ public class TEDemonPortal extends TileEntity } } - if(this.demonHoardCooldown <= 0) + if(this.demonHoardCooldown <= 0) //TODO { - int complexityCost = this.createRandomDemonHoard(this, tier, this.type, this.isLockedDown()); - if(complexityCost > 0) + if(this.hoardList.size() <= demonLimit) { - this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost; + int complexityCost = this.createRandomDemonHoard(this, tier, this.type, this.isLockedDown()); + if(complexityCost > 0) + { + this.demonHoardCooldown += TEDemonPortal.demonHoardDelay * complexityCost; + } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java index 6af4d7e8..12e2d0ec 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java @@ -39,17 +39,11 @@ public abstract class OmegaArmour extends BoundArmour public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { super.onArmorTick(world, player, itemStack); -// -// if(world.getWorldTime() % 20 == 0 && !world.isRemote) -// { -// NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(ReagentRegistry.aquasalusReagent, this.getDuration(itemStack), 100), (EntityPlayerMP)player); -// } -// -// if(!this.decrementDuration(itemStack)) -// { -// ItemStack stack = this.getContainedArmourStack(itemStack); -// player.inventory.armorInventory[3-this.armorType] = stack; -// } + + if(this.armorType == 1) + { + paradigm.onUpdate(world, player, itemStack); + } } public void revertArmour(EntityPlayer player, ItemStack itemStack) @@ -63,7 +57,6 @@ public abstract class OmegaArmour extends BoundArmour ItemStack omegaStack = new ItemStack(this); this.setContainedArmourStack(omegaStack, boundStack); SoulNetworkHandler.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack)); - this.setItemDuration(omegaStack, 100); return omegaStack; } @@ -101,49 +94,6 @@ public abstract class OmegaArmour extends BoundArmour return armourStack; } - public void setItemDuration(ItemStack omegaStack, int duration) - { - NBTTagCompound tag = omegaStack.getTagCompound(); - if(tag == null) - { - tag = new NBTTagCompound(); - omegaStack.setTagCompound(tag); - } - - tag.setInteger("duration", duration); - } - - public int getDuration(ItemStack omegaStack) - { - if(omegaStack.hasTagCompound()) - { - return omegaStack.getTagCompound().getInteger("duration"); - }else - { - return 0; - } - } - - /** - * - * @param omegaStack - * @return true if there is duration left (duration > 0) - */ - public boolean decrementDuration(ItemStack omegaStack) - { - int duration = this.getDuration(omegaStack); - - if(duration > 0) - { - this.setItemDuration(omegaStack, duration - 1); - return true; - } - else - { - return false; - } - } - @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java index ae938ae4..b2680bff 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigm.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.omega; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.world.World; import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; @@ -83,4 +84,9 @@ public class OmegaParadigm return helmetStack != null && helmetStack.getItem() == helmet && chestStack != null && chestStack.getItem() == chestPiece && leggingsStack != null && leggingsStack.getItem() == leggings && bootsStack != null && bootsStack.getItem() == boots; } + + public void onUpdate(World world, EntityPlayer player, ItemStack stack) + { + + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java index ea63e871..5d6afb60 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/simple/SpellLightningBolt.java @@ -65,8 +65,12 @@ public class SpellLightningBolt extends HomSpell double yCoord = par3EntityPlayer.posY; double zCoord = par3EntityPlayer.posZ; par2World.getWorldInfo().setRaining(true); - par2World.setRainStrength(1.0f); - par2World.setThunderStrength(1.0f); + if(par2World.isRemote) + { + par2World.setRainStrength(1.0f); + par2World.setThunderStrength(1.0f); + } + par2World.getWorldInfo().setThunderTime(0); par2World.getWorldInfo().setThundering(true);