Search in sources :

Example 6 with BloodOrb

use of WayofTime.bloodmagic.orb.BloodOrb in project BloodMagic by WayofTime.

the class BlockAltar method getComparatorInputOverride.

@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
    if (world.isRemote)
        return 0;
    TileEntity tile = world.getTileEntity(pos);
    if (tile != null && tile instanceof TileAltar) {
        TileAltar altar = (TileAltar) tile;
        ItemStack orbStack = altar.getStackInSlot(0);
        if (world.getBlockState(pos.down()).getBlock() instanceof BlockDecorative) {
            if (orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable) {
                BloodOrb orb = ((IBloodOrb) orbStack.getItem()).getOrb(orbStack);
                Binding binding = ((IBindable) orbStack.getItem()).getBinding(orbStack);
                if (orb != null && binding != null) {
                    SoulNetwork soulNetwork = NetworkHelper.getSoulNetwork(binding);
                    int maxEssence = orb.getCapacity();
                    int currentEssence = soulNetwork.getCurrentEssence();
                    int level = currentEssence * 15 / maxEssence;
                    return Math.min(15, level) % 16;
                }
            }
        } else {
            int maxEssence = altar.getCapacity();
            int currentEssence = altar.getCurrentBlood();
            int level = currentEssence * 15 / maxEssence;
            return Math.min(15, level) % 16;
        }
    }
    return 0;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Binding(WayofTime.bloodmagic.core.data.Binding) IBindable(WayofTime.bloodmagic.iface.IBindable) IBloodOrb(WayofTime.bloodmagic.orb.IBloodOrb) BloodOrb(WayofTime.bloodmagic.orb.BloodOrb) SoulNetwork(WayofTime.bloodmagic.core.data.SoulNetwork) IBloodOrb(WayofTime.bloodmagic.orb.IBloodOrb) ItemStack(net.minecraft.item.ItemStack) TileAltar(WayofTime.bloodmagic.tile.TileAltar)

Example 7 with BloodOrb

use of WayofTime.bloodmagic.orb.BloodOrb in project BloodMagic by WayofTime.

the class RegistrarBloodMagic method registerBloodOrbs.

@SubscribeEvent
public static void registerBloodOrbs(RegistryEvent.Register<BloodOrb> event) {
    ResourceLocation orb = RegistrarBloodMagicItems.BLOOD_ORB.getRegistryName();
    event.getRegistry().registerAll(new BloodOrb("weak", 1, 5000, 2).withModel(new ModelResourceLocation(orb, "type=weak")).setRegistryName("weak"), new BloodOrb("apprentice", 2, 25000, 5).withModel(new ModelResourceLocation(orb, "type=apprentice")).setRegistryName("apprentice"), new BloodOrb("magician", 3, 150000, 15).withModel(new ModelResourceLocation(orb, "type=magician")).setRegistryName("magician"), new BloodOrb("master", 4, 1000000, 25).withModel(new ModelResourceLocation(orb, "type=master")).setRegistryName("master"), new BloodOrb("archmage", 5, 10000000, 50).withModel(new ModelResourceLocation(orb, "type=archmage")).setRegistryName("archmage"), new BloodOrb("transcendent", 6, 30000000, 50).withModel(new ModelResourceLocation(orb, "type=transcendent")).setRegistryName("transcendent"));
}
Also used : BloodOrb(WayofTime.bloodmagic.orb.BloodOrb) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 8 with BloodOrb

use of WayofTime.bloodmagic.orb.BloodOrb in project BloodMagic by WayofTime.

the class ItemBloodOrb method getSubItems.

@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
    if (!isInCreativeTab(creativeTab))
        return;
    for (BloodOrb orb : RegistrarBloodMagic.BLOOD_ORBS) {
        ItemStack orbStack = new ItemStack(this);
        NBTTagCompound tag = new NBTTagCompound();
        tag.setString("orb", orb.getRegistryName().toString());
        orbStack.setTagCompound(tag);
        list.add(orbStack);
    }
}
Also used : BloodOrb(WayofTime.bloodmagic.orb.BloodOrb) IBloodOrb(WayofTime.bloodmagic.orb.IBloodOrb) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack)

Aggregations

BloodOrb (WayofTime.bloodmagic.orb.BloodOrb)8 IBloodOrb (WayofTime.bloodmagic.orb.IBloodOrb)6 ItemStack (net.minecraft.item.ItemStack)5 Binding (WayofTime.bloodmagic.core.data.Binding)4 SoulNetwork (WayofTime.bloodmagic.core.data.SoulNetwork)3 IBindable (WayofTime.bloodmagic.iface.IBindable)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 TileAltar (WayofTime.bloodmagic.tile.TileAltar)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 BloodMagicCraftedEvent (WayofTime.bloodmagic.api.event.BloodMagicCraftedEvent)1 RecipeBloodAltar (WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar)1 ItemBindEvent (WayofTime.bloodmagic.event.ItemBindEvent)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1 WorldServer (net.minecraft.world.WorldServer)1