Added Charging rune and associated necessities, such as having the Seer's Sigil detect total charge.
This commit is contained in:
parent
142cefd9be
commit
318e3a03c7
|
@ -62,6 +62,11 @@ public class BloodAltar
|
|||
private int lockdownDuration;
|
||||
private int demonBloodDuration;
|
||||
|
||||
private int totalCharge = 0; //TODO save
|
||||
private int chargingRate = 0;
|
||||
private int chargingFrequency = 0;
|
||||
private int maxCharge = 0;
|
||||
|
||||
private int cooldownAfterCrafting = 500;
|
||||
|
||||
private ItemStack result;
|
||||
|
@ -181,6 +186,10 @@ public class BloodAltar
|
|||
case 9:
|
||||
upgrades.addAcceleration();
|
||||
break;
|
||||
|
||||
case 10:
|
||||
upgrades.addCharging();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +237,10 @@ public class BloodAltar
|
|||
accelerationUpgrades = tagCompound.getInteger(Constants.NBT.ALTAR_ACCELERATION_UPGRADES);
|
||||
demonBloodDuration = tagCompound.getInteger(Constants.NBT.ALTAR_DEMON_BLOOD_DURATION);
|
||||
cooldownAfterCrafting = tagCompound.getInteger(Constants.NBT.ALTAR_COOLDOWN_AFTER_CRAFTING);
|
||||
chargingRate = tagCompound.getInteger(Constants.NBT.ALTAR_CHARGE_RATE);
|
||||
chargingFrequency = tagCompound.getInteger(Constants.NBT.ALTAR_CHARGE_FREQUENCY);
|
||||
totalCharge = tagCompound.getInteger(Constants.NBT.ALTAR_TOTAL_CHARGE);
|
||||
maxCharge = tagCompound.getInteger(Constants.NBT.ALTAR_MAX_CHARGE);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound tagCompound)
|
||||
|
@ -267,6 +280,10 @@ public class BloodAltar
|
|||
tagCompound.setInteger(Constants.NBT.ALTAR_ACCELERATION_UPGRADES, accelerationUpgrades);
|
||||
tagCompound.setInteger(Constants.NBT.ALTAR_DEMON_BLOOD_DURATION, demonBloodDuration);
|
||||
tagCompound.setInteger(Constants.NBT.ALTAR_COOLDOWN_AFTER_CRAFTING, cooldownAfterCrafting);
|
||||
tagCompound.setInteger(Constants.NBT.ALTAR_CHARGE_RATE, chargingRate);
|
||||
tagCompound.setInteger(Constants.NBT.ALTAR_CHARGE_FREQUENCY, chargingFrequency);
|
||||
tagCompound.setInteger(Constants.NBT.ALTAR_TOTAL_CHARGE, totalCharge);
|
||||
tagCompound.setInteger(Constants.NBT.ALTAR_MAX_CHARGE, maxCharge);
|
||||
}
|
||||
|
||||
public void startCycle()
|
||||
|
@ -276,7 +293,7 @@ public class BloodAltar
|
|||
|
||||
checkTier();
|
||||
|
||||
if (fluid == null || fluid.amount <= 0)
|
||||
if ((fluid == null || fluid.amount <= 0) && totalCharge <= 0)
|
||||
return;
|
||||
|
||||
if (!isActive)
|
||||
|
@ -341,6 +358,14 @@ public class BloodAltar
|
|||
this.fluid.amount -= fluidOutputted;
|
||||
}
|
||||
|
||||
if (internalCounter % this.getChargingFrequency() == 0 && !this.isActive)
|
||||
{
|
||||
int chargeInputted = Math.min(chargingRate, this.fluid.amount);
|
||||
chargeInputted = Math.min(chargeInputted, maxCharge - totalCharge);
|
||||
totalCharge += chargeInputted;
|
||||
this.fluid.amount -= chargeInputted;
|
||||
}
|
||||
|
||||
if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0))
|
||||
startCycle();
|
||||
|
||||
|
@ -372,9 +397,24 @@ public class BloodAltar
|
|||
|
||||
if (!canBeFilled)
|
||||
{
|
||||
boolean hasOperated = false;
|
||||
int stackSize = tileAltar.getStackInSlot(0).stackSize;
|
||||
|
||||
if (totalCharge > 0)
|
||||
{
|
||||
System.out.println("Working...");
|
||||
System.out.println("Total charge: " + totalCharge);
|
||||
|
||||
int chargeDrained = Math.min(liquidRequired * stackSize - progress, totalCharge);
|
||||
|
||||
totalCharge -= chargeDrained;
|
||||
progress += chargeDrained;
|
||||
System.out.println("Progress: " + progress);
|
||||
|
||||
hasOperated = true;
|
||||
}
|
||||
if (fluid != null && fluid.amount >= 1)
|
||||
{
|
||||
int stackSize = tileAltar.getStackInSlot(0).stackSize;
|
||||
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
||||
|
||||
if (liquidDrained > (liquidRequired * stackSize - progress))
|
||||
|
@ -383,9 +423,21 @@ public class BloodAltar
|
|||
fluid.amount = fluid.amount - liquidDrained;
|
||||
progress += liquidDrained;
|
||||
|
||||
hasOperated = true;
|
||||
|
||||
if (internalCounter % 4 == 0)
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
|
||||
|
||||
} else if (!hasOperated && progress > 0)
|
||||
{
|
||||
progress -= (int) (efficiencyMultiplier * drainRate);
|
||||
|
||||
if (internalCounter % 2 == 0)
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
|
||||
}
|
||||
|
||||
if (hasOperated)
|
||||
{
|
||||
if (progress >= liquidRequired * stackSize)
|
||||
{
|
||||
ItemStack result = this.result;
|
||||
|
@ -401,12 +453,6 @@ public class BloodAltar
|
|||
|
||||
this.isActive = false;
|
||||
}
|
||||
} else if (progress > 0)
|
||||
{
|
||||
progress -= (int) (efficiencyMultiplier * drainRate);
|
||||
|
||||
if (internalCounter % 2 == 0)
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3);
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -461,6 +507,10 @@ public class BloodAltar
|
|||
this.orbCapacityMultiplier = 1;
|
||||
this.dislocationMultiplier = 1;
|
||||
this.accelerationUpgrades = 0;
|
||||
this.chargingFrequency = 20;
|
||||
this.chargingRate = 0;
|
||||
this.maxCharge = 0;
|
||||
this.totalCharge = 0;
|
||||
return;
|
||||
} else if (!tier.equals(EnumAltarTier.ONE) && upgrade != null)
|
||||
{
|
||||
|
@ -473,6 +523,9 @@ public class BloodAltar
|
|||
this.dislocationMultiplier = (float) (Math.pow(1.2, upgrade.getDisplacementCount()));
|
||||
this.orbCapacityMultiplier = (float) (1 + 0.02 * upgrade.getOrbCapacityCount());
|
||||
this.accelerationUpgrades = upgrade.getAccelerationCount();
|
||||
this.chargingFrequency = Math.max(20 - upgrade.getAccelerationCount(), 1);
|
||||
this.chargingRate = 100 * upgrade.getChargingCount();
|
||||
this.maxCharge = (int) (FluidContainerRegistry.BUCKET_VOLUME * Math.max(0.5 * capacityMultiplier, 1) * upgrade.getChargingCount());
|
||||
}
|
||||
|
||||
this.capacity = (int) (FluidContainerRegistry.BUCKET_VOLUME * 10 * capacityMultiplier);
|
||||
|
@ -484,6 +537,8 @@ public class BloodAltar
|
|||
this.fluidOutput.amount = this.bufferCapacity;
|
||||
if (this.fluidInput.amount > this.bufferCapacity)
|
||||
this.fluidInput.amount = this.bufferCapacity;
|
||||
if (this.totalCharge > this.maxCharge)
|
||||
this.totalCharge = this.maxCharge;
|
||||
|
||||
tileAltar.getWorld().markBlockForUpdate(tileAltar.getPos());
|
||||
}
|
||||
|
@ -640,4 +695,19 @@ public class BloodAltar
|
|||
this.cooldownAfterCrafting = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public int getChargingRate()
|
||||
{
|
||||
return chargingRate;
|
||||
}
|
||||
|
||||
public int getTotalCharge()
|
||||
{
|
||||
return totalCharge;
|
||||
}
|
||||
|
||||
public int getChargingFrequency()
|
||||
{
|
||||
return chargingFrequency == 0 ? 1 : chargingFrequency;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,10 @@ public class Constants
|
|||
public static final String ALTAR_ACCELERATION_UPGRADES = "accelerationUpgrades";
|
||||
public static final String ALTAR_DEMON_BLOOD_DURATION = "demonBloodDuration";
|
||||
public static final String ALTAR_COOLDOWN_AFTER_CRAFTING = "cooldownAfterCrafting";
|
||||
public static final String ALTAR_TOTAL_CHARGE = "totalCharge";
|
||||
public static final String ALTAR_MAX_CHARGE = "maxCharge";
|
||||
public static final String ALTAR_CHARGE_RATE = "chargeRate";
|
||||
public static final String ALTAR_CHARGE_FREQUENCY = "chargeFrequency";
|
||||
|
||||
public static final String ALTARMAKER_CURRENT_TIER = "currentTier";
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ public class AltarUpgrade
|
|||
private int orbCapacityCount;
|
||||
private int betterCapacityCount;
|
||||
private int accelerationCount;
|
||||
private int chargingCount;
|
||||
|
||||
// Adders
|
||||
|
||||
|
@ -74,4 +75,10 @@ public class AltarUpgrade
|
|||
accelerationCount++;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AltarUpgrade addCharging()
|
||||
{
|
||||
chargingCount++;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,12 @@ public interface IBloodAltar
|
|||
|
||||
float getConsumptionRate();
|
||||
|
||||
int getChargingRate();
|
||||
|
||||
int getChargingFrequency();
|
||||
|
||||
int getTotalCharge();
|
||||
|
||||
int getLiquidRequired();
|
||||
|
||||
int getBufferCapacity();
|
||||
|
@ -44,7 +50,7 @@ public interface IBloodAltar
|
|||
* This can only be set while the altar is not active.
|
||||
*
|
||||
* @param cooldown
|
||||
* - How long the cooldown should last
|
||||
* - How long the cooldown should last
|
||||
*/
|
||||
void requestPauseAfterCrafting(int cooldown);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.block.material.Material;
|
|||
|
||||
public class BlockBloodRune extends BlockString
|
||||
{
|
||||
public static final String[] names = { "blank", "speed", "efficiency", "sacrifice", "selfSacrifice", "displacement", "capacity", "augCapacity", "orb", "acceleration" };
|
||||
public static final String[] names = { "blank", "speed", "efficiency", "sacrifice", "selfSacrifice", "displacement", "capacity", "augCapacity", "orb", "acceleration", "charging" };
|
||||
|
||||
public BlockBloodRune()
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
|
|||
int tier = altar.getTier().ordinal() + 1;
|
||||
currentEssence = altar.getCurrentBlood();
|
||||
int capacity = altar.getCapacity();
|
||||
int charge = altar.getTotalCharge();
|
||||
altar.checkTier();
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
|
@ -61,10 +62,10 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
|
|||
int progress = altar.getProgress();
|
||||
int totalLiquidRequired = altar.getLiquidRequired() * ((IInventory) tile).getStackInSlot(0).stackSize;
|
||||
int consumptionRate = (int) (altar.getConsumptionRate() * (altar.getConsumptionMultiplier() + 1));
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentAltarProgress", progress, totalLiquidRequired), TextHelper.localize(tooltipBase + "currentAltarConsumptionRate", consumptionRate), TextHelper.localize(tooltipBase + "currentAltarTier", tier), TextHelper.localize(tooltipBase + "currentEssence", currentEssence), TextHelper.localize(tooltipBase + "currentAltarCapacity", capacity));
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentAltarProgress", progress, totalLiquidRequired), TextHelper.localize(tooltipBase + "currentAltarConsumptionRate", consumptionRate), TextHelper.localize(tooltipBase + "currentAltarTier", tier), TextHelper.localize(tooltipBase + "currentEssence", currentEssence), TextHelper.localize(tooltipBase + "currentAltarCapacity", capacity), TextHelper.localize(tooltipBase + "currentCharge", charge));
|
||||
} else
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentAltarTier", tier), TextHelper.localize(tooltipBase + "currentEssence", currentEssence), TextHelper.localize(tooltipBase + "currentAltarCapacity", capacity));
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentAltarTier", tier), TextHelper.localize(tooltipBase + "currentEssence", currentEssence), TextHelper.localize(tooltipBase + "currentAltarCapacity", capacity), TextHelper.localize(tooltipBase + "currentCharge", charge));
|
||||
}
|
||||
}
|
||||
} else
|
||||
|
|
|
@ -70,16 +70,11 @@ public class ModBlocks
|
|||
InventoryRenderHelper renderHelper = BloodMagic.proxy.getRenderHelper();
|
||||
|
||||
renderHelper.fluidRender(lifeEssence);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 0);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 1);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 2);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 3);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 4);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 5);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 6);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 7);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 8);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), 9);
|
||||
for (int i = 0; i < BlockBloodRune.names.length; i++)
|
||||
{
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodRune), i);
|
||||
}
|
||||
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualController), 0);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualController), 1);
|
||||
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualStone), 0);
|
||||
|
|
|
@ -239,4 +239,22 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable,
|
|||
{
|
||||
bloodAltar.setActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChargingRate()
|
||||
{
|
||||
return bloodAltar.getChargingRate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalCharge()
|
||||
{
|
||||
return bloodAltar.getTotalCharge();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChargingFrequency()
|
||||
{
|
||||
return bloodAltar.getChargingFrequency();
|
||||
}
|
||||
}
|
|
@ -56,6 +56,11 @@
|
|||
"textures": {
|
||||
"all": "bloodmagic:blocks/AccelerationRune"
|
||||
}
|
||||
},
|
||||
"charging": {
|
||||
"textures": {
|
||||
"all": "bloodmagic:blocks/ChargingRune"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,6 +174,7 @@ tooltip.BloodMagic.sigil.seer.currentAltarConsumptionRate=Consumption Rate: %d L
|
|||
tooltip.BloodMagic.sigil.seer.currentAltarTier=Current Tier: %d
|
||||
tooltip.BloodMagic.sigil.seer.currentEssence=Current Essence: %d LP
|
||||
tooltip.BloodMagic.sigil.seer.currentAltarCapacity=Current Capacity: %d LP
|
||||
tooltip.BloodMagic.sigil.seer.currentCharge=Current Charge: %d
|
||||
tooltip.BloodMagic.sigil.phantomBridge.desc=&oWalking on thin air...
|
||||
tooltip.BloodMagic.sigil.whirlwind.desc=&oBest not to wear a skirt
|
||||
tooltip.BloodMagic.sigil.enderSeverance.desc=&oPutting Endermen in Dire situations!
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "bloodmagic:blocks/ChargingRune"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"parent": "bloodmagic:block/BlockBloodRune10",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 693 B |
Loading…
Reference in a new issue