commit
5ec35fcd08
|
@ -68,6 +68,7 @@ public class BloodMagic {
|
|||
public void init(FMLInitializationEvent event) {
|
||||
AlchemicalWizardryPacketHandler.init();
|
||||
|
||||
ModRecipes.init();
|
||||
ModRituals.initRituals();
|
||||
ModRituals.initImperfectRituals();
|
||||
ConfigHandler.checkRituals();
|
||||
|
|
|
@ -19,6 +19,7 @@ public class NBTHolder {
|
|||
public static final String NBT_RUNNING = "isRunning";
|
||||
public static final String NBT_RUNTIME = "runtime";
|
||||
public static final String NBT_REAGENTTANK = "reagentTanks";
|
||||
public static final String NBT_CURRENT_INCENSE = "BM:CurrentIncense";
|
||||
public static final String NBT_ALTAR_TIER = "upgradeLevel";
|
||||
public static final String NBT_ALTAR_ACTIVE = "isActive";
|
||||
public static final String NBT_ALTAR_LIQUID_REQ = "liquidRequired";
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package WayofTime.bloodmagic.api.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
public class SacrificeKnifeUsedEvent extends Event {
|
||||
public final EntityPlayer player;
|
||||
public boolean shouldDrainHealth;
|
||||
public boolean shouldFillAltar;
|
||||
public final int healthDrained;
|
||||
|
||||
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp) {
|
||||
this.player = player;
|
||||
this.shouldDrainHealth = shouldDrainHealth;
|
||||
this.shouldFillAltar = shouldFillAltar;
|
||||
this.healthDrained = hp;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package WayofTime.bloodmagic.api.util.helper;
|
||||
|
||||
import WayofTime.bloodmagic.api.NBTHolder;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class IncenseHelper {
|
||||
public static float getCurrentIncense(EntityPlayer player) {
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
if (data.hasKey(NBTHolder.NBT_CURRENT_INCENSE)) {
|
||||
return data.getFloat(NBTHolder.NBT_CURRENT_INCENSE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void setCurrentIncense(EntityPlayer player, float amount) {
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
data.setFloat(NBTHolder.NBT_CURRENT_INCENSE, amount);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package WayofTime.bloodmagic.api.util.helper;
|
||||
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PlayerSacrificeHelper {
|
||||
public static float scalingOfSacrifice = 0.001f;
|
||||
public static int soulFrayDuration = 400;
|
||||
public static Potion soulFrayId;
|
||||
|
||||
public static float getPlayerIncense(EntityPlayer player) {
|
||||
return IncenseHelper.getCurrentIncense(player);
|
||||
}
|
||||
|
||||
public static void setPlayerIncense(EntityPlayer player, float amount) {
|
||||
IncenseHelper.setCurrentIncense(player, amount);
|
||||
}
|
||||
|
||||
public static boolean incrementIncense(EntityPlayer player, float min, float max, float increment) {
|
||||
float amount = getPlayerIncense(player);
|
||||
if (amount < min || amount >= max) {
|
||||
return false;
|
||||
}
|
||||
|
||||
amount = amount + Math.min(increment, max - amount);
|
||||
setPlayerIncense(player, amount);
|
||||
|
||||
// System.out.println("Amount of incense: " + amount + ", Increment: " + increment);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean sacrificePlayerHealth(EntityPlayer player) {
|
||||
if (player.isPotionActive(soulFrayId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float amount = getPlayerIncense(player);
|
||||
|
||||
if (amount >= 0) {
|
||||
float health = player.getHealth();
|
||||
float maxHealth = player.getMaxHealth();
|
||||
|
||||
if (health > maxHealth / 10.0) {
|
||||
float sacrificedHealth = health - maxHealth / 10.0f;
|
||||
|
||||
if (findAndFillAltar(player.getEntityWorld(), player, (int) (sacrificedHealth * 100f * getModifier(amount)))) {
|
||||
player.setHealth(maxHealth / 10.0f);
|
||||
setPlayerIncense(player, 0);
|
||||
player.addPotionEffect(new PotionEffect(soulFrayId.id, soulFrayDuration));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float getModifier(float amount) {
|
||||
return 1 + amount * scalingOfSacrifice;
|
||||
}
|
||||
|
||||
public static boolean findAndFillAltar(World world, EntityPlayer player, int amount) {
|
||||
int posX = (int) Math.round(player.posX - 0.5f);
|
||||
int posY = (int) player.posY;
|
||||
int posZ = (int) Math.round(player.posZ - 0.5f);
|
||||
IBloodAltar altarEntity = getAltar(world, new BlockPos(posX, posY, posZ));
|
||||
|
||||
if (altarEntity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
altarEntity.sacrificialDaggerCall(amount, false);
|
||||
altarEntity.startCycle();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static IBloodAltar getAltar(World world, BlockPos blockPos) {
|
||||
TileEntity tileEntity;
|
||||
|
||||
for (int i = -2; i <= 2; i++) {
|
||||
for (int j = -2; j <= 2; j++) {
|
||||
for (int k = -2; k <= 1; k++) {
|
||||
tileEntity = world.getTileEntity(new BlockPos(i + blockPos.getX(), k + blockPos.getY(), j + blockPos.getZ()));
|
||||
|
||||
if (tileEntity instanceof IBloodAltar) {
|
||||
return (IBloodAltar) tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,223 @@
|
|||
package WayofTime.bloodmagic.item;
|
||||
|
||||
public class ItemSacrificialDagger
|
||||
{
|
||||
|
||||
}
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.DamageSourceBloodMagic;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerSacrificeHelper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSacrificialDagger extends Item {
|
||||
public static String[] names = {"normal", "creative"};
|
||||
|
||||
public ItemSacrificialDagger() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".sacrificialDagger.");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setHasSubtypes(true);
|
||||
setMaxStackSize(1);
|
||||
setFull3D();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List list) {
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
// if (AlchemicalWizardry.wimpySettings)
|
||||
{
|
||||
// par3List.add(StatCollector.translateToLocal("tooltip.sacrificialdagger.desc1"));
|
||||
}
|
||||
// else
|
||||
{
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sacrificialdagger.desc2"));
|
||||
par3List.add(StatCollector.translateToLocal("tooltip.sacrificialdagger.desc3"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int itemInUseCount) {
|
||||
// if(itemInUseCount < 32)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
PlayerSacrificeHelper.sacrificePlayerHealth(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return EnumAction.BOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (this.canUseForSacrifice(stack)) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, 2);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (evt.shouldDrainHealth) {
|
||||
player.setHealth(player.getHealth() - 2);
|
||||
}
|
||||
|
||||
if (!evt.shouldFillAltar) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerHelper.isFakePlayer(player)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
double posX = player.posX;
|
||||
double posY = player.posY;
|
||||
double posZ = player.posZ;
|
||||
world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
float f = 1.0F;
|
||||
float f1 = f * 0.6F + 0.4F;
|
||||
float f2 = f * f * 0.7F - 0.5F;
|
||||
float f3 = f * f * 0.6F - 0.7F;
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
|
||||
}
|
||||
|
||||
if (!world.isRemote && PlayerHelper.isFakePlayer(player)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
// if (player.isPotionActive(AlchemicalWizardry.customPotionSoulFray))
|
||||
{
|
||||
// findAndFillAltar(world, player, 20);
|
||||
}
|
||||
// else
|
||||
{
|
||||
findAndFillAltar(world, player, 200);
|
||||
}
|
||||
|
||||
if (player.getHealth() <= 0.001f) {
|
||||
player.onDeath(new DamageSourceBloodMagic());
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void findAndFillAltar(World world, EntityPlayer player, int amount) {
|
||||
BlockPos pos = player.getPosition();
|
||||
IBloodAltar altarEntity = getAltar(world, pos);
|
||||
|
||||
if (altarEntity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
altarEntity.sacrificialDaggerCall(amount, false);
|
||||
altarEntity.startCycle();
|
||||
}
|
||||
|
||||
public IBloodAltar getAltar(World world, BlockPos pos) {
|
||||
TileEntity tileEntity;
|
||||
|
||||
for (int i = -2; i <= 2; i++) {
|
||||
for (int j = -2; j <= 2; j++) {
|
||||
for (int k = -2; k <= 1; k++) {
|
||||
BlockPos newPos = pos.add(i, j, k);
|
||||
tileEntity = world.getTileEntity(newPos);
|
||||
|
||||
if (tileEntity instanceof IBloodAltar) {
|
||||
return (IBloodAltar) tileEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
if (!world.isRemote && entity instanceof EntityPlayer) {
|
||||
this.setUseForSacrifice(stack, this.isPlayerPreparedForSacrifice(world, (EntityPlayer) entity));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
// if (AlchemicalWizardry.wimpySettings)
|
||||
{
|
||||
// return "Sacrificial Orb";
|
||||
}
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
|
||||
public boolean isPlayerPreparedForSacrifice(World world, EntityPlayer player) {
|
||||
return !world.isRemote && (PlayerSacrificeHelper.getPlayerIncense(player) > 0);
|
||||
}
|
||||
|
||||
public boolean canUseForSacrifice(ItemStack stack) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
return tag != null && tag.getBoolean("sacrifice");
|
||||
}
|
||||
|
||||
public void setUseForSacrifice(ItemStack stack, boolean sacrifice) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag == null) {
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
|
||||
tag.setBoolean("sacrifice", sacrifice);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack stack) {
|
||||
return this.canUseForSacrifice(stack) || super.hasEffect(stack);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
|||
import WayofTime.bloodmagic.item.ItemActivationCrystal;
|
||||
import WayofTime.bloodmagic.item.ItemBloodOrb;
|
||||
import WayofTime.bloodmagic.item.ItemBucketEssence;
|
||||
import WayofTime.bloodmagic.item.ItemSacrificialDagger;
|
||||
import WayofTime.bloodmagic.item.sigil.ItemSigilAir;
|
||||
import WayofTime.bloodmagic.item.sigil.ItemSigilDivination;
|
||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
||||
|
@ -28,6 +29,8 @@ public class ModItems {
|
|||
|
||||
public static Item activationCrystal;
|
||||
|
||||
public static Item sacrificialDagger;
|
||||
|
||||
public static Item sigilDivination;
|
||||
public static Item sigilAir;
|
||||
|
||||
|
@ -51,6 +54,8 @@ public class ModItems {
|
|||
|
||||
activationCrystal = registerItem(new ItemActivationCrystal());
|
||||
|
||||
sacrificialDagger = registerItem(new ItemSacrificialDagger());
|
||||
|
||||
sigilDivination = registerItem(new ItemSigilDivination());
|
||||
sigilAir = registerItem(new ItemSigilAir());
|
||||
}
|
||||
|
@ -72,6 +77,9 @@ public class ModItems {
|
|||
renderHelper.itemRender(activationCrystal, 1);
|
||||
renderHelper.itemRender(activationCrystal, 2, "ItemActivationCrystal0");
|
||||
|
||||
renderHelper.itemRender(sacrificialDagger, 0);
|
||||
renderHelper.itemRender(sacrificialDagger, 1);
|
||||
|
||||
renderHelper.itemRender(sigilDivination);
|
||||
renderHelper.itemRender(sigilAir);
|
||||
}
|
||||
|
|
22
src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java
Normal file
22
src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package WayofTime.bloodmagic.registry;
|
||||
|
||||
import WayofTime.bloodmagic.api.ItemStackWrapper;
|
||||
import WayofTime.bloodmagic.api.altar.AltarRecipe;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
import net.minecraft.init.Items;
|
||||
|
||||
public class ModRecipes {
|
||||
public static void init() {
|
||||
addAltarRecipes();
|
||||
}
|
||||
|
||||
public static void addAltarRecipes() {
|
||||
AltarRecipeRegistry.registerRecipe(new AltarRecipe(new ItemStackWrapper(ModItems.bloodOrb, 0), new ItemStackWrapper(Items.diamond), EnumAltarTier.ONE, 2000, 2, 1, false));
|
||||
// AltarRecipeRegistry.registerRecipe(new ItemStack(ModItems.bloodOrb, 1), new ItemStack(Items.emerald), 2, 5000, 5, 5, false);
|
||||
// AltarRecipeRegistry.registerRecipe(new ItemStack(ModItems.bloodOrb, 2), new ItemStack(Blocks.gold_block), 3, 25000, 20, 20, false);
|
||||
// AltarRecipeRegistry.registerRecipe(new ItemStack(ModItems.bloodOrb, 3), new ItemStack(ModItems.weakBloodShard), 4, 40000, 30, 50, false);
|
||||
// AltarRecipeRegistry.registerRecipe(new ItemStack(ModItems.bloodOrb, 4), new ItemStack(ModItems.demonBloodShard), 5, 75000, 50, 100, false);
|
||||
// AltarRecipeRegistry.registerRecipe(new ItemStack(ModItems.bloodOrb, 5), new ItemStack(ModBlocks.blockCrystal), 6, 200000, 100, 200, false);
|
||||
}
|
||||
}
|
|
@ -8,7 +8,9 @@ import WayofTime.bloodmagic.api.altar.AltarRecipe;
|
|||
import WayofTime.bloodmagic.api.altar.AltarUpgrade;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.block.BlockLifeEssence;
|
||||
import com.google.common.base.Enums;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -53,6 +55,9 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
|
|||
|
||||
public TileAltar() {
|
||||
super(1, "altar");
|
||||
|
||||
this.capacity = FluidContainerRegistry.BUCKET_VOLUME * 10;
|
||||
this.bufferCapacity = FluidContainerRegistry.BUCKET_VOLUME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,20 +154,37 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
|
|||
}
|
||||
|
||||
private void everySecond() {
|
||||
startCycle();
|
||||
int syphonMax = (int) (20 * this.dislocationMultiplier);
|
||||
int fluidInputted;
|
||||
int fluidOutputted;
|
||||
fluidInputted = Math.min(syphonMax, -this.fluid.amount + capacity);
|
||||
fluidInputted = Math.min(this.fluidInput.amount, fluidInputted);
|
||||
this.fluid.amount += fluidInputted;
|
||||
this.fluidInput.amount -= fluidInputted;
|
||||
fluidOutputted = Math.min(syphonMax, this.bufferCapacity - this.fluidOutput.amount);
|
||||
fluidOutputted = Math.min(this.fluid.amount, fluidOutputted);
|
||||
this.fluidOutput.amount += fluidOutputted;
|
||||
this.fluid.amount -= fluidOutputted;
|
||||
}
|
||||
|
||||
private void everyFiveSeconds() {
|
||||
checkTier();
|
||||
startCycle();
|
||||
updat();
|
||||
}
|
||||
|
||||
public void startCycle() {
|
||||
if (worldObj != null)
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
|
||||
checkTier();
|
||||
|
||||
if (fluid == null || fluid.amount <= 0)
|
||||
return;
|
||||
|
||||
if (!isActive) {
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
if (getStackInSlot(0) != null) {
|
||||
// Do recipes
|
||||
if (AltarRecipeRegistry.getRecipes().containsKey(ItemStackWrapper.getHolder(getStackInSlot(0)))) {
|
||||
|
@ -170,13 +192,106 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
|
|||
|
||||
if (altarTier.ordinal() >= recipe.getMinTier().ordinal()) {
|
||||
this.liquidRequired = recipe.getSyphon();
|
||||
// this.canBeFilled = recipe
|
||||
this.canBeFilled = recipe.isUseTag();
|
||||
this.consumptionRate = recipe.getConsumeRate();
|
||||
this.drainRate = recipe.getDrainRate();
|
||||
this.isActive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
private void updat() {
|
||||
if (!isActive) {
|
||||
if (cooldownAfterCrafting > 0) {
|
||||
cooldownAfterCrafting--;
|
||||
}
|
||||
}
|
||||
|
||||
if (getStackInSlot(0) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int worldTime = (int) (worldObj.getWorldTime() % 24000);
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!canBeFilled) {
|
||||
if (fluid != null && fluid.amount >= 1) {
|
||||
int stackSize = getStackInSlot(0).stackSize;
|
||||
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
||||
|
||||
if (liquidDrained > (liquidRequired * stackSize - progress)) {
|
||||
liquidDrained = liquidRequired * stackSize - progress;
|
||||
}
|
||||
|
||||
fluid.amount = fluid.amount - liquidDrained;
|
||||
progress += liquidDrained;
|
||||
|
||||
if (worldTime % 4 == 0) {
|
||||
// SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (progress >= liquidRequired * stackSize) {
|
||||
ItemStack result = AltarRecipeRegistry.getRecipeForInput(ItemStackWrapper.getHolder(getStackInSlot(0))) != null ? (AltarRecipeRegistry.getRecipeForInput(ItemStackWrapper.getHolder(getStackInSlot(0))).getOutput() != null ? AltarRecipeRegistry.getRecipeForInput(ItemStackWrapper.getHolder(getStackInSlot(0))).getOutput().toStack() : null) : null;
|
||||
if (result != null) {
|
||||
result.stackSize *= stackSize;
|
||||
}
|
||||
|
||||
setInventorySlotContents(0, result);
|
||||
progress = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
// SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 4, xCoord + 0.5f, yCoord + 1.0f, zCoord + 0.5f);
|
||||
}
|
||||
this.isActive = false;
|
||||
}
|
||||
} else if (progress > 0) {
|
||||
progress -= (int) (efficiencyMultiplier * drainRate);
|
||||
|
||||
if (worldTime % 2 == 0) {
|
||||
// SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 2, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ItemStack returnedItem = getStackInSlot(0);
|
||||
|
||||
if (!(returnedItem.getItem() instanceof IBloodOrb)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBloodOrb item = (IBloodOrb) (returnedItem.getItem());
|
||||
NBTTagCompound itemTag = returnedItem.getTagCompound();
|
||||
|
||||
if (itemTag == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String ownerName = itemTag.getString("ownerName");
|
||||
|
||||
if (ownerName.equals("")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fluid != null && fluid.amount >= 1) {
|
||||
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
|
||||
|
||||
int drain = NetworkHelper.addCurrentEssenceToMaximum(ownerName, liquidDrained, (int) (item.getMaxEssence(returnedItem.getMetadata()) * this.orbCapacityMultiplier));
|
||||
|
||||
fluid.amount = fluid.amount - drain;
|
||||
|
||||
if (worldTime % 4 == 0) {
|
||||
// SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 3, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (worldObj != null) {
|
||||
worldObj.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkTier() {
|
||||
|
@ -280,6 +395,14 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
|
|||
this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1);
|
||||
}
|
||||
|
||||
public void setActive() {
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestPauseAfterCrafting(int amount) {
|
||||
if (this.isActive) {
|
||||
|
@ -357,4 +480,4 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
|
|||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,8 +6,8 @@ item.BloodMagic.activationCrystal.weak.name=Weak Activation Crystal
|
|||
item.BloodMagic.activationCrystal.awakened.name=Awakened Activation Crystal
|
||||
item.BloodMagic.activationCrystal.creative.name=Creative Activation Crystal
|
||||
|
||||
item.BloodMagic.dagger.name=Sacrificial Dagger
|
||||
item.BloodMagic.dagger.creative.name=Creative Sacrificial Dagger
|
||||
item.BloodMagic.sacrificialDagger.normal.name=Sacrificial Dagger
|
||||
item.BloodMagic.sacrificialDagger.creative.name=Creative Sacrificial Dagger
|
||||
|
||||
item.BloodMagic.bucket.lifeEssence.name=Bucket of Life
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent":"bloodmagic:item/ItemModelBase",
|
||||
"textures": {
|
||||
"layer0":"bloodmagic:items/SacrificialDagger"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue