diff --git a/build.properties b/build.properties index 478beec6..2b172ecc 100644 --- a/build.properties +++ b/build.properties @@ -1,12 +1,12 @@ # -#Wed Apr 15 20:03:49 EDT 2015 +#Thu Apr 16 11:30:08 EDT 2015 mod_name=BloodMagic forge_version=10.13.2.1232 ccc_version=1.0.4.29 nei_version=1.0.3.64 //=Dependency Information package_group=com.wayoftime.bloodmagic -mod_version=1.3.2Beta +mod_version=1.3.2 minetweaker_version=Dev-1.7.10-3.0.9B +build_number=1 mc_version=1.7.10 -build_number=9 diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 031de44d..a98d16e2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -1390,7 +1390,7 @@ public class AlchemicalWizardry Rituals.registerRitual("AW032Symmetry", 2, 15000000, new RitualEffectOmegaTest(), "Symmetry of the Omega"); Rituals.registerRitual("AW033Stalling", 2, 15000000, new RitualEffectOmegaStalling(), "Duet of the Fused Souls"); - Rituals.registerRitual("AW034", 2, 100, new RitualEffectCrafting(), "Ritual of Teh Crafts"); + Rituals.registerRitual("AW034Crafting", 1, 15000, new RitualEffectCrafting(), "Rhythm of the Beating Anvil"); Rituals.registerRitual("AW035", 1, 10000, new RitualEffectItemRouting(), "Orchestra of the Phantom Hands"); //Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock")); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index d0108cae..3d809346 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -187,6 +187,7 @@ public class AlchemicalWizardryEventHooks if(reagentAmount > 0 && OmegaRegistry.hasParadigm(reagent)) { int cooldown = APISpellHelper.getPlayerReagentRegenCooldownTag(player); + boolean canHealHPBar = true; if(cooldown > 0) { float extra = 0; @@ -203,55 +204,60 @@ public class AlchemicalWizardryEventHooks int deduction = - 1 - (extra >= 0 ? (rand.nextFloat() < extra ? 1 : 0) : (rand.nextFloat() < -extra/2 ? -1 : 0)); APISpellHelper.setPlayerReagentRegenCooldownTag(player, Math.max(cooldown + deduction, 0)); - return; + canHealHPBar = false; } + OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent); ReagentRegenConfiguration config = parad.getRegenConfig(player); if(parad.isPlayerWearingFullSet(player)) { - int tickRate = config.tickRate; - - if(player.isPotionActive(Potion.regeneration)) + if(canHealHPBar) { - int i = player.getActivePotionEffect(Potion.regeneration).getAmplifier(); - double factor = Math.pow(1.5, i+1); - tickRate = Math.max((int)(tickRate / factor), 1); - } - - if(event.entityLiving.worldObj.getWorldTime() % tickRate == 0) - { - boolean hasHealthChanged = false; - int maxHealth = parad.getMaxAdditionalHealth(); + int tickRate = config.tickRate; - float health = APISpellHelper.getCurrentAdditionalHP(player); - - if(health > maxHealth) + if(player.isPotionActive(Potion.regeneration)) { - health = maxHealth; - hasHealthChanged = true; - }else if(health < maxHealth) - { - float addedAmount = Math.min(Math.min((reagentAmount / config.costPerPoint), config.healPerTick), maxHealth - health); - float drain = addedAmount * config.costPerPoint; - - reagentAmount -= drain; - hasReagentChanged = true; - - health += addedAmount; - - hasHealthChanged = true; + int i = player.getActivePotionEffect(Potion.regeneration).getAmplifier(); + double factor = Math.pow(1.5, i+1); + tickRate = Math.max((int)(tickRate / factor), 1); } - if(player instanceof EntityPlayerMP) + if(event.entityLiving.worldObj.getWorldTime() % tickRate == 0) { - if(hasHealthChanged) + boolean hasHealthChanged = false; + int maxHealth = parad.getMaxAdditionalHealth(); + + float health = APISpellHelper.getCurrentAdditionalHP(player); + + if(health > maxHealth) { - APISpellHelper.setCurrentAdditionalHP(player, health); - NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(health, maxHealth), (EntityPlayerMP)player); + health = maxHealth; + hasHealthChanged = true; + }else if(health < maxHealth) + { + float addedAmount = Math.min(Math.min((reagentAmount / config.costPerPoint), config.healPerTick), maxHealth - health); + float drain = addedAmount * config.costPerPoint; + + reagentAmount -= drain; + hasReagentChanged = true; + + health += addedAmount; + + hasHealthChanged = true; + } + + if(player instanceof EntityPlayerMP) + { + if(hasHealthChanged) + { + APISpellHelper.setCurrentAdditionalHP(player, health); + NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(health, maxHealth), (EntityPlayerMP)player); + } } } } + }else { reagentAmount = 0; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java index 5350fa63..16ac3581 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java @@ -83,123 +83,9 @@ public class BlockOrientable extends BlockContainer return true; } - public int getTextureIndexForSideAndOrientation(int side, ForgeDirection input, ForgeDirection output) - { - if (ForgeDirection.getOrientation(side) == input) - { - return 0; - } - if (ForgeDirection.getOrientation(side) == output) - { - return 1; - } - if (ForgeDirection.getOrientation(side) == output.getOpposite()) - { - return 6; - } - - switch (side) - { - case 0: //BOTTOM - switch (output) - { - case NORTH: - return 2; //UP - case SOUTH: - return 3; //DOWN - case EAST: - return 4; //LEFT - case WEST: - return 5; //RIGHT - default: - break; - } - break; - case 1: //TOP - switch (output) - { - case NORTH: - return 2; //UP - case SOUTH: - return 3; //DOWN - case EAST: - return 5; - case WEST: - return 4; - default: - break; - } - break; - case 2: //NORTH - switch (output) - { - case DOWN: - return 3; - case UP: - return 2; - case EAST: - return 4; - case WEST: - return 5; - default: - break; - } - break; - case 3: //SOUTH - switch (output) - { - case DOWN: - return 3; - case UP: - return 2; - case EAST: - return 5; - case WEST: - return 4; - default: - break; - } - break; - case 4: //WEST - switch (output) - { - case DOWN: - return 3; - case UP: - return 2; - case NORTH: - return 5; - case SOUTH: - return 4; - default: - break; - } - break; - case 5: //EAST - switch (output) - { - case DOWN: - return 3; - case UP: - return 2; - case NORTH: - return 4; - case SOUTH: - return 5; - default: - break; - } - break; - } - - return 0; - } - @Override public int damageDropped(int metadata) { return metadata; } - - } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java index 08e0d294..2faf341b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/energy/ItemTankSegmenter.java @@ -213,7 +213,7 @@ public class ItemTankSegmenter extends Item implements IReagentManipulator numberAssigned = 0; } - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.tanksegmenter.nowhas") + " " + numberAssigned + " " + "message.tanksegmenter.tankssetto" + " " + reagent.name)); + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.tanksegmenter.nowhas") + " " + numberAssigned + " " + StatCollector.translateToLocal("message.tanksegmenter.tankssetto") + " " + reagent.name)); reagentHandler.setTanksTunedToReagent(reagent, numberAssigned); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java index 1e7a9fc2..4e86f944 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectCrafting.java @@ -13,11 +13,13 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; import WayofTime.alchemicalWizardry.api.Int3; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; import WayofTime.alchemicalWizardry.api.rituals.RitualComponent; import WayofTime.alchemicalWizardry.api.rituals.RitualEffect; @@ -27,12 +29,15 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; public class RitualEffectCrafting extends RitualEffect { public static final boolean isTesting = false; - public static final boolean limitToSingleStack = false; + public static final boolean limitToSingleStack = true; public static final int potentiaDrain = 2; + public static final int virtusDrain = 2; @Override public void performEffect(IMasterRitualStone ritualStone) { +// long startTime = System.nanoTime(); + String owner = ritualStone.getOwner(); int currentEssence = SoulNetworkHandler.getCurrentEssence(owner); @@ -41,7 +46,9 @@ public class RitualEffectCrafting extends RitualEffect int y = ritualStone.getYCoord(); int z = ritualStone.getZCoord(); - if(world.getWorldTime() % 1 != 0) + boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); + + if(world.getWorldTime() % (hasPotentia ? 1 : 4) != 0) { return; } @@ -51,7 +58,23 @@ public class RitualEffectCrafting extends RitualEffect SoulNetworkHandler.causeNauseaToPlayer(owner); } else { - int slotDesignation = 0; + NBTTagCompound tag = ritualStone.getCustomRitualTag(); + + if(tag == null) + { + ritualStone.setCustomRitualTag(new NBTTagCompound()); + tag = ritualStone.getCustomRitualTag(); + } + + boolean lastFailed = tag.getBoolean("didLastCraftFail"); + + int slotDesignation = tag.getInteger("slotDesignation"); + if(lastFailed) + { + slotDesignation++; + tag.setInteger("slotDesignation", slotDesignation); + tag.setBoolean("didLastCraftFail", false); + } int direction = ritualStone.getDirection(); boolean canContinue = false; @@ -69,11 +92,13 @@ public class RitualEffectCrafting extends RitualEffect { for(int j=-1; j<=1; j++) { - TileEntity inv = world.getTileEntity(x + j, y + 2, z + i); + int gridSpace = (i+1)*3 + (j+1); + + Int3 pos = this.getSlotPositionForDirection(gridSpace, direction); + TileEntity inv = world.getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord); if(inv instanceof IInventory) { - int gridSpace = (i+1)*3 + (j+1); - if(((IInventory) inv).getSizeInventory() < slotDesignation || !((IInventory) inv).isItemValidForSlot(slotDesignation, ((IInventory) inv).getStackInSlot(slotDesignation))) + if(((IInventory) inv).getSizeInventory() <= slotDesignation || !((IInventory) inv).isItemValidForSlot(slotDesignation, ((IInventory) inv).getStackInSlot(slotDesignation))) { continue; }else @@ -92,13 +117,21 @@ public class RitualEffectCrafting extends RitualEffect if(!canContinue) { + tag.setInteger("slotDesignation", 0); return; } ItemStack returnStack = CraftingManager.getInstance().findMatchingRecipe(inventory, world); - if (returnStack != null) + if (returnStack == null) { + tag.setBoolean("didLastCraftFail", true); + return; + }else + { + boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false); + boolean addOutputToInputs = hasVirtus; + IInventory outputInv = null; List invList = new ArrayList(); @@ -107,19 +140,119 @@ public class RitualEffectCrafting extends RitualEffect TileEntity southEntity = world.getTileEntity(x, y-1, z + 2); TileEntity eastEntity = world.getTileEntity(x + 2, y-1, z); TileEntity westEntity = world.getTileEntity(x - 2, y-1, z); - - if(southEntity instanceof IInventory) - { - outputInv = (IInventory)southEntity; - } - if(northEntity instanceof IInventory) + switch(direction) { - invList.add((IInventory)northEntity); + case 1: + if(southEntity instanceof IInventory) + { + outputInv = (IInventory)southEntity; + }else + { + return; + } + + if(northEntity instanceof IInventory) + { + invList.add((IInventory)northEntity); + } + if(eastEntity instanceof IInventory) + { + invList.add((IInventory)eastEntity); + } + if(westEntity instanceof IInventory) + { + invList.add((IInventory)westEntity); + } + + break; + + case 2: + if(westEntity instanceof IInventory) + { + outputInv = (IInventory)westEntity; + }else + { + return; + } + + if(northEntity instanceof IInventory) + { + invList.add((IInventory)northEntity); + } + if(eastEntity instanceof IInventory) + { + invList.add((IInventory)eastEntity); + } + if(southEntity instanceof IInventory) + { + invList.add((IInventory)southEntity); + } + + break; + + case 3: + if(northEntity instanceof IInventory) + { + outputInv = (IInventory)northEntity; + }else + { + return; + } + + if(eastEntity instanceof IInventory) + { + invList.add((IInventory)eastEntity); + } + if(southEntity instanceof IInventory) + { + invList.add((IInventory)southEntity); + } + if(westEntity instanceof IInventory) + { + invList.add((IInventory)westEntity); + } + + break; + + case 4: + if(eastEntity instanceof IInventory) + { + outputInv = (IInventory)eastEntity; + }else + { + return; + } + + if(northEntity instanceof IInventory) + { + invList.add((IInventory)northEntity); + } + if(southEntity instanceof IInventory) + { + invList.add((IInventory)southEntity); + } + if(westEntity instanceof IInventory) + { + invList.add((IInventory)westEntity); + } + + break; } - if (outputInv != null && (!limitToSingleStack ? SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN) : SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN, true, returnStack.getMaxStackSize()))) + if (outputInv != null) { + if(!(!limitToSingleStack ? SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN) : SpellHelper.canInsertStackFullyIntoInventory(returnStack, outputInv, ForgeDirection.DOWN, true, returnStack.getMaxStackSize()))) + { + tag.setBoolean("didLastCraftFail", true); + return; + } + + if(addOutputToInputs) + { + invList.add(outputInv); + } + Map> syphonMap = new HashMap(); //Inventory, Slot, how much claimed for(int n = 0; n < recipe.length; n++) //Look for the correct items @@ -159,14 +292,13 @@ public class RitualEffectCrafting extends RitualEffect if(this.areItemsEqualForCrafting(recipeStack, invItem)) { - System.out.println("Item is equal and valid"); //TODO inventory.setInventorySlotContents(n, invItem); - ItemStack returnedStack = CraftingManager.getInstance().findMatchingRecipe(inventory, world); - if(returnedStack == null || returnedStack.getItem() == null || returnedStack.getItem() != returnStack.getItem()) - { - continue; - } +// ItemStack returnedStack = CraftingManager.getInstance().findMatchingRecipe(inventory, world); +// if(returnedStack == null || returnedStack.getItem() == null || returnedStack.getItem() != returnStack.getItem()) +// { +// continue; +// } Map slotMap = syphonMap.get(i); if(slotMap == null) { @@ -195,15 +327,13 @@ public class RitualEffectCrafting extends RitualEffect if(!isItemTaken) { -// System.out.println("Item is not available!"); + tag.setBoolean("didLastCraftFail", true); return; } } /* The recipe is valid and the items have been found */ - - System.out.println("Valid!"); - + SpellHelper.insertStackIntoInventory(CraftingManager.getInstance().findMatchingRecipe(inventory, world), outputInv, ForgeDirection.DOWN); for(Entry> entry1 : syphonMap.entrySet()) @@ -224,16 +354,30 @@ public class RitualEffectCrafting extends RitualEffect inputInv.setInventorySlotContents(entry2.getKey(), null); } } - } } + + if(addOutputToInputs && syphonMap.containsKey(invList.size())) + { + this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, true); + } SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh()); + if(hasPotentia) + { + this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); + } + world.markBlockForUpdate(x, y-1, z + 2); world.markBlockForUpdate(x, y-1, z - 2); world.markBlockForUpdate(x + 2, y-1, z); world.markBlockForUpdate(x - 2, y-1, z); + +// long endTime = System.nanoTime(); +// +// long duration = (endTime - startTime); //divide by 1000000 to get milliseconds. +// System.out.println("(Total) method time in ms: " + (float)(duration)/1000000.0); } } } @@ -242,7 +386,7 @@ public class RitualEffectCrafting extends RitualEffect @Override public int getCostPerRefresh() { - return 0; + return 10; } @Override @@ -266,20 +410,15 @@ public class RitualEffectCrafting extends RitualEffect public boolean areItemsEqualForCrafting(ItemStack stack1, ItemStack stack2) { - if (stack1 == null) - { - return false; - } - - if (stack2 == null) - { - return true; - } - - if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable()) + if (stack1 == null || stack2 == null) { return false; } +// +// if (stack1.isItemStackDamageable() ^ stack2.isItemStackDamageable()) +// { +// return false; +// } return stack1.getItem() == stack2.getItem() && (stack1.getItem().getHasSubtypes() ? stack1.getItemDamage() == stack2.getItemDamage() : true); } @@ -298,11 +437,11 @@ public class RitualEffectCrafting extends RitualEffect case 1: //NORTH-facing return new Int3(x, 2, z); case 2: //EAST-facing - return new Int3(-z, 2, x); + return new Int3(z, 2, -x); case 3: //SOUTH-facing return new Int3(-x, 2, -z); case 4: //WEST-facing - return new Int3(z, 2, -x); + return new Int3(-z, 2, x); } return new Int3(0,0,0); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java index b6fe5c99..f7ef0e5b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectWellOfSuffering.java @@ -22,6 +22,8 @@ public class RitualEffectWellOfSuffering extends RitualEffect public static final int amount = 10; private static final int tennebraeDrain = 5; + private static final int potentiaDrain = 10; + private static final int offensaDrain = 3; @Override public void performEffect(IMasterRitualStone ritualStone) @@ -61,14 +63,17 @@ public class RitualEffectWellOfSuffering extends RitualEffect { return; } + + boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false); int d0 = 10; - int vertRange = 10; + int vertRange = hasPotentia ? 20 : 10; AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) x, (double) y, (double) z, (double) (x + 1), (double) (y + 1), (double) (z + 1)).expand(d0, vertRange, d0); List list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); int entityCount = 0; boolean hasTennebrae = this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, false); + boolean hasOffensa = this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, false); if (currentEssence < this.getCostPerRefresh() * list.size()) { @@ -82,16 +87,24 @@ public class RitualEffectWellOfSuffering extends RitualEffect continue; } - if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, 1)) + hasOffensa = hasOffensa && this.canDrainReagent(ritualStone, ReagentRegistry.offensaReagent, offensaDrain, true); + + if (livingEntity.attackEntityFrom(DamageSource.outOfWorld, hasOffensa ? 2 : 1)) { hasTennebrae = hasTennebrae && this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true); - + + entityCount++; - tileAltar.sacrificialDaggerCall(this.amount * (hasTennebrae ? 2 : 1), true); + tileAltar.sacrificialDaggerCall(this.amount * (hasTennebrae ? 2 : 1) * (hasOffensa ? 2 : 1), true); } } SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount); + + if(hasPotentia) + { + this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, true); + } } }