mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-21 20:42:28 +00:00
Add new rune to reduce the delay between crafts (#51)
* add layout.json to gitignore * Add quickness rune This rune reduces the delay between consecutive crafts. This is done by essentially scheduling a recipe check every time a recipe completes. Using something like a world accelerator will have no effect on the frequency and the runes themselves do not increase the frequency at which the altar naturally checks for updates. This commit also addresses a couple other issues with the altar. - since the altar was using the world time and not the world age, some mechanics were impossible to trigger if you set doDaylightCycle to false. - For example it was impossible to start a craft if the time wasn't set to a multiple of 100.
This commit is contained in:
1 parent
0b70f3ed51
commit
e14b1f23c9
15 files changed
+113
-13
No files matched your search
@@ -766,6 +766,7 @@ public class AlchemicalWizardry {
|
||||
ItemStack bloodRuneCraftedStack = new ItemStack(ModBlocks.bloodRune, 1);
|
||||
ItemStack bloodRuneStack = new ItemStack(ModBlocks.bloodRune);
|
||||
ItemStack speedRuneStack = new ItemStack(ModBlocks.speedRune);
|
||||
ItemStack accelerationRuneStack = new ItemStack(ModBlocks.bloodRune, 1, 5);
|
||||
ItemStack runeOfSacrificeStack = new ItemStack(ModBlocks.runeOfSacrifice);
|
||||
ItemStack runeOfSelfSacrificeStack = new ItemStack(ModBlocks.runeOfSelfSacrifice);
|
||||
ItemStack miningSigilStackCrafted = new ItemStack(ModItems.sigilOfTheFastMiner);
|
||||
@@ -2425,6 +2426,21 @@ public class AlchemicalWizardry {
|
||||
'o',
|
||||
obsidianStack));
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedBloodOrbRecipe(
|
||||
new ItemStack(ModBlocks.bloodRune, 1, 6),
|
||||
"eae",
|
||||
"sos",
|
||||
"eae",
|
||||
'e',
|
||||
etherealSlateStack,
|
||||
's',
|
||||
speedRuneStack,
|
||||
'a',
|
||||
accelerationRuneStack,
|
||||
'o',
|
||||
archmageBloodOrbStack));
|
||||
|
||||
AlchemyRecipeRegistry.registerRecipe(
|
||||
crackedRunicPlateStackCrafted,
|
||||
10,
|
||||
|
||||
@@ -611,35 +611,40 @@ public class BloodMagicConfiguration {
|
||||
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
|
||||
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
|
||||
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) });
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
|
||||
new BlockStack(ModBlocks.bloodRune, 6) });
|
||||
AlchemicalWizardry.thirdTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
|
||||
"thirdTier",
|
||||
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
|
||||
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
|
||||
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
|
||||
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) });
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
|
||||
new BlockStack(ModBlocks.bloodRune, 6) });
|
||||
AlchemicalWizardry.fourthTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
|
||||
"fourthTier",
|
||||
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
|
||||
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
|
||||
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
|
||||
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) });
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
|
||||
new BlockStack(ModBlocks.bloodRune, 6) });
|
||||
AlchemicalWizardry.fifthTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
|
||||
"fifthTier",
|
||||
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
|
||||
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
|
||||
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
|
||||
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) });
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
|
||||
new BlockStack(ModBlocks.bloodRune, 6) });
|
||||
AlchemicalWizardry.sixthTierRunes = BloodMagicConfiguration.getAltarRunesForTier(
|
||||
"sixthTier",
|
||||
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0),
|
||||
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
|
||||
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1),
|
||||
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5) });
|
||||
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5),
|
||||
new BlockStack(ModBlocks.bloodRune, 6) });
|
||||
AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier(
|
||||
"specialBlocks",
|
||||
new BlockStack[] { new BlockStack(Blocks.stonebrick, 0), new BlockStack(Blocks.glowstone, 0),
|
||||
|
||||
@@ -33,6 +33,9 @@ public class BloodRune extends Block {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon accelerationRuneIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon quicknessRuneIcon;
|
||||
|
||||
public BloodRune() {
|
||||
super(Material.iron);
|
||||
this.setBlockName("bloodRune");
|
||||
@@ -50,6 +53,7 @@ public class BloodRune extends Block {
|
||||
this.orbCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:OrbCapacityRune");
|
||||
this.betterCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:BetterCapacityRune");
|
||||
this.accelerationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AccelerationRune");
|
||||
this.quicknessRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:QuicknessRune");
|
||||
}
|
||||
|
||||
public int getRuneEffect(int metaData) {
|
||||
@@ -71,6 +75,9 @@ public class BloodRune extends Block {
|
||||
|
||||
case 5: // Acceleration rune
|
||||
return 9;
|
||||
|
||||
case 6: // Quickness Rune
|
||||
return 10;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -89,6 +96,7 @@ public class BloodRune extends Block {
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 5));
|
||||
par3List.add(new ItemStack(par1, 1, 6));
|
||||
} else {
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
@@ -115,6 +123,10 @@ public class BloodRune extends Block {
|
||||
|
||||
case 5:
|
||||
return this.accelerationRuneIcon;
|
||||
|
||||
case 6:
|
||||
return this.quicknessRuneIcon;
|
||||
|
||||
default:
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
+10
@@ -11,6 +11,7 @@ public class AltarUpgradeComponent {
|
||||
private int orbCapacitiveUpgrades;
|
||||
private int betterCapacitiveUpgrades;
|
||||
private int accelerationUpgrades;
|
||||
private int quicknessUpgrades;
|
||||
|
||||
public AltarUpgradeComponent() {
|
||||
speedUpgrades = 0;
|
||||
@@ -22,6 +23,7 @@ public class AltarUpgradeComponent {
|
||||
orbCapacitiveUpgrades = 0;
|
||||
betterCapacitiveUpgrades = 0;
|
||||
accelerationUpgrades = 0;
|
||||
quicknessUpgrades = 0;
|
||||
}
|
||||
|
||||
public void addSpeedUpgrade() {
|
||||
@@ -60,6 +62,10 @@ public class AltarUpgradeComponent {
|
||||
accelerationUpgrades++;
|
||||
}
|
||||
|
||||
public void addQuicknessUpgrade() {
|
||||
quicknessUpgrades++;
|
||||
}
|
||||
|
||||
public int getSpeedUpgrades() {
|
||||
return speedUpgrades;
|
||||
}
|
||||
@@ -95,4 +101,8 @@ public class AltarUpgradeComponent {
|
||||
public int getAccelerationUpgrades() {
|
||||
return this.accelerationUpgrades;
|
||||
}
|
||||
|
||||
public int getQuicknessUpgrades() {
|
||||
return this.quicknessUpgrades;
|
||||
}
|
||||
}
|
||||
+4
@@ -142,6 +142,10 @@ public class UpgradedAltars {
|
||||
case 9:
|
||||
upgrades.addAccelerationUpgrade();
|
||||
break;
|
||||
|
||||
case 10:
|
||||
upgrades.addQuicknessUpgrade();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,6 +410,12 @@ public class BloodMagicGuide {
|
||||
PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.accelerationRune")));
|
||||
entries.add(new EntryUniText(accelerationRunePages, "guide.BloodMagic.entryName.architect.accelerationRune"));
|
||||
|
||||
ArrayList<IPage> quicknessRuneRecipe = new ArrayList();
|
||||
demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.quicknessRuneRecipe));
|
||||
quicknessRuneRecipe.addAll(
|
||||
PageHelper.pagesForLongText(StatCollector.translateToLocal("aw.entries.architect.quicknessRune")));
|
||||
entries.add(new EntryUniText(quicknessRuneRecipe, "guide.BloodMagic.entryName.architect.quicknessRune"));
|
||||
|
||||
ArrayList<IPage> harvestPages = new ArrayList();
|
||||
demonicOrbPages.add(getOrbPageForRecipe(RecipeHolder.harvestSigilRecipe));
|
||||
harvestPages
|
||||
|
||||
@@ -58,6 +58,7 @@ public class RecipeHolder {
|
||||
public static IRecipe keyOfBindingRecipe;
|
||||
public static IRecipe energyBazookaRecipe;
|
||||
public static IRecipe accelerationRuneRecipe;
|
||||
public static IRecipe quicknessRuneRecipe;
|
||||
public static IRecipe harvestSigilRecipe;
|
||||
public static IRecipe crystalCluserRecipe;
|
||||
public static IRecipe arcanePlinthRecipe;
|
||||
@@ -152,6 +153,7 @@ public class RecipeHolder {
|
||||
harvestSigilRecipe = getRecipeForItemStack(new ItemStack(ModItems.itemHarvestSigil));
|
||||
crystalCluserRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockCrystal));
|
||||
weakRitualStoneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.imperfectRitualStone));
|
||||
quicknessRuneRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.bloodRune, 1, 6));
|
||||
|
||||
arcanePlinthRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPlinth));
|
||||
arcanePedestalRecipe = getRecipeForItemStack(new ItemStack(ModBlocks.blockPedestal));
|
||||
|
||||
@@ -41,6 +41,10 @@ public class ItemBloodRuneBlock extends ItemBlock {
|
||||
name = "acceleration";
|
||||
break;
|
||||
|
||||
case 6:
|
||||
name = "quickness";
|
||||
break;
|
||||
|
||||
default:
|
||||
name = "broken";
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar, IBloodMagicWailaProvider {
|
||||
|
||||
public static final int sizeInv = 1;
|
||||
public static final int BASE_RECIPE_DELAY = 100;
|
||||
public static final double CRAFTING_DELAY_RUNE_EFFICIENCY = 0.8D;
|
||||
|
||||
private int resultID;
|
||||
private int resultDamage;
|
||||
@@ -70,6 +72,8 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
protected FluidStack fluidOutput;
|
||||
protected FluidStack fluidInput;
|
||||
private int progress;
|
||||
private long nextForcedRecipeCheck;
|
||||
private int maxDelayBeforeNextCraft;
|
||||
|
||||
private int lockdownDuration;
|
||||
private int demonBloodDuration;
|
||||
@@ -97,6 +101,8 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
progress = 0;
|
||||
this.lockdownDuration = 0;
|
||||
this.demonBloodDuration = 0;
|
||||
this.nextForcedRecipeCheck = -1;
|
||||
this.maxDelayBeforeNextCraft = BASE_RECIPE_DELAY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,7 +453,9 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
return;
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0) {
|
||||
final long totalWorldTime = worldObj.getTotalWorldTime();
|
||||
|
||||
if (totalWorldTime % 20 == 0) {
|
||||
{
|
||||
Block block = worldObj.getBlock(xCoord + 1, yCoord, zCoord);
|
||||
block.onNeighborBlockChange(worldObj, xCoord + 1, yCoord, zCoord, block);
|
||||
@@ -496,7 +504,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
// }
|
||||
}
|
||||
|
||||
if (worldObj.getWorldTime() % Math.max(20 - this.accelerationUpgrades, 1) == 0) {
|
||||
if (totalWorldTime % Math.max(20 - this.accelerationUpgrades, 1) == 0) {
|
||||
int syphonMax = (int) (20 * this.dislocationMultiplier);
|
||||
int fluidInputted = 0;
|
||||
int fluidOutputted = 0;
|
||||
@@ -510,7 +518,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
this.fluid.amount -= fluidOutputted;
|
||||
}
|
||||
|
||||
if (worldObj.getWorldTime() % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0)) {
|
||||
if (shouldTryToStartCycle(totalWorldTime) && (this.isActive || this.cooldownAfterCrafting <= 0)) {
|
||||
startCycle();
|
||||
}
|
||||
|
||||
@@ -525,8 +533,6 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
return;
|
||||
}
|
||||
|
||||
int worldTime = (int) (worldObj.getWorldTime() % 24000);
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
@@ -545,7 +551,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
fluid.amount = fluid.amount - liquidDrained;
|
||||
progress += liquidDrained;
|
||||
|
||||
if (worldTime % 4 == 0) {
|
||||
if (totalWorldTime % 4 == 0) {
|
||||
SpellHelper.sendIndexedParticleToAllAround(
|
||||
worldObj,
|
||||
xCoord,
|
||||
@@ -583,11 +589,14 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
zCoord + 0.5f);
|
||||
}
|
||||
this.isActive = false;
|
||||
if (this.nextForcedRecipeCheck < 0) {
|
||||
this.nextForcedRecipeCheck = this.worldObj.getTotalWorldTime() + this.maxDelayBeforeNextCraft;
|
||||
}
|
||||
}
|
||||
} else if (progress > 0) {
|
||||
progress -= (int) (efficiencyMultiplier * drainRate);
|
||||
|
||||
if (worldTime % 2 == 0) {
|
||||
if (totalWorldTime % 2 == 0) {
|
||||
SpellHelper.sendIndexedParticleToAllAround(
|
||||
worldObj,
|
||||
xCoord,
|
||||
@@ -633,7 +642,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
|
||||
fluid.amount = fluid.amount - drain;
|
||||
|
||||
if (worldTime % 4 == 0) {
|
||||
if (totalWorldTime % 4 == 0) {
|
||||
SpellHelper.sendIndexedParticleToAllAround(
|
||||
worldObj,
|
||||
xCoord,
|
||||
@@ -653,6 +662,23 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldTryToStartCycle(final long totalWorldTime) {
|
||||
// use total time instead of world time so that we can update even if doDaylightCycle is false
|
||||
if (!this.isActive && this.nextForcedRecipeCheck >= 0) {
|
||||
if (this.nextForcedRecipeCheck <= totalWorldTime) {
|
||||
this.nextForcedRecipeCheck = -1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// if the regular recipe check occurs before the forced recipe check we can just un-schedule it.
|
||||
if (totalWorldTime % BASE_RECIPE_DELAY == 0) {
|
||||
this.nextForcedRecipeCheck = -1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setActive() {
|
||||
isActive = false;
|
||||
}
|
||||
@@ -771,6 +797,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
this.orbCapacityMultiplier = 1;
|
||||
this.dislocationMultiplier = 1;
|
||||
this.accelerationUpgrades = 0;
|
||||
this.maxDelayBeforeNextCraft = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -788,6 +815,7 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
this.dislocationMultiplier = 1;
|
||||
this.upgradeLevel = upgradeState;
|
||||
this.accelerationUpgrades = 0;
|
||||
this.maxDelayBeforeNextCraft = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -804,6 +832,10 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
|
||||
this.capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier);
|
||||
this.bufferCapacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 1 * capacityMultiplier);
|
||||
this.accelerationUpgrades = upgrades.getAccelerationUpgrades();
|
||||
this.maxDelayBeforeNextCraft = Math.max(
|
||||
1,
|
||||
(int) Math.floor(
|
||||
BASE_RECIPE_DELAY * Math.pow(CRAFTING_DELAY_RUNE_EFFICIENCY, upgrades.getQuicknessUpgrades())));
|
||||
|
||||
if (this.fluid.amount > this.capacity) {
|
||||
this.fluid.amount = this.capacity;
|
||||
|
||||
Reference in new issue
Block a user