use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class ItemSentientSword method recalculatePowers.
public void recalculatePowers(ItemStack stack, World world, EntityPlayer player) {
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
recalculatePowers(stack, type, soulsRemaining);
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class ModCorruptionBlocks method init.
public static void init() {
for (EnumDemonWillType type : EnumDemonWillType.values()) {
CorruptionHandler.registerBlockCorruption(type, Blocks.STONE, 0, RegistrarBloodMagicBlocks.DEMON_EXTRAS.getStateFromMeta(type.ordinal()));
CorruptionHandler.registerBlockCorruption(type, Blocks.GRASS, 0, RegistrarBloodMagicBlocks.DEMON_EXTRAS.getStateFromMeta(type.ordinal()));
CorruptionHandler.registerBlockCorruption(type, Blocks.DIRT, 0, RegistrarBloodMagicBlocks.DEMON_EXTRAS.getStateFromMeta(type.ordinal()));
}
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class Ritual method getErrorForBlockRangeOnFail.
public ITextComponent getErrorForBlockRangeOnFail(EntityPlayer player, String range, IMasterRitualStone master, BlockPos offset1, BlockPos offset2) {
AreaDescriptor descriptor = this.getBlockRange(range);
if (descriptor == null) {
return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooBig", "?");
}
List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(master.getWorldObj(), master.getBlockPos());
int maxVolume = this.getMaxVolumeForRange(range, willConfig, holder);
int maxVertical = this.getMaxVerticalRadiusForRange(range, willConfig, holder);
int maxHorizontal = this.getMaxHorizontalRadiusForRange(range, willConfig, holder);
if (maxVolume > 0 && descriptor.getVolumeForOffsets(offset1, offset2) > maxVolume) {
return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooBig", maxVolume);
} else {
return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooFar", maxVertical, maxHorizontal);
}
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class TileDemonCrucible method deserialize.
@Override
public void deserialize(NBTTagCompound tag) {
super.deserialize(tag);
willMap.clear();
for (EnumDemonWillType type : EnumDemonWillType.values()) {
double amount = tag.getDouble("EnumWill" + type.getName());
if (amount > 0) {
willMap.put(type, amount);
}
}
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class TileDemonCrucible method update.
@Override
public void update() {
if (getWorld().isRemote) {
return;
}
internalCounter++;
if (getWorld().isBlockPowered(getPos())) {
// TODO: Fill the contained gem if it is there.
ItemStack stack = this.getStackInSlot(0);
if (stack.getItem() instanceof IDemonWillGem) {
IDemonWillGem gemItem = (IDemonWillGem) stack.getItem();
for (EnumDemonWillType type : EnumDemonWillType.values()) {
if (willMap.containsKey(type)) {
double current = willMap.get(type);
double fillAmount = Math.min(gemDrainRate, current);
if (fillAmount > 0) {
fillAmount = gemItem.fillWill(type, stack, fillAmount, true);
if (willMap.get(type) - fillAmount <= 0) {
willMap.remove(type);
} else {
willMap.put(type, willMap.get(type) - fillAmount);
}
}
}
}
}
} else {
ItemStack stack = this.getStackInSlot(0);
if (!stack.isEmpty()) {
if (stack.getItem() instanceof IDemonWillGem) {
IDemonWillGem gemItem = (IDemonWillGem) stack.getItem();
for (EnumDemonWillType type : EnumDemonWillType.values()) {
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
double drainAmount = Math.min(maxWill - currentAmount, gemDrainRate);
double filled = WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, drainAmount, maxWill, false);
filled = gemItem.drainWill(type, stack, filled, false);
if (filled > 0) {
filled = gemItem.drainWill(type, stack, filled, true);
WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, filled, maxWill, true);
}
}
} else if (// TODO: Limit the speed of this process
stack.getItem() instanceof IDiscreteDemonWill) {
IDiscreteDemonWill willItem = (IDiscreteDemonWill) stack.getItem();
EnumDemonWillType type = willItem.getType(stack);
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
double needed = maxWill - currentAmount;
double discreteAmount = willItem.getDiscretization(stack);
if (needed >= discreteAmount) {
double filled = willItem.drainWill(stack, discreteAmount);
if (filled > 0) {
WorldDemonWillHandler.fillWillToMaximum(getWorld(), pos, type, filled, maxWill, true);
if (stack.getCount() <= 0) {
this.setInventorySlotContents(0, ItemStack.EMPTY);
}
}
}
}
}
}
}
Aggregations