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;
}
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"));
}
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);
}
}
Aggregations